Web Service receives Blank values when sent through SOAP

shettarvikasshettarvikas 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
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); 

Comments

  • shettarvikasshettarvikas Member Posts: 106
    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,
    Vikas
  • strusarjstrusarj Member Posts: 1
    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&quot; ';
    xml := xml + 'xmlns:xsd="http://www.w3.org/2001/XMLSchema&quot; ';
    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 Strusa
    Regards,
    Bob Strusa
Sign In or Register to comment.