public void ProcessRequest(HttpContext context) { try { // Local Variables. string uRequestID = String.Empty; string uStatus = String.Empty; String SOAPEndPoint = context.Session["SOAPEndPoint"].ToString(); String internalOauthToken = context.Session["internalOauthToken"].ToString(); String id = context.Request.QueryString["id"].ToString().Trim(); String status = context.Request.QueryString["status"].ToString().Trim(); // Create the SOAP binding for call. BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "UserNameSoapBinding"; binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; binding.MaxReceivedMessageSize = 2147483647; var client = new SoapClient(binding, new EndpointAddress(new Uri(SOAPEndPoint))); client.ClientCredentials.UserName.UserName = "******"; client.ClientCredentials.UserName.Password = "******"; using (var scope = new OperationContextScope(client.InnerChannel)) { // Add oAuth token to SOAP header. XNamespace ns = "http://exacttarget.com"; var oauthElement = new XElement(ns + "oAuthToken", internalOauthToken); var xmlHeader = MessageHeader.CreateHeader("oAuth", "http://exacttarget.com", oauthElement); OperationContext.Current.OutgoingMessageHeaders.Add(xmlHeader); // Setup Subscriber Object to pass fields for updating. Subscriber sub = new Subscriber(); sub.ID = int.Parse(id); sub.IDSpecified = true; if (status.ToLower() == "unsubscribed") sub.Status = SubscriberStatus.Unsubscribed; else sub.Status = SubscriberStatus.Active; sub.StatusSpecified = true; // Call the Update method on the Subscriber object. UpdateResult[] uResults = client.Update(new UpdateOptions(), new APIObject[] { sub }, out uRequestID, out uStatus); if (uResults != null && uStatus.ToLower().Equals("ok")) { String strResults = string.Empty; strResults += uResults; // Return the update results from handler. context.Response.Write(strResults); } else { context.Response.Write("Not OK!"); } } } catch (Exception ex) { context.Response.Write(ex); } }
public void Soap11ClientIssuesAValidRequest() { var mockMessageHandler = new MockHttpMessageHandler(); mockMessageHandler .Expect(HttpMethod.Post, FakeEndpoint) .With(req => req.Content.Headers.ContentType.MediaType == Soap11MediaType) .With(req => req.Content.Headers.ContentType.CharSet == SoapCharSet) .Respond(HttpStatusCode.OK); Task<HttpResponseMessage> result; using (var sut = new SoapClient(() => new HttpClient(mockMessageHandler))) { result = sut.PostAsync(FakeEndpoint, _fakeBody); } result.ShouldBeType(typeof(Task<HttpResponseMessage>)); mockMessageHandler.VerifyNoOutstandingExpectation(); }
public static void PerformImportDefinition(SoapClient soapClient, string ImportDefinitionCustomerKey) { ImportDefinition id = new ImportDefinition(); id.CustomerKey = ImportDefinitionCustomerKey; string sStatus = ""; string sStatusMessage = ""; string sRequestId = ""; PerformResult[] pResults = soapClient.Perform(new PerformOptions(), "start", new APIObject[] { id }, out sStatus, out sStatusMessage, out sRequestId); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Status Message: " + sStatusMessage); Console.WriteLine("Request ID: " + sRequestId); foreach (PerformResult pr in pResults) { // Task.ID Value is needed in order to check status of import using follow-up call Console.WriteLine("TaskID: " + pr.Task.ID); Console.WriteLine("StatusCode: " + pr.StatusCode); Console.WriteLine("ErrorCode: " + pr.ErrorCode); Console.WriteLine("StatusMessage: " + pr.StatusMessage); } }
public static void PerformEmailSendDefinition(SoapClient soapClient, string EmailSendDefinitionCustomerKey) { EmailSendDefinition esd = new EmailSendDefinition(); esd.CustomerKey = EmailSendDefinitionCustomerKey; string sStatus = ""; string sStatusMessage = ""; string sRequestId = ""; PerformResult[] pResults = soapClient.Perform(new PerformOptions(), "start", new APIObject[] { esd }, out sStatus, out sStatusMessage, out sRequestId); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Status Message: " + sStatusMessage); Console.WriteLine("Request ID: " + sRequestId); foreach (PerformResult pr in pResults) { // Task.ID Value is the JobID of the send that is initiated Console.WriteLine("TaskID: " + pr.Task.ID); Console.WriteLine("StatusCode: " + pr.StatusCode); Console.WriteLine("ErrorCode: " + pr.ErrorCode); Console.WriteLine("StatusMessage: " + pr.StatusMessage); } }
private static SoapClient GetInstance() { // Create the binding BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "UserNameSoapBinding"; binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; TimeSpan timespan = new TimeSpan(0, 5, 0); binding.ReceiveTimeout = timespan; binding.OpenTimeout = timespan; binding.CloseTimeout = timespan; binding.SendTimeout = timespan; // Set the transport security to UsernameOverTransport for Plaintext usernames EndpointAddress endpoint = new EndpointAddress("https://webservice.s6.exacttarget.com/Service.asmx"); // Create the SOAP Client (and pass in the endpoint and the binding) SoapClient client = new SoapClient(binding, endpoint); // Set the username and password client.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["ExactTargetUserName"]; client.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["ExactTargetPassword"]; return client; }
public static void UpdateSubscriber(SoapClient soapClient, string iEmailAddress, int iListID) { Subscriber sub = new Subscriber(); sub.EmailAddress = iEmailAddress; // Define the SubscriberList and set the status to Active SubscriberList subList = new SubscriberList(); subList.ID = iListID; subList.IDSpecified = true; subList.Status = SubscriberStatus.Active; // If no Action is specified at the SubscriberList level, the default action is to // update the subscriber if they already exist and create them if they do not. // subList.Action = "create"; //Relate the SubscriberList defined to the Subscriber sub.Lists = new SubscriberList[] { subList }; string sStatus = ""; string sRequestId = ""; UpdateResult[] uResults = soapClient.Update(new UpdateOptions(), new APIObject[] { sub }, out sRequestId, out sStatus); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Request ID: " + sRequestId); foreach (UpdateResult ur in uResults) { Console.WriteLine("StatusCode: " + ur.StatusCode); Console.WriteLine("StatusMessage: " + ur.StatusMessage); Console.WriteLine("ErrorCode: " + ur.ErrorCode); } }
public static void RetrieveImportResultsSummary(SoapClient soapClient, string TaskID) { RetrieveRequest rr = new RetrieveRequest(); rr.ObjectType = "ImportResultsSummary"; SimpleFilterPart sf = new SimpleFilterPart(); sf.Property = "TaskResultID"; sf.SimpleOperator = SimpleOperators.equals; sf.Value = new String[] { TaskID }; rr.Filter = sf; rr.Properties = new string[] { "ImportStatus" }; string sStatus = ""; string sRequestId = ""; APIObject[] rResults; sStatus = soapClient.Retrieve(rr, out sRequestId, out rResults); Console.WriteLine("Status: " + sStatus); Console.WriteLine("RequestID: " + sRequestId); foreach (ImportResultsSummary irs in rResults) { // Possible values for ImportStatus are New, Processing, Completed, Error, IOWork, and Unknown Console.WriteLine("ImportStatus: " + irs.ImportStatus); } }
public void InitFrom() { InitializeComponent(); SoapRead = new SoapClient(IpAddress); SoapWrite = new SoapClient(IpAddress); Login = SoapRead.Login() && SoapWrite.Login(); LL_J1_D.Enabled = Login; if (Login) { ThreadPool.QueueUserWorkItem(new WaitCallback(Poll), null); } RB_Joint_CheckedChanged(this,null); TB_F1.Text = CurFrame[0].ToString(); TB_F2.Text = CurFrame[1].ToString(); TB_F3.Text = CurFrame[2].ToString(); TB_F4.Text = CurFrame[3].ToString(); TB_F5.Text = CurFrame[4].ToString(); TB_F6.Text = CurFrame[5].ToString(); TB_T1.Text = CurTool[0].ToString(); TB_T2.Text = CurTool[1].ToString(); TB_T3.Text = CurTool[2].ToString(); TB_T4.Text = CurTool[3].ToString(); TB_T5.Text = CurTool[4].ToString(); TB_T6.Text = CurTool[5].ToString(); }
public ZuoraService(String username, String password, String endpoint) { this.username = username; this.password = password; this.endpoint = endpoint; this.svc = CreateClient(endpoint); }
private static void GetClient(IExactTargetConfiguration config) { _SharedClent = new SharedRequestClient(config); triggeredSendDefinitionClient = new TriggeredSendDefinitionClient(config); _dataExtensionClient = new DataExtensionClient(config); _deliveryProfileClient = new DeliveryProfileClient(config); _Client = SoapClientFactory.Manufacture(config); }
public static SoapClient Manufacture(IExactTargetConfiguration config) { var client = new SoapClient(config.SoapBinding ?? "ExactTarget.Soap", config.EndPoint); if (client.ClientCredentials == null) return null; client.ClientCredentials.UserName.UserName = config.ApiUserName; client.ClientCredentials.UserName.Password = config.ApiPassword; return client; }
public static void CreateDateExtension(SoapClient soapClient, string iDataExtensionName, string iDataExtensionCustomerKey) { DataExtension de = new DataExtension(); de.Name = iDataExtensionName; de.CustomerKey = iDataExtensionCustomerKey; de.IsSendable = true; de.IsSendableSpecified = true; DataExtensionField def = new DataExtensionField(); def.Name = "EMAIL"; de.SendableDataExtensionField = def; //Sendable SubscriberField will be "Email Address" by default //If SubscriberKey option is enabled then value needs to be "Subscriber Key" ExactTargetSOAPAPI.Attribute attr = new ExactTargetSOAPAPI.Attribute(); attr.Name = "Email Address"; de.SendableSubscriberField = attr; DataExtensionField emailField = new DataExtensionField(); emailField.Name = "EMAIL"; emailField.FieldType = DataExtensionFieldType.EmailAddress; emailField.FieldTypeSpecified = true; emailField.IsRequired = true; emailField.IsRequiredSpecified = true; emailField.IsPrimaryKey = true; emailField.IsPrimaryKeySpecified = true; emailField.MaxLength = 50; emailField.MaxLengthSpecified = true; DataExtensionField fnameField = new DataExtensionField(); fnameField.Name = "FIRST NAME"; fnameField.FieldType = DataExtensionFieldType.Text; fnameField.FieldTypeSpecified = true; DataExtensionField lnameField = new DataExtensionField(); lnameField.Name = "LAST NAME"; lnameField.FieldType = DataExtensionFieldType.Text; lnameField.FieldTypeSpecified = true; de.Fields = new DataExtensionField[] { emailField, fnameField, lnameField }; string sStatus = ""; string sRequestId = ""; CreateResult[] aoResults = soapClient.Create(new CreateOptions(), new APIObject[] { de }, out sRequestId, out sStatus); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Request ID: " + sRequestId); foreach (CreateResult cr in aoResults) { Console.WriteLine("StatusCode: " + cr.StatusCode); Console.WriteLine("ErrorCode: " + cr.ErrorCode); Console.WriteLine("StatusMessage: " + cr.StatusMessage); } }
private void BT_Login_Click(object sender, EventArgs e) { if (CB_IP.Text == "") { MessageBox.Show("请输入CS8C IP 地址"); return; } if (CB_App.Text == "") { MessageBox.Show("请输入下位机加载的应用程序名"); return; } sc = new SoapClient(CB_IP.Text.Trim()); if (!sc.PingNet()) { MessageBox.Show("网络不通,请检查IP地址是否正确或者网络链接"); return; } if (!sc.Login()) { MessageBox.Show("Soap登录失败"); return; } sc.SoapGetAppname = @"Disk://" + CB_App.Text + "/" + CB_App.Text + ".pjx"; byte[] data = sc.GetAppdata(); if (!RobotKit.StaubliXML.IsGlobelData("nJointForce", data)) { MessageBox.Show("应用程序中nJointForce变量不存在"); return; } GetDataByTime = RD_Time.Checked; if (!GetDataByTime) { if (!RobotKit.StaubliXML.IsGlobelData("nID", data)) { MessageBox.Show("应用程序中nID变量不存在"); return; } } JointIndex = CB_JointIndex.SelectedIndex; pm.Title = "Staubli机器人关节" + (JointIndex + 1).ToString() + "受力"; MessageBox.Show("登录成功"); BT_Start.Enabled = true; GB_Setting.Enabled = false; }
public static void ExtractDataExtension(SoapClient soapClient, string DataExtensionCustomerKey, string FileName) { ExtractRequest er = new ExtractRequest(); er.ID = "bb94a04d-9632-4623-be47-daabc3f588a6"; // Always set an StartDate to the value specified ExtractParameter epOne = new ExtractParameter(); epOne.Name = "StartDate"; epOne.Value = "1/1/1900 1:00:00 AM"; // Always set an StartDate to the value specified ExtractParameter epTwo = new ExtractParameter(); epTwo.Name = "EndDate"; epTwo.Value = "1/1/1900 1:00:00 AM"; // Always set an _Async to 0 ExtractParameter epThree = new ExtractParameter(); epThree.Name = "_AsyncID"; epThree.Value = "0"; ExtractParameter epFour = new ExtractParameter(); epFour.Name = "OutputFileName"; epFour.Value = FileName; ExtractParameter epFive = new ExtractParameter(); epFive.Name = "DECustomerKey"; epFive.Value = DataExtensionCustomerKey; ExtractParameter epSix = new ExtractParameter(); epSix.Name = "HasColumnHeaders"; epSix.Value = "true"; er.Parameters = new ExtractParameter[] { epOne, epTwo, epThree, epFour, epFive, epSix }; string sRequestId; string sStatus; ExtractResult[] results; sStatus = soapClient.Extract(new ExtractRequest[] { er }, out sRequestId, out results); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Request ID: " + sRequestId); foreach (ExtractResult eresult in results) { Console.WriteLine("StatusCode: " + eresult.StatusCode); Console.WriteLine("ErrorCode: " + eresult.ErrorCode); Console.WriteLine("StatusMessage: " + eresult.StatusMessage); } }
public static void CreateImportDefinition(SoapClient soapClient, string iImportDefinitionName, string iImportDefinitionCustomerKey, string iTargetDataExtensionCustomerKey, string iImportFileName) { ImportDefinition id = new ImportDefinition(); id.Name = iImportDefinitionName; id.CustomerKey = iImportDefinitionCustomerKey; // Optional value, if AllowErrors is true then it will not stop the import when // a single row has an error id.AllowErrors = true; id.AllowErrorsSpecified = true; // For this example, we are sending to a data extension // Value for CustomerKey will be for a data extension already created in your account DataExtension de = new DataExtension(); de.CustomerKey = iTargetDataExtensionCustomerKey; id.DestinationObject = de; AsyncResponse ar = new AsyncResponse(); ar.ResponseType = AsyncResponseType.email; ar.ResponseAddress = "*****@*****.**"; id.Notification = ar; FileTransferLocation ftl = new FileTransferLocation(); ftl.CustomerKey = "ExactTarget Enhanced FTP"; id.RetrieveFileTransferLocation = ftl; // Specify how the import will be handled // If data extension has no primary key specified then only "Overwrite" will work id.UpdateType = ImportDefinitionUpdateType.AddAndUpdate; id.UpdateTypeSpecified = true; id.FieldMappingType = ImportDefinitionFieldMappingType.InferFromColumnHeadings; id.FieldMappingTypeSpecified = true; id.FileSpec = iImportFileName; id.FileType = FileType.CSV; id.FileTypeSpecified = true; string sStatus = ""; string sRequestId = ""; CreateResult[] aoResults = soapClient.Create(new CreateOptions(), new APIObject[] { id }, out sRequestId, out sStatus); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Request ID: " + sRequestId); foreach (CreateResult cr in aoResults) { Console.WriteLine("StatusCode: " + cr.StatusCode); Console.WriteLine("ErrorCode: " + cr.ErrorCode); Console.WriteLine("StatusMessage: " + cr.StatusMessage); } }
public async Task <byte[]> GetWsdlAsync(Uri securityServerUri, SubSystemIdentifier subSystemId, ServiceIdentifier targetService) { byte[] wsdlFileBytes = { }; var client = SoapClient.Prepare() .WithHandler(new DelegatingSoapHandler { OnHttpResponseAsyncAction = async(soapClient, httpContext, cancellationToken) => { if (httpContext.Response.Content.IsMimeMultipartContent()) { var streamProvider = await httpContext.Response.Content.ReadAsMultipartAsync(cancellationToken); var contentCursor = streamProvider.Contents.GetEnumerator(); contentCursor.MoveNext(); var soapResponse = contentCursor.Current; contentCursor.MoveNext(); var wsdlFile = contentCursor.Current; contentCursor.Dispose(); wsdlFileBytes = await wsdlFile.ReadAsByteArrayAsync(); httpContext.Response.Content = soapResponse; } } }); var body = SoapEnvelope.Prepare().Body(new GetWsdlRequest { ServiceCode = targetService.ServiceCode, ServiceVersion = targetService.ServiceVersion }).WithHeaders(new List <SoapHeader> { IdHeader.Random, UserIdHeader, ProtocolVersionHeader.Version40, (XRoadClient)subSystemId, new XRoadService { Instance = targetService.Instance, MemberClass = targetService.MemberClass, MemberCode = targetService.MemberCode, SubSystemCode = targetService.SubSystemCode, ServiceCode = "getWsdl", ServiceVersion = "v1" } }); var result = await client.SendAsync(securityServerUri.ToString(), string.Empty, body); result.ThrowIfFaulted(); return(wsdlFileBytes); }
static async Task Main(string[] args) { var wsdl = await WsdlHelper.Build(K_URI_SERVICE + "?wsdl"); var soapRequest = await SoapHelper.BuildSoapRequest(K_URI_SERVICE, K_OPERATION); var soapClient = new SoapClient(K_URI_SERVICE, wsdl.Definitions.Binding.OperationsBinding.First(o => o.Name == K_OPERATION).Action); var soapResponse = await soapClient.PostAsync("POST", soapRequest); }
public Dictionary <string, Dictionary <string, string> > GetDataExtension() { Dictionary <string, Dictionary <string, string> > dict = new Dictionary <string, Dictionary <string, string> >(); SoapClient client = new SoapClient(); client.ClientCredentials.UserName.UserName = "******"; client.ClientCredentials.UserName.Password = "******"; APIObject[] Results; String requestID; String status; RetrieveRequest1 rr1 = new RetrieveRequest1(); RetrieveRequest rr = new RetrieveRequest(); rr.ObjectType = "DataExtensionObject[Alert_Inbox]"; rr.Properties = new string[] { "Alert_Category", "Alert_Subject" }; rr1.RetrieveRequest = rr; SimpleFilterPart sf = new SimpleFilterPart(); sf.SimpleOperator = SimpleOperators.equals; sf.Property = "ET_Surrogate_ID"; try { //var result = Task.Run(async () => client.RetrieveAsync(rr1)); // var values = result.GetAwaiter().GetResult().GetAwaiter().GetResult(); var results = client.Retrieve(rr, out requestID, out Results); if (Results.Length > 0) { for (int i = 0; i < Results.Length; i++) { DataExtensionObject deo = (DataExtensionObject)Results[i]; Dictionary <string, string> props = new Dictionary <string, string>(); string transactionID = ""; foreach (APIProperty prop in deo.Properties) { if (prop.Name == "ET_Transaction_ID") { transactionID = prop.Value; } props[prop.Name] = prop.Value; } dict[transactionID] = props; } } } catch (Exception e) { } //var results = client.RetrieveAsync(rr1); return(dict); }
private void BT_Login_Click(object sender, EventArgs e) { if (CB_IP.Text == "") { MessageBox.Show("请输入CS8C IP 地址"); return; } //if (CB_App.Text == "") //{ // MessageBox.Show("请输入下位机加载的应用程序名"); // return; //} sc = new SoapClient(CB_IP.Text.Trim()); if (!sc.PingNet()) { MessageBox.Show("网络不通,请检查IP地址是否正确或者网络链接"); return; } if (!sc.Login()) { MessageBox.Show("Soap登录失败"); return; } // sc.SoapGetAppname = @"Disk://" + CB_App.Text + "/" + CB_App.Text + ".pjx"; // byte[] data = sc.GetAppdata(); //if (!RobotKit.StaubliXML.IsGlobelData("nRobotSpeed", data)) //{ // MessageBox.Show("应用程序中 nRobotSpeed变量不存在"); // return; //} // GetDataByTime = RD_Time.Checked; //if (!GetDataByTime) //{ // if (!RobotKit.StaubliXML.IsGlobelData("nID", data)) // { // MessageBox.Show("应用程序中nID变量不存在"); // return; // } //} MessageBox.Show("登录成功"); BT_Start.Enabled = true; GB_Setting.Enabled = false; }
/// <summary> /// Read data from the the general ledger. /// </summary> /// <param name="requestOptions">The request options.</param> /// <returns></returns> public async Task <GeneralLedgerData> GetGeneralLedgerData(List <GeneralLedgerRequestOption> requestOptions) { var requestString = GeneralLedgerRequestOptionsParser.Parse(requestOptions); var balanceSheetDataResult = await SoapClient.ProcessXmlDocumentAsync( await SoapHeader.GetHeaderAsync(new Header()), requestString.ToXmlNode() ); var balanceSheetHeaders = new Dictionary <string, TwinfieldDataLineHeader>(); var balanceSheetDataList = new List <List <TwinfieldDataLine> >(); var firstNode = true; foreach (XmlNode row in balanceSheetDataResult.ProcessXmlDocumentResult) { if (firstNode) { foreach (XmlNode el in row.ChildNodes) { if (el.Name.Equals("td")) { balanceSheetHeaders[el.InnerText] = new TwinfieldDataLineHeader() { ValueType = el.Attributes["type"]?.Value, Label = el.Attributes["label"]?.Value }; } } firstNode = false; } else { var rowData = new List <TwinfieldDataLine>(); foreach (XmlNode el in row) { if (el.Name.Equals("td")) { rowData.Add(new TwinfieldDataLine() { Field = el.Attributes["field"]?.Value, Label = balanceSheetHeaders[el.Attributes["field"]?.Value]?.Label, Value = new TwinfieldValue(balanceSheetHeaders[el.Attributes["field"]?.Value]?.ValueType, el.InnerText) }); } } balanceSheetDataList.Add(rowData); } } return(new GeneralLedgerData() { Headers = balanceSheetHeaders, Data = balanceSheetDataList }); }
static async void Main(string[] args) { EndpointAddress endpointAddress = new EndpointAddress(""); SoapClient soapClient = new SoapClient(); var loginResponse = await soapClient.loginAsync(new LoginScopeHeader(), "*****@*****.**", "!HalaMadrid@20197uAFwMrL7g23pNrQ6sqrNzMd"); }
public void Login() { var soapClient = new SoapClient(); var loginResult = soapClient.login(null, Username, Password + Token); SessionId = loginResult.sessionId; MetadataUrl = loginResult.metadataServerUrl; EnterpriseUrl = loginResult.serverUrl; Console.WriteLine($"Logged in with session ID: {SessionId}"); }
public void ResetSyncSucceeds() { _soapStub.As <ICalculatorStateService>() .Setup(s => s.Reset(It.IsAny <XLangCalculatorRequest>())); var client = SoapClient <ICalculatorStateService> .For(_calculatorServiceHost.Endpoint); Assert.That(() => client.Reset(new(CALCULATOR_REQUEST_XML)), Throws.Nothing); client.Close(); }
public void CleanAsyncSucceeds() { _soapStub.As <ICalculatorStateServiceSync>() .Setup(s => s.Clean(It.IsAny <XLangCalculatorRequest>())); var client = SoapClient <ICalculatorStateServiceSync> .For(_calculatorServiceHost.Endpoint); Action(() => client.Clean(new XLangCalculatorRequest(CALCULATOR_REQUEST_XML))).Should().NotThrow(); client.Close(); }
public static TreeNode CrearNodoSoapClient(SoapClient s) { TreeNode n0; n0 = new TreeNode(); n0.Tag = s; n0.Name = s.Nombre; n0.Text = s.Descripcion; return(n0); }
private void modernButton2_Click(object sender, EventArgs e) { try { modernRichTextBoxResponse.Text = SoapClient.SendRequestString(modernTextBoxUri.Text, modernRichTextBoxRequest.Text, "a", "b").Content; } catch (Exception ex) { modernRichTextBoxResponse.Text = ex.ToString(); } }
public string Invoke(string xpathExpression, string responseId = null) { var response = XDocument.Parse(SoapClient.GetResponseContent(responseId)); if (response.XPathSelectElements(xpathExpression).Any()) { return("true"); } throw new AssertionException("Element exists", "Element does not exist", WebDrivers.Default); }
public void RelaySyncInvalidMessageFails() { var client = SoapClient <IValidatingCalculatorService> .For(_calculatorServiceHost.Endpoint); Invoking(() => client.Add(new(INVALID_CALCULATOR_REQUEST_XML))) .Should().Throw <FaultException <ExceptionDetail> >() .Which.Detail.InnerException.InnerException.Message.Should().Contain( "The element 'Arguments' in namespace 'urn:services.stateless.be:unit:calculator' has invalid child element 'Operand' in namespace 'urn:services.stateless.be:unit:calculator'. " + "List of possible elements expected: 'Term' in namespace 'urn:services.stateless.be:unit:calculator'"); client.Close(); }
public void SoapClientRequiresABodyToBeProvided() { // Setup var sut = new SoapClient(); // Exercise Action act = () => sut.PostAsync(FakeEndpoint, null).Wait(); // Verify outcome act.ShouldThrowExactly <ArgumentNullException>(); }
public bool IntegrateSFDCId_OperatortoDB(string Usernames, string UserName, string Password) { logger.Info("Scheduled Driver job triggered"); bool result = false; SoapClient ss = new SoapClient(); LoginResult lr = new LoginResult(); DBAction dba = new DBAction(_integrationAppSettings); List <ClsUsersList> ObjList = new List <ClsUsersList>(); if (sessionId == null | sessionId == "") { // Login Call var lastintegratedDate = dba.GetLastintegratedDateandTime("Integrate_CustomerInfo"); lr = ss.login(null, UserName, Password); if (!lr.passwordExpired) { sessionId = lr.sessionId.ToString().Trim(); serverUrl = lr.serverUrl.ToString().Trim(); // Store SessionId in SessionHeader; We will need while making query() call SessionHeader sHeader = new SessionHeader(); sHeader.sessionId = sessionId; // Variable to store query results QueryResult qr = new QueryResult(); SoapClient ss1 = new SoapClient(); ss1.ChannelFactory.Endpoint.Address = new System.ServiceModel.EndpointAddress(serverUrl); ss1.query(sHeader, null, null, null, @"Select Id,EmployeeNumber,UserRoleID,IsActive,Username,CompanyName From User WHERE Username IN (" + Usernames + ")", out qr); sObject[] records = qr.records; if (records != null) { if (records.Length > 0) { for (int i = 0; i <= records.Length - 1; i++) { ClsUsersList Obj = new ClsUsersList(); Obj.Id = ((SfServiceRef.User)qr.records[i]).Id; Obj.IsActive = (bool)((SfServiceRef.User)qr.records[i]).IsActive; Obj.UserName = ((SfServiceRef.User)qr.records[i]).Username; Obj.UserRoleID = ((SfServiceRef.User)qr.records[i]).UserRoleId; ObjList.Add(Obj); } dba.IntegrateAllDriver(ObjList); result = true; } else { result = false; } } } } return(result); }
private async void button2_Click(object sender, EventArgs e) { var wsdl = await WsdlHelper.Build(textBox1.Text + "?wsdl"); var soapClient = new SoapClient(textBox1.Text, wsdl.Definitions.Binding.OperationsBinding.First(o => o.Name == comboBox1.SelectedItem.ToString()).Action); var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(richTextBox1.Text); var soapResponse = await soapClient.PostAsync("POST", xmlDocument); richTextBox2.Text = XmlFormatParserHelper.GetFormattedXml(soapResponse); }
public static SoapClient Manufacture(IExactTargetConfiguration config) { var client = new SoapClient(config.SoapBinding ?? "ExactTarget.Soap", config.EndPoint); if (client.ClientCredentials == null) { return(null); } client.ClientCredentials.UserName.UserName = config.ApiUserName; client.ClientCredentials.UserName.Password = config.ApiPassword; return(client); }
} // null by default #endregion #region Public IServices Members /// <summary> /// Returns an HTML fragment suitable for inclusion in any standards-mode web page, which embeds a HotDocs interview /// directly in that web page. /// </summary> /// <param name="template">The template for which the interview will be requested.</param> /// <param name="answers">The initial set of answers to include in the interview.</param> /// <param name="settings">Settings that define various interview behavior.</param> /// <param name="markedVariables">A collection of variables that should be marked with special formatting in the interview.</param> /// <param name="logRef">A string to display in logs related to this request.</param> /// <returns>An object which contains an HTML fragment to be inserted in a web page to display the interview.</returns> public InterviewResult GetInterview(Template template, TextReader answers, InterviewSettings settings, IEnumerable <string> markedVariables, string logRef) { // Validate input parameters, creating defaults as appropriate. string logStr = logRef == null ? string.Empty : logRef; if (template == null) { throw new ArgumentNullException("template", string.Format(@"Cloud.Services.GetInterview: the ""template"" parameter passed in was null, logRef: {0}", logStr)); } if (settings == null) { settings = new InterviewSettings(); } // Configure interview settings settings.Settings["OmitImages"] = "true"; // Instructs HDS not to return images used by the interview; we'll get them ourselves from the template location. (See GetInterviewFile below.) settings.Settings["OmitDefinitions"] = "true"; // Instructs HDS not to return interview definitions; we'll get them ourselves from the template location. (See GetInterviewFile below.) settings.Settings["TempInterviewUrl"] = Util.GetInterviewImageUrl(settings, template); settings.Settings["InterviewDefUrl"] = Util.GetInterviewDefinitionUrl(settings, template); settings.MarkedVariables = (string[])(markedVariables ?? new string[0]); // Get the interview. InterviewResult result = new InterviewResult(); BinaryObject[] interviewFiles = null; using (var client = new SoapClient(_subscriberID, _signingKey, HostAddress, ProxyAddress)) { interviewFiles = client.GetInterview( template, answers == null ? "" : answers.ReadToEnd(), settings, logRef ); // Throw an exception if we do not have exactly one interview file. // Although interviewFiles could potentially contain more than one item, the only one we care about is the // first one, which is the HTML fragment. All other items, such as interview definitions (.JS and .DLL files) // or dialog element images are not needed, because we can get them out of the package file instead. // We enforce this by setting the OmitImages and OmitDefinitions values above, so we will always have exactly one item here. if (interviewFiles.Length != 1) { throw new Exception(); } StringBuilder htmlFragment = new StringBuilder(Util.ExtractString(interviewFiles[0])); Util.AppendSdkScriptBlock(htmlFragment, template, settings); result.HtmlFragment = htmlFragment.ToString(); } return(result); }
public Client(X509Certificate certificate, Environment environment, TimeSpan httpTimeout) { var domain = environment.Match( Environment.Test, _ => "www7.aeat.es", Environment.Production, _ => "www1.agenciatributaria.gob.es" ); var endpointUri = new Uri($"https://{domain}/wlpl/SSII-FACT/ws/fe/SiiFactFEV1SOAP"); SoapClient = new SoapClient(endpointUri, certificate, httpTimeout); SoapClient.HttpRequestFinished += (sender, args) => HttpRequestFinished?.Invoke(this, args); SoapClient.XmlMessageSerialized += (sender, args) => XmlMessageSerialized?.Invoke(this, args); }
public string Invoke(string xpathExpression, string expectedValue, string responseId = null) { var response = XDocument.Parse(SoapClient.GetResponseContent(responseId)); var value = response.XPathSelectElement(xpathExpression).Descendants().First().Value; if (value != expectedValue) { throw new AssertionException(value, expectedValue, WebDrivers.Default); } return("true"); }
public async Task <String> InvokeMethodWS(string uri, string method, string request) { var wsdl = await WsdlHelper.Build($"{uri}?wsdl"); var soapClient = new SoapClient(uri, wsdl.Definitions.Binding.OperationsBinding.First(o => o.Name == method).Action); var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(request); var soapResponse = await soapClient.PostAsync("POST", xmlDocument); return(XmlFormatParserHelper.GetFormattedXml(soapResponse)); }
/// <summary> /// Start creating a scan report. /// </summary> /// <param name="scanId"> /// The scan ID to generate a report for. /// </param> /// <param name="reportType"> /// The report type. /// </param> /// <returns> /// The report ID. /// </returns> /// <exception cref="CheckmarxErrorException"> /// The Checkmarx API returned an unexpected error. /// </exception> /// <exception cref="CheckmarxCommunicationException"> /// An error occurred communicating with the Checkmarx server. /// </exception> public long CreateScanReport(long scanId, CxWSReportType reportType) { CxWSReportRequest reportRequest; reportRequest = new CxWSReportRequest() { ScanID = scanId, Type = reportType }; return(CallCheckmarxApi(() => SoapClient.CreateScanReport(SessionId, reportRequest)).ID); }
static private void Process_Record_Refund(ARC_Cybersource_Log_Refund arcRecord, RequestMessage request, System.Web.UI.WebControls.Label lbl) { #region Process Refund try { ReplyMessage reply = SoapClient.RunTransaction(request); string template = GetTemplate(reply.decision.ToUpper()); string content = GetContent(reply); arcRecord.ccContent = content; if (reply.decision == "ACCEPT") { arcRecord.Status = "Refunded"; } else if (reply.decision == "REJECT") { arcRecord.Status = "Rejected"; } else { arcRecord.Status = "Error"; } arcRecord.decision = reply.decision; arcRecord.merchantReferenceCode = reply.merchantReferenceCode; arcRecord.reasonCode = reply.reasonCode; arcRecord.requestID = reply.requestID; arcRecord.requestToken = reply.requestToken; if (reply.ccCreditReply != null) { arcRecord.ccCreditReply_amount = (reply.ccCreditReply.amount != null) ? arcRecord.ccCreditReply_amount = reply.ccCreditReply.amount : "0"; arcRecord.ccCreditReply_reasonCode = (reply.ccCreditReply.reasonCode != null) ? reply.ccCreditReply.reasonCode : ""; arcRecord.ccCreditReply_reconciliationID = (reply.ccCreditReply.reconciliationID != null) ? reply.ccCreditReply.reconciliationID : ""; arcRecord.ccCreditReply_requestDateTime = (reply.ccCreditReply.requestDateTime != null) ? reply.ccCreditReply.requestDateTime.Replace("T", " ").Replace("Z", "") : ""; } arcRecord.msgProcess = "success"; } catch (Exception ex) { ErrorLog.ErrorLog_Display(ex, "Refund Processing - Record Process", lbl); arcRecord.Status = "error"; arcRecord.msgProcess = "Process_Record_Refund - error<br />" + ex.Message; } finally { // Try to save even if we failed? Save_Record_Refund(arcRecord, lbl); } #endregion Process Refund }
private bool login() { Console.Write("Enter username: "******"Enter password: "******"Enter SalesForce user key: "); password = password + Console.ReadLine(); // Create a SoapClient specifically for logging in loginClient = new SoapClient(); try { Console.WriteLine("\nLogging in..."); lr = loginClient.login(null, username, password); } catch (Exception e) { Console.WriteLine("An unexpected error has occurred: " + e.Message); Console.WriteLine(e.StackTrace); return(false); } // Check if the password has expired if (lr.passwordExpired) { Console.WriteLine("An error has occurred. Your password has expired."); return(false); } /** Once the client application has logged in successfully, it will use * the results of the login call to reset the endpoint of the service * to the virtual server instance that is servicing your organization */ // On successful login, cache session info and API endpoint info endpoint = new EndpointAddress(lr.serverUrl); /** The sample client application now has a cached EndpointAddress * that is pointing to the correct endpoint. Next, the sample client * application sets a persistent SOAP header that contains the * valid sessionId for our login credentials. To do this, the sample * client application creates a new SessionHeader object. Add the session * ID returned from the login to the session header */ header = new SessionHeader(); header.sessionId = lr.sessionId; // Create and cache an API endpoint client client = new SoapClient("Soap", endpoint); // Return true to indicate that we are logged in, pointed // at the right URL and have our security token in place. Console.SetCursorPosition(Console.CursorLeft + 13, Console.CursorTop - 1); Console.Write("OK"); return(true); }
public static SoapClient AddCommonHeaders(this SoapClient soapClient) { return(soapClient .OnSoapEnvelopeRequest((sClient, arguments, token) => { var bodyElement = arguments.Envelope.Body.Value; bodyElement.Add(new XAttribute("callId", Random.Next())); bodyElement.Add(new XAttribute("requestTimestamp", DateTime.Now)); return Task.CompletedTask; })); }
public void ResetSyncFails() { _soapStub.As <ICalculatorStateServiceSync>() .Setup(s => s.Clean(It.IsAny <XLangCalculatorRequest>())) .Callback(() => throw new InvalidOperationException("Cannot process this request.")); var client = SoapClient <ICalculatorStateService> .For(_calculatorServiceHost.Endpoint); Action(() => client.Reset(new XLangCalculatorRequest(CALCULATOR_REQUEST_XML))) .Should().Throw <FaultException <ExceptionDetail> >() .WithMessage("Cannot process this request."); client.Abort(); }
public EmailRequestClient(IExactTargetConfiguration config) { _config = config; _client = SoapClientFactory.Manufacture(config); _emailFromTemplateCreator = new EmailCreator(new ExactTargetConfiguration { ApiUserName = _config.ApiUserName, ApiPassword = _config.ApiPassword, ClientId = _config.ClientId, EndPoint = _config.EndPoint, SoapBinding = _config.SoapBinding }); }
public async void Nasa_Trajectory_Soap11() { var soapClient = new SoapClient(); var ns = XNamespace.Get("http://helio.spdf.gsfc.nasa.gov/"); var result = await soapClient.PostAsync( new Uri("http://sscweb.gsfc.nasa.gov:80/WS/helio/1/HeliocentricTrajectoriesService"), SoapVersion.Soap11, body : new XElement(ns.GetName("getAllObjects"))); result.StatusCode.Should().Be(HttpStatusCode.OK); }
public static void ExtractDataExtension(SoapClient soapClient, string DataExtensionCustomerKey, string FileName) { ExtractRequest er = new ExtractRequest(); er.ID = "bb94a04d-9632-4623-be47-daabc3f588a6"; // Always set an StartDate to the value specified ExtractParameter epOne = new ExtractParameter(); epOne.Name = "StartDate"; epOne.Value = "1/1/1900 1:00:00 AM"; // Always set an StartDate to the value specified ExtractParameter epTwo = new ExtractParameter(); epTwo.Name = "EndDate"; epTwo.Value = "1/1/1900 1:00:00 AM"; // Always set an _Async to 0 ExtractParameter epThree = new ExtractParameter(); epThree.Name = "_AsyncID"; epThree.Value = "0"; ExtractParameter epFour = new ExtractParameter(); epFour.Name = "OutputFileName"; epFour.Value = FileName; ExtractParameter epFive = new ExtractParameter(); epFive.Name = "DECustomerKey"; epFive.Value = DataExtensionCustomerKey; ExtractParameter epSix = new ExtractParameter(); epSix.Name = "HasColumnHeaders"; epSix.Value = "true"; er.Parameters = new ExtractParameter[] {epOne, epTwo, epThree, epFour, epFive, epSix }; string sRequestId; string sStatus; ExtractResult[] results; sStatus = soapClient.Extract(new ExtractRequest[] { er }, out sRequestId, out results); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Request ID: " + sRequestId); foreach (ExtractResult eresult in results) { Console.WriteLine("StatusCode: " + eresult.StatusCode); Console.WriteLine("ErrorCode: " + eresult.ErrorCode); Console.WriteLine("StatusMessage: " + eresult.StatusMessage); } }
//Constructor public ET_Client(NameValueCollection parameters = null) { //Get configuration file and set variables System.Xml.XPath.XPathDocument doc = new System.Xml.XPath.XPathDocument(@"FuelSDK_config.xml"); foreach (System.Xml.XPath.XPathNavigator child in doc.CreateNavigator().Select("configuration")) { appSignature = child.SelectSingleNode("appSignature").Value.ToString().Trim(); clientId = child.SelectSingleNode("clientId").Value.ToString().Trim(); clientSecret = child.SelectSingleNode("clientSecret").Value.ToString().Trim(); soapEndPoint = child.SelectSingleNode("soapEndPoint").Value.ToString().Trim(); } //If JWT URL Parameter Used if (parameters != null && parameters.AllKeys.Contains("jwt")) { string encodedJWT = parameters["jwt"].ToString().Trim(); String decodedJWT = JsonWebToken.Decode(encodedJWT, appSignature); JObject parsedJWT = JObject.Parse(decodedJWT); authToken = parsedJWT["request"]["user"]["oauthToken"].Value<string>().Trim(); authTokenExpiration = DateTime.Now.AddSeconds(int.Parse(parsedJWT["request"]["user"]["expiresIn"].Value<string>().Trim())); internalAuthToken = parsedJWT["request"]["user"]["internalOauthToken"].Value<string>().Trim(); refreshKey = parsedJWT["request"]["user"]["refreshToken"].Value<string>().Trim(); } else { refreshToken(); } // Find the appropriate endpoint for the acccount ET_Endpoint getSingleEndpoint = new ET_Endpoint(); getSingleEndpoint.AuthStub = this; getSingleEndpoint.Type = "soap"; GetReturn grSingleEndpoint = getSingleEndpoint.Get(); if (grSingleEndpoint.Status && grSingleEndpoint.Results.Length == 1){ soapEndPoint = ((ET_Endpoint)grSingleEndpoint.Results[0]).URL; } else { throw new Exception("Unable to determine stack using /platform/v1/endpoints: " + grSingleEndpoint.Message); } //Create the SOAP binding for call with Oauth. BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "UserNameSoapBinding"; binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; binding.MaxReceivedMessageSize = 2147483647; soapclient = new SoapClient(binding, new EndpointAddress(new Uri(soapEndPoint))); soapclient.ClientCredentials.UserName.UserName = "******"; soapclient.ClientCredentials.UserName.Password = "******"; }
static void Main(string[] args) { BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "UserNameSoapBinding"; binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; binding.ReceiveTimeout = new TimeSpan(0, 5, 0); binding.OpenTimeout = new TimeSpan(0, 5, 0); binding.CloseTimeout = new TimeSpan(0, 5, 0); binding.SendTimeout = new TimeSpan(0, 5, 0); // Set the transport security to UsernameOverTransport for Plaintext usernames EndpointAddress endpoint = new EndpointAddress("https://webservice.exacttarget.com/Service.asmx"); // Create the SOAP Client (and pass in the endpoint and the binding) SoapClient soapClient = new SoapClient(binding, endpoint); // Username and Password are stored in the app.config file // Rename the app.config.template file in the project to app.config // Replace the putUsernameHere and putPasswordHere with credentials from your account soapClient.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["wsUserName"]; soapClient.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["wsPassword"]; /// /// Uncomment out the lines below in order to test the request you are interested in /// //CreateTriggeredSend(soapClient, "ExampleTSD", "*****@*****.**", "Darth", "Vader"); //CreateDateExtension(soapClient, "API Created DE Example - CSharp", "API Created DE Example - CSharp"); //CreateImportDefinition(soapClient,"API Created ImportDefinition -CSharp", "APICreatedID", "API Created DE Example - CSharp","importexample.csv"); //PerformImportDefinition(soapClient, "APICreatedID"); //RetrieveImportResultsSummary(soapClient, "126572217"); //CreateEmailSendDefinition(soapClient, "API Created EmailSendDefinition-CSharp", "API Created ESD-CSharp", 3113962, "2239", "ad36ce5a-7f1a-46ac-bcfe-e99027672e72"); //PerformEmailSendDefinition(soapClient, "API Created ESD-CSharp"); //RetrieveSend(soapClient, "11417771"); //UpdateSubscriber(soapClient, "*****@*****.**", 1947888); //ExtractDataExtension(soapClient, "Bademails", "CSharpExtractDE.csv"); //CreateAutomation(soapClient, "OnlyMac", "OnlyMac", "03770105-973c-e111-aaac-984be1783c78"); //RetrieveAutomation(soapClient, "aa697ba2-3531-4c26-8669-20594a949145"); //PerformAutomation(soapClient, "8b6aea33-6f91-4556-bae3-794650b328eb"); UpdateAutomation(soapClient, "8b6aea33-6f91-4556-bae3-794650b328eb", "This automation has a new name"); Console.WriteLine("Press enter to continue"); Console.ReadLine(); }
public void Soap11ClientIncludesSoapActionParameter() { var mockMessageHandler = new MockHttpMessageHandler(); mockMessageHandler .Expect(HttpMethod.Post, FakeEndpoint) .With(req => req.Content.Headers.Single(h => h.Key == "SOAPAction").Value.Single() == FakeAction) .Respond(HttpStatusCode.OK); Task<HttpResponseMessage> result; using (var sut = new SoapClient(() => new HttpClient(mockMessageHandler))) { result = sut.PostAsync(FakeEndpoint, _fakeBody, action: FakeAction); } result.ShouldBeType(typeof(Task<HttpResponseMessage>)); mockMessageHandler.VerifyNoOutstandingExpectation(); }
public static void CreateAutomation(SoapClient soapClient, string iEmailSendDefinitionName, string iEmailSendDefinitionCustomerKey, string iEmailSendDefinitionObjectID) { Automation automation = new Automation(); automation.Name = "SOAPAPI Test2_" + Guid.NewGuid().ToString(); // CustomerKey can be any string value, GUID is only used for example purposes automation.CustomerKey = Guid.NewGuid().ToString(); automation.Description = "SOAP API Created Example"; automation.AutomationType = "scheduled"; AutomationActivity activityOne = new AutomationActivity(); activityOne = new AutomationActivity(); // This is the ObjectID of the Definition Object activityOne.ObjectID = iEmailSendDefinitionObjectID; // This is the Name of the Definition Object activityOne.Name = iEmailSendDefinitionName; activityOne.Definition = new APIObject(); EmailSendDefinition activityOneDefinition = new EmailSendDefinition(); // Again this is the ObjectID of the Definition Object activityOneDefinition.ObjectID = iEmailSendDefinitionObjectID; // Again this is the Name of the Definition Object activityOneDefinition.Name = iEmailSendDefinitionName; activityOneDefinition.CustomerKey = iEmailSendDefinitionCustomerKey; activityOne.ActivityObject = activityOneDefinition; AutomationTask taskOne = new AutomationTask(); taskOne.Name = "Task 1"; taskOne.Activities = new AutomationActivity[] { activityOne }; automation.AutomationTasks = new AutomationTask[] { taskOne }; string RequestID = String.Empty; string OverallStatus = String.Empty; CreateResult[] createResults = soapClient.Create(new CreateOptions(), new APIObject[] { automation }, out RequestID, out OverallStatus); Console.WriteLine("Status: " + OverallStatus); foreach (CreateResult cr in createResults) { Console.WriteLine("NewObjectID: " + cr.NewObjectID); Console.WriteLine("StatusCode: " + cr.StatusCode); Console.WriteLine("ErrorCode: " + cr.ErrorCode); Console.WriteLine("StatusMessage: " + cr.StatusMessage); } }
public static void CreateTriggeredSend(SoapClient soapClient, string iTriggeredSendCustomerKey, string iEmailAddress, string iFirstName, string iLastName) { TriggeredSend ts = new TriggeredSend(); TriggeredSendDefinition tsd = new TriggeredSendDefinition(); tsd.CustomerKey = iTriggeredSendCustomerKey; ts.TriggeredSendDefinition = tsd; Subscriber sub = new Subscriber(); sub.EmailAddress = iEmailAddress; sub.SubscriberKey = iEmailAddress; ExactTargetSOAPAPI.Attribute firstName = new ExactTargetSOAPAPI.Attribute(); firstName.Name = "First Name"; firstName.Value = iFirstName; ExactTargetSOAPAPI.Attribute lastName = new ExactTargetSOAPAPI.Attribute(); lastName.Name = "Last Name"; lastName.Value = iLastName; sub.Attributes = new ExactTargetSOAPAPI.Attribute[] { firstName, lastName }; ts.Subscribers = new Subscriber[] { sub }; string sStatus = ""; string sRequestId = ""; CreateResult[] aoResults = soapClient.Create(new CreateOptions(), new APIObject[] { ts }, out sRequestId, out sStatus); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Request ID: " + sRequestId); foreach (TriggeredSendCreateResult tscr in aoResults) { if (tscr.SubscriberFailures != null) { foreach (SubscriberResult sr in tscr.SubscriberFailures) { Console.WriteLine("ErrorCode: " + sr.ErrorCode); Console.WriteLine("ErrorDescription: " + sr.ErrorDescription); } } } }
public static void CreateEmailSendDefinition(SoapClient soapClient, string EmailSendDefinitionName, string EmailSendDefinitionCustomerKey, int EmailID, string SendClassificationCustomerKey, string DataExtensionCustomerKey) { EmailSendDefinition esd = new EmailSendDefinition(); esd.Name = EmailSendDefinitionName; esd.CustomerKey = EmailSendDefinitionCustomerKey; Email em = new Email(); em.ID = EmailID; em.IDSpecified = true; esd.Email = em; SendDefinitionList sdl = new SendDefinitionList(); sdl.SendDefinitionListType = SendDefinitionListTypeEnum.SourceList; sdl.SendDefinitionListTypeSpecified = true; sdl.CustomerKey = DataExtensionCustomerKey; sdl.DataSourceTypeID = DataSourceTypeEnum.CustomObject; sdl.DataSourceTypeIDSpecified = true; esd.SendDefinitionList = new SendDefinitionList[] {sdl}; SendClassification sc = new SendClassification(); sc.CustomerKey = SendClassificationCustomerKey; esd.SendClassification = sc; string sStatus = ""; string sRequestId = ""; CreateResult[] aoResults = soapClient.Create(new CreateOptions(), new APIObject[] { esd }, out sRequestId, out sStatus); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Request ID: " + sRequestId); foreach (CreateResult cr in aoResults) { Console.WriteLine("StatusCode: " + cr.StatusCode); Console.WriteLine("ErrorCode: " + cr.ErrorCode); Console.WriteLine("StatusMessage: " + cr.StatusMessage); } }
public static void UpdateAutomation(SoapClient soapClient, string AutomationObjectID, string NewNameForAutomation) { Automation automation = new Automation(); automation.ObjectID = AutomationObjectID; automation.Name = NewNameForAutomation; string RequestID = String.Empty; string OverallStatus = String.Empty; UpdateResult[] createResults = soapClient.Update(new UpdateOptions(), new APIObject[] { automation }, out RequestID, out OverallStatus); Console.WriteLine("Status: " + OverallStatus); foreach (UpdateResult ur in createResults) { Console.WriteLine("StatusCode: " + ur.StatusCode); Console.WriteLine("ErrorCode: " + ur.ErrorCode); Console.WriteLine("StatusMessage: " + ur.StatusMessage); } }
public static void RetrieveAutomation(SoapClient soapClient, string iAutomationCustomerKey) { RetrieveRequest rr = new RetrieveRequest(); rr.ObjectType = "Automation"; SimpleFilterPart sf = new SimpleFilterPart(); sf.Property = "CustomerKey"; sf.SimpleOperator = SimpleOperators.equals; sf.Value = new String[] { iAutomationCustomerKey }; rr.Filter = sf; rr.Properties = new string[] { "ObjectID", "Name", "Description", "Schedule.ID", "CustomerKey", "IsActive", "CreatedDate", "ModifiedDate", "Status"}; string sStatus = ""; string sRequestId = ""; APIObject[] rResults; sStatus = soapClient.Retrieve(rr, out sRequestId, out rResults); Console.WriteLine("Status: " + sStatus); Console.WriteLine("RequestID: " + sRequestId); foreach (Automation automation in rResults) { Console.WriteLine("ObjectID: " + automation.ObjectID); Console.WriteLine("Name: " + automation.Name); Console.WriteLine("Description: " + automation.Description); if (automation.Schedule != null) { Console.WriteLine("Schedule.ID: " + automation.Schedule.ID); } Console.WriteLine("CustomerKey: " + automation.CustomerKey); Console.WriteLine("IsActive: " + automation.IsActive); Console.WriteLine("CreatedDate: " + automation.CreatedDate.ToString()); Console.WriteLine("ModifiedDate: " + automation.ModifiedDate); Console.WriteLine("Status: " + automation.Status); } }
public static void PerformAutomation(SoapClient soapClient, string iAutomationObjectID) { Automation automation = new Automation(); automation.ObjectID = iAutomationObjectID; string sStatus = ""; string sStatusMessage = ""; string sRequestId = ""; PerformResult[] pResults = soapClient.Perform(new PerformOptions(), "start", new APIObject[] { automation }, out sStatus, out sStatusMessage, out sRequestId); Console.WriteLine("Status: " + sStatus); Console.WriteLine("Status Message: " + sStatusMessage); Console.WriteLine("Request ID: " + sRequestId); foreach (PerformResult pr in pResults) { Console.WriteLine("StatusCode: " + pr.StatusCode); Console.WriteLine("ErrorCode: " + pr.ErrorCode); Console.WriteLine("StatusMessage: " + pr.StatusMessage); } }
public static void RetrieveSend(SoapClient soapClient, string JobID) { RetrieveRequest rr = new RetrieveRequest(); rr.ObjectType = "Send"; SimpleFilterPart sf = new SimpleFilterPart(); sf.Property = "ID"; sf.SimpleOperator = SimpleOperators.equals; sf.Value = new String[] { JobID }; rr.Filter = sf; rr.Properties = new string[] { "ID", "SendDate", "NumberSent", "NumberDelivered", "HardBounces", "SoftBounces", "OtherBounces", "Unsubscribes", "Status" }; string sStatus = ""; string sRequestId = ""; APIObject[] rResults; sStatus = soapClient.Retrieve(rr, out sRequestId, out rResults); Console.WriteLine("Status: " + sStatus); Console.WriteLine("RequestID: " + sRequestId); foreach (Send s in rResults) { Console.WriteLine("ID (JobID): " + s.ID); Console.WriteLine("SendDate: " + s.SendDate.ToString()); Console.WriteLine("NumberSent: " + s.NumberSent); Console.WriteLine("NumberDelivered: " + s.NumberDelivered); Console.WriteLine("SoftBounces: " + s.SoftBounces); Console.WriteLine("OtherBounces: " + s.OtherBounces); Console.WriteLine("Unsubscribes: " + s.Unsubscribes); Console.WriteLine("Status: " + s.Status); } }
public Conexion() { BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "CustomBinding"; binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; binding.ReceiveTimeout = new TimeSpan(0, 5, 0); binding.OpenTimeout = new TimeSpan(0, 5, 0); binding.CloseTimeout = new TimeSpan(0, 5, 0); binding.SendTimeout = new TimeSpan(0, 5, 0); binding.MaxReceivedMessageSize = 655360000; binding.MaxBufferPoolSize = 655360000; binding.MaxBufferSize = 655360000; // Set the transport security to UsernameOverTransport for Plaintext usernames EndpointAddress endpoint = new EndpointAddress("https://webservice.s6.exacttarget.com/Service.asmx"); // Create the SOAP Client (and pass in the endpoint and the binding) SoapClient etFramework = new SoapClient(binding, endpoint); ETCliente = etFramework; // Set the username and password ETCliente.ClientCredentials.UserName.UserName = "******"; ETCliente.ClientCredentials.UserName.Password = "******"; }
public TriggeredSendDefinitionClient(IExactTargetConfiguration config) { _config = config; _client = SoapClientFactory.Manufacture(config); _sharedCoreRequestClient = new SharedCoreRequestClient(config); }
public DeliveryProfileClient(IExactTargetConfiguration config) { _config = config; _client = SoapClientFactory.Manufacture(config); }
public DataExtensionClient(IExactTargetConfiguration config) { _config = config; _client = SoapClientFactory.Manufacture(config); _sharedCoreRequestClient = new SharedCoreRequestClient(config); }