<x:Envelope xmlns:x="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="urn:microsoft-dynamics-schemas/codeunit/wstestmip"> <x:Header/> <x:Body> <wst:SetAndGet> <wst:_InParam>1234</wst:_InParam> <wst:_OutParam/> </wst:SetAndGet> </x:Body> </x:Envelope>
<definitions targetNamespace="urn:microsoft-dynamics-schemas/codeunit/wstestmip" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/wstestmip"> <types> <schema elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/wstestmip" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="SetAndGet"> <complexType> <sequence> <element minOccurs="1" maxOccurs="1" name="_InParam" type="string" /> <element minOccurs="1" maxOccurs="1" name="_OutParam" type="string" /> </sequence> </complexType> </element> <element name="SetAndGet_Result"> <complexType> <sequence> <element minOccurs="1" maxOccurs="1" name="_OutParam" type="string" /> </sequence> </complexType> </element> </schema> </types> <message name="SetAndGet"> <part name="parameters" element="tns:SetAndGet" /> </message> <message name="SetAndGet_Result"> <part name="parameters" element="tns:SetAndGet_Result" /> </message> <portType name="wstestmip_Port"> <operation name="SetAndGet"> <input name="SetAndGet" message="tns:SetAndGet" /> <output name="SetAndGet_Result" message="tns:SetAndGet_Result" /> </operation> </portType> <binding name="wstestmip_Binding" type="tns:wstestmip_Port"> <binding transport="http://schemas.xmlsoap.org/soap/http" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" /> <operation name="SetAndGet"> <operation soapAction="urn:microsoft-dynamics-schemas/codeunit/wstestmip:SetAndGet" style="document" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" /> <input name="SetAndGet"> <body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" /> </input> <output name="SetAndGet_Result"> <body use="literal" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" /> </output> </operation> </binding> <service name="wstestmip"> <port name="wstestmip_Port" binding="tns:wstestmip_Binding"> <address location="http://client15:7047/DynamicsNAV90/WS/CRONUS%20AG/Codeunit/wstestmip" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" /> </port> </service> </definitions>
Answers
Could you show us some code how you use Codeunit 1290, please.
I'm facing the same problem. I've used the WebService example form NAV2016 (Letters) which simply transforms a string to uppercase.
Here's my code where I'm using codeunit 1290. In CU1290 I had to Change the TextConstant ContentTypeTxt from "multipart/form-data; charset=utf-8" to "application/xml; charset=utf-8". Otherwise the call failed immedialtely.
<Begin of Code>
baseURL := 'http://localhost:7047/DynamicsNAV/WS/';
systemServiceURL := baseURL + 'CRONUS%20AG/Codeunit/Letters';
BodyTempBlob.Blob.CREATEINSTREAM(BodyContentInputStream);
BodyContentXmlDoc := BodyContentXmlDoc.XmlDocument;
XMLDOMMgt.AddRootElementWithPrefix(BodyContentXmlDoc,'Capitalize','',NamespaceTxt,EnvelopeXmlNode);
XMLDOMMgt.AddElement(EnvelopeXmlNode,'inputstring','abcde',NamespaceTxt,CreatedXmlNode);
BodyTempBlob.Blob.CREATEOUTSTREAM(BodyContentOutputStream);
BodyContentXmlDoc.Save(BodyContentOutputStream);
BodyTempBlob.Blob.CREATEINSTREAM(IStream);
c1290.SetGlobals(IStream,systemServiceURL,'','');
c1290.SetTraceMode(TRUE);
c1290.DisableHttpsCheck;
c1290.SetTimeout(600000);
IF c1290.SendRequestToWebService THEN BEGIN
c1290.GetResponseContent(ResponseInStream);
BodyTempBlob.Blob.CREATEOUTSTREAM(ResponseOutStream);
COPYSTREAM(ResponseOutStream,ResponseInStream);
END ELSE
c1290.ProcessFaultResponse('');
UnicodeEncoding := UnicodeEncoding.UnicodeEncoding(FALSE, FALSE);
BodyTempBlob.Blob.CREATEINSTREAM(InS);
StreamReader := StreamReader.StreamReader(InS, UnicodeEncoding);
MESSAGE(StreamReader.ReadToEnd);
<End of Code>
Solution is, to add SOAPAction to BuildWebRequest f-n.
For example:
HttpWebRequest.Headers.Add( 'SOAPAction', 'urn:microsoft-dynamics-schemas/codeunit/GetAmounts');
At the end I added new global variable GlobalSOAPAction to CU1290.
https://moxie4nav.wordpress.com/2015/09/10/call-external-web-service-using-new-cu-1290/
https://moxie4nav.wordpress.com/2016/07/03/call-external-web-service-using-cu-1290-part-2/
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
will be part 3 of that blog post series. ;-)
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/