The expected data was not received from the web service
OBJECT Codeunit 99998 WS Test 4 { OBJECT-PROPERTIES { Date=21-12-16; Time=[ 1:18:40 AM]; Modified=Yes; Version List=NAVW110.0; } PROPERTIES { OnRun=BEGIN //VATRegistrationLog := Rec; ExecWebService(TRUE); //Rec := VATRegistrationLog; END; } CODE { VAR NamespaceTxt@1003 : TextConst 'ENU=urn:microsoft-dynamics-schemas/codeunit/WS_Exposed_CU'; VATRegistrationLog@1000 : Record 249; VATRegistrationLogMgt@1002 : Codeunit 249; LOCAL PROCEDURE ExecWebService@7(ShowErrors@1000 : Boolean); VAR RequestBodyTempBlob@1002 : Record 99008535; BEGIN RequestBodyTempBlob.INIT; SendRequestToVatRegistrationService(RequestBodyTempBlob,ShowErrors); MessageXMLOutput(RequestBodyTempBlob); //COMMIT; END; LOCAL PROCEDURE SendRequestToVatRegistrationService@1(VAR BodyTempBlob@1004 : Record 99008535;ShowErrors@1003 : Boolean); VAR GeneralLedgerSetup@1005 : Record 98; SOAPWebServiceRequestMgt@1001 : Codeunit 1290; ResponseInStream@1002 : InStream; InStream@1006 : InStream; ResponseOutStream@1008 : OutStream; BEGIN PrepareSOAPRequestBody(BodyTempBlob); BodyTempBlob.Blob.CREATEINSTREAM(InStream); GeneralLedgerSetup.GET; //IF GeneralLedgerSetup."VAT Reg. No. Validation URL" = '' THEN // ERROR(MissingWebServiceURLErr); SOAPWebServiceRequestMgt.SetGlobals( InStream, 'http://aws01:7047/DynamicsNAV100/WS/CRONUS%20International%20Ltd./Codeunit/WS_Exposed_CU','',''); SOAPWebServiceRequestMgt.DisableHttpsCheck; SOAPWebServiceRequestMgt.SetTimeout(60000); IF SOAPWebServiceRequestMgt.SendRequestToWebService THEN BEGIN SOAPWebServiceRequestMgt.GetResponseContent(ResponseInStream); BodyTempBlob.Blob.CREATEOUTSTREAM(ResponseOutStream); COPYSTREAM(ResponseOutStream,ResponseInStream); END ELSE IF ShowErrors THEN SOAPWebServiceRequestMgt.ProcessFaultResponse(''); END; LOCAL PROCEDURE PrepareSOAPRequestBody@12(VAR BodyTempBlob@1000 : Record 99008535); VAR XMLDOMMgt@1006 : Codeunit 6224; BodyContentInputStream@1004 : InStream; BodyContentOutputStream@1005 : OutStream; BodyContentXmlDoc@1003 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlDocument"; EnvelopeXmlNode@1012 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlNode"; CreatedXmlNode@1001 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlNode"; BEGIN BodyTempBlob.Blob.CREATEINSTREAM(BodyContentInputStream); BodyContentXmlDoc := BodyContentXmlDoc.XmlDocument; //XMLDOMMgt.AddRootElementWithPrefix(BodyContentXmlDoc,'checkVat','',NamespaceTxt,EnvelopeXmlNode); XMLDOMMgt.AddRootElementWithPrefix(BodyContentXmlDoc,'ReturnCaps','',NamespaceTxt,EnvelopeXmlNode); XMLDOMMgt.AddElement(EnvelopeXmlNode,'inStr','this should be in caps',NamespaceTxt,CreatedXmlNode); //XMLDOMMgt.AddElement(EnvelopeXmlNode,'vatNumber',VATRegistrationLog.GetVATRegNo,NamespaceTxt,CreatedXmlNode); CLEAR(BodyTempBlob.Blob); BodyTempBlob.Blob.CREATEOUTSTREAM(BodyContentOutputStream); BodyContentXmlDoc.Save(BodyContentOutputStream); //>> to debug output xml MESSAGE(FORMAT(BodyContentXmlDoc.InnerXml)); //<< to debug output xml END; LOCAL PROCEDURE MessageXMLOutput@4(ResponseBodyTempBlob@1000 : Record 99008535); VAR XMLDOMManagement@1001 : Codeunit 6224; XMLDocOut@1012 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlDocument"; InStream@1009 : InStream; BEGIN ResponseBodyTempBlob.Blob.CREATEINSTREAM(InStream); XMLDOMManagement.LoadXMLDocumentFromInStream(InStream,XMLDocOut); MESSAGE(FORMAT(XMLDocOut.InnerXml)); //VATRegistrationLogMgt.LogVerification(VATRegistrationLog,XMLDocOut,NamespaceTxt); END; BEGIN END. } }
Answers
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/