Elimde sms firmasından aldığım api var programa ekliyorum sms atıyor. ama benim istediğim mesaj metni ve cep telefon numarasını textboxdan çekmek bir türlü yapamadım yardımcı olabilirmisiniz <MessageText>Mesaj metni</MessageText> <IsCheckBlackList>0</IsCheckBlackList> <ReceiverList> <Receiver>905303626490</Receiver> <Receiver>905051234567</Receiver> </ReceiverList> public static void CallWebService() { var _url = "https://webservice.asistiletisim.com.tr/SmsProxy.asmx"; var _action = "https://webservice.asistiletisim.com.tr/SmsProxy/sendSms"; XmlDocument soapEnvelopeXml = new XmlDocument(); soapEnvelopeXml.LoadXml(@"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns=""https://webservice.asistiletisim.com.tr/SmsProxy""> <soapenv:Header/> <soapenv:Body> <sendSms> <requestXml><![CDATA[<SendSms> <Username>xxxx</Username> <Password>xxxxx</Password> <UserCode>xxxxx</UserCode> <AccountId>xxxxxx</AccountId> <Originator>xxxxxx</Originator> <ValidityPeriod>60</ValidityPeriod> <SendDate/> <MessageText>This is one to many sending example..</MessageText> <IsCheckBlackList>0</IsCheckBlackList> <ReceiverList> <Receiver>905303626490</Receiver> <Receiver>905051234567</Receiver> </ReceiverList> </SendSms>]]></requestXml> </sendSms> </soapenv:Body> </soapenv:Envelope>"); HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(_url); webRequest.Headers.Add("SOAPAction", _action); webRequest.ContentType = "text/xml;charset=\"utf-8\""; webRequest.Accept = "text/xml"; webRequest.Method = "POST"; using (Stream stream = webRequest.GetRequestStream()) { soapEnvelopeXml.Save(stream); } IAsyncResult asyncResult = webRequest.BeginGetResponse(null, null); asyncResult.AsyncWaitHandle.WaitOne(); string soapResult; using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult)) { using (StreamReader rd = new StreamReader(webResponse.GetResponseStream())) { soapResult = rd.ReadToEnd(); } Console.Write(soapResult); } } |
Bildirim