Real Software Forums
http://forums.realsoftware.com/

SOAP call of a webservice
http://forums.realsoftware.com/viewtopic.php?f=13&t=42271
Page 1 of 1

Author:  Leffe69 [ Tue Jan 17, 2012 7:17 am ]
Post subject:  SOAP call of a webservice

Hello,

i haver to translate a SOAP call of an webservice from .NET to RB.

Here is the source in .NET:

string url = "http://macnas11:7047/DiVA602/WS/DiVA%20Versandhandel%20601/Page/Contact”;

StringBuilder soap = new StringBuilder();
soap.Append ("<?xml version='1.0' encoding='utf-8'?>");
soap.Append("<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>");
soap.Append("<soap:Body>");
soap.Append("<Read xmlns='urn:microsoft-dynamics-schemas/page/contact'>");
soap.Append("<No>100128</No>");

soap.Append("</Read>");
soap.Append("</soap:Body>");
soap.Append("</soap:Envelope>");

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
XmlDocument soapEnvelopeXml = new XmlDocument();

webRequest.Headers.Add("SOAP Action", "urn:microsoft-dynamics-schemas/page/contact:Read");
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
webRequest.UseDefaultCredentials = false;
webRequest.Credentials = mNetworkCredential;

soapEnvelopeXml.LoadXml(soap.ToString());
using (Stream stream = webRequest.GetRequestStream())
{
soapEnvelopeXml.Save(stream);

}

using (WebResponse response = webRequest.GetResponse())
{
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
string result = rd.ReadToEnd();
}
}

Thanks for your help!

Leffe

Author:  MonkeybreadSoftware [ Tue Jan 17, 2012 12:08 pm ]
Post subject:  Re: SOAP call of a webservice

Simply use HTTPSocket with it's options.


Greetings
Christian

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/