URL[1] := '\\****************\************\ICT\JSS\EDI\Invoice200117.xml'; WebaddressToPostTo := 'http://IP:PORT/http?request=send';
Variables: XmlHttpHandler2 System.Net.Http.HttpClient.'System.Net.Http, Version=4.0.0.0 XmlHttpHandler System.Net.Http.HttpClientHandler.'System.Net.Http, Version=4.0.0.0 XmlHttpRequestMessage System.Net.Http.HttpRequestMessage.'System.Net.Http, Version=4.0.0.0 XmlHttpMethod DotNet System.Net.Http.HttpMethod.'System.Net.Http, Version=4.0.0.0 XmlHttpContent System.Net.Http.StringContent.'System.Net.Http, Version=4.0.0.0 XmlHttpRequestHeader System.Net.Http.Headers.HttpRequestHeaders.'System.Net.Http, Version=4.0.0.0 XmlHttpClient System.Net.Http.HttpClient.'System.Net.Http, Version=4.0.0.0 XmlHttpResponseMessage: System.Net.Http.HttpResponseMessage.'System.Net.Http, Version=4.0.0.0 CurrNode System.Xml.XmlNode.'System.Xml, Version=4.0.0.0 Code: XmlHttpHandler := XmlHttpHandler.HttpClientHandler(); XmlHttpMethod := XmlHttpMethod.HttpMethod('POST'); XmlHttpRequestMessage := XmlHttpRequestMessage.HttpRequestMessage(XmlHttpMethod,WebServiceURL); { Testing: XmlHttpClient.DefaultRequestHeaders := ('Content-Type','text/xml'); XmlHttpClient.DefaultRequestHeaders('SOAPAction','"http://tempuri.org/' + WebFunc + '"'); XmlHttpRequestMessage.Headers := XmlHttpClient.DefaultRequestHeaders; } XmlHttpContent := XmlHttpContent.StringContent(XmlDoc.ToString); XmlHttpRequestMessage.Content(XmlHttpContent); XmlHttpHandler2 := XmlHttpHandler2.HttpClient(XmlHttpHandler); XmlHttpHandler2.SendAsync(XmlHttpRequestMessage); CLEAR(XmlDoc); XmlDoc := XmlDoc.XmlDocument; XmlHttpResponseMessage := XmlHttpResponseMessage.HttpResponseMessage; XmlHttpResponseMessage.RequestMessage := XmlHttpRequestMessage.HttpRequestMessage(XmlHttpMethod,WebServiceURL); IF XmlHttpResponseMessage.StatusCode <> 200 THEN BEGIN ErrorNote := 'HTTP ' + FORMAT(XmlHttpResponseMessage.StatusCode) + ': ' + XmlHttpResponseMessage.ReasonPhrase; EXIT(FALSE); END; XmlHttpContent := XmlHttpResponseMessage.Content; XmlDoc.LoadXml(XmlHttpContent.ToString); NOTE: This line gives and error. How can I store the data from the Response back in this XMlDoc? CurrNode := XmlDoc.DocumentElement.SelectSingleNode('soap:Body/' + WebFunc + 'Response/' + WebFunc + 'Result'); IF NOT ISNULL(CurrNode) THEN ReturnMessage := CurrNode.InnerText; IF XmlHttpResponseMessage.IsSuccessStatusCode THEN EXIT(TRUE); ErrorNote := COPYSTR(ReturnMessage,1,MAXSTRLEN(ErrorNote)); EXIT(FALSE);
Answers
Variables are as under:
Code:
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
many thanks for the swift answer, unfortunately I'm forced to use dotnet.
MicheleGRS
Check out this link, if it seems helpful.
https://rockwithnav.wordpress.com/2016/02/23/consume-net-webservice-dotnet-data-type/
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.
you've been really very kind. I solved.
You are welcome
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.