Web Service receives Blank values when sent through SOAP

shettarvikas
Member Posts: 106
hi,
Below is my code in navision, when i run the code, the web service receives blank values. How to rectify??
PLease suggest.
Thanks & Regards,
Vikas
Note: fromNavision is a webmethod and it returns string.
SOAP Code
Below is my code in navision, when i run the code, the web service receives blank values. How to rectify??
PLease suggest.
Thanks & Regards,
Vikas
Note: fromNavision is a webmethod and it returns string.
SOAP Code
IF ISCLEAR(Connector) THEN CREATE(Connector); //Connector.Property('ProxyServer','isaserver'); //Connector.Property('ProxyPassword','proxypass'); //Connector.Property('ProxyUser','username'); Connector.Property('EndPointURL','http://localhost:1484/MCC-Webservice/Service.asmx?WSDL'); Connector.Connect; Connector.Property('SoapAction','http://tempuri.org/fromNavision'); Connector.BeginMessage; CREATE(Serializer); Serializer.Init(Connector.InputStream); Serializer.StartEnvelope('','STANDARD','utf-8'); Serializer.StartBody('STANDARD'); Serializer.StartElement('BillingService','uri:fromNavision'); Serializer.WriteString('Testing'); Serializer.EndElement; Serializer.EndBody; Serializer.EndEnvelope; Connector.EndMessage; IF ISCLEAR(XMLDOM) THEN CREATE(XMLDOM); XMLDOM.load(Connector.OutputStream); IF NOT ISCLEAR(XMLNode) THEN MESSAGE(XMLNode.text); XMLDOM.save('c:\vat.xml'); CLEAR(XMLDOM); CLEAR(Connector);
0
Comments
-
my web method is,
[WebMethod] public string fromNavision(string messageString) { string testData = "Test"; logger.Debug("Obtained Request: " + messageString); return testData; }
in above code, messageString is coming as null. and I am using SOAP Toolkit v3.0 in Navision.
Please suggest
Regards,
Vikas0 -
I had the same problem and it appears to be related to the namespaces. I had to manually add them to a text string and use an http post. Here is what I ended up using:
PROCEDURE getRegistration@1000000001(regID@1000000000 : Text[30]);
VAR
xmlHttpReq@1000000001 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 5.0:{F5078F35-C551-11D3-89B9-0000F81FE221}:'Microsoft XML, v5.0'.XMLHTTP30";
xml@1000000002 : Text[1024];
locautXmlDoc@1000000003 : Automation "{F5078F18-C551-11D3-89B9-0000F81FE221} 5.0:{F6D90F11-9C73-11D3-B32E-00C04F990BB4}:'Microsoft XML, v5.0'.DOMDocument";
BEGIN
CREATE(xmlHttpReq);
xml := '<?xml version="1.0" encoding="UTF-8" standalone="no"?>';
xml := xml + '<soap:Envelope ';
xml := xml + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
xml := xml + 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ';
xml := xml + 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
xml := xml + '<soap:Body>';
xml := xml + '<getRegistration xmlns="http://tempuri.org/">';
xml := xml + '<regID>' + regID + '</regID>';
xml := xml + '</getRegistration>';
xml := xml + '</soap:Body>';
xml := xml + '</soap:Envelope>';
xmlHttpReq.open('POST','http://localhost/test/pjmLRPws.asmx',FALSE);
xmlHttpReq.setRequestHeader('Host','localhost');
xmlHttpReq.setRequestHeader('Content-Type','text/xml; charset=utf-8');
xmlHttpReq.setRequestHeader('Content-Length',FORMAT(STRLEN(xml)));
xmlHttpReq.setRequestHeader('SOAPAction','"http://tempuri.org/getRegistration"');
xmlHttpReq.send(xml);
CREATE(locautXmlDoc);
locautXmlDoc.load(xmlHttpReq.responseStream);
locautXmlDoc.save('c:\tempHTTP.xml');
END;
-- Bob StrusaRegards,
Bob Strusa0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions