Web Service receives NUll value in parameter.

svikas1svikas1 Member Posts: 25
edited 2011-10-25 in NAV Three Tier
Hi,

I am trying to consume a webservice which takes parameter, while passing parameter to the webservice via SOAP the input parameter value always passes as NULL.
Getting the Error : "Parameter inputString in method Capitalize1 in service Capitalize is null!"

Regards
Vikas Sharma

Comments

  • kinekine Member Posts: 12,562
    Can you be more specific how you are crating the soap? Are you using SOAP Toolkit? Can you give us more details???
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • svikas1svikas1 Member Posts: 25
    Hi,

    i am using SOAP toolkit 3.0 and my code is as follows:

    CREATE(locautSoapHttpConnector);
    locautSoapHttpConnector.Property('EndPointURL', 'http://localhost:7047/DynamicsNav/ws/CRONUS_Retail_India_Ltd/Codeunit/Capitalize');
    locautSoapHttpConnector.Connect;
    locautSoapHttpConnector.Property('SoapAction','urn:microsoft-dynamics-schemas/codeunit/Capitalize');
    locautSoapHttpConnector.BeginMessage;

    CREATE(locautSoapSerializer);
    locautSoapSerializer.Init(locautSoapHttpConnector.InputStream);
    locautSoapSerializer.startEnvelope('SOAP','STANDARD');
    //tempvar := 'helloworld';
    locautSoapSerializer.startBody('STANDARD');
    locautSoapSerializer.startElement('Capitalize1');
    locautSoapSerializer.startElement('InputString');
    locautSoapSerializer.writeString('45');
    locautSoapSerializer.endElement;
    locautSoapSerializer.endElement;

    locautSoapSerializer.endBody;
    locautSoapSerializer.endEnvelope;
    locautSoapHttpConnector.EndMessage;

    CREATE(locautXmlDoc);
    locautXmlDoc.load(locautSoapHttpConnector.OutputStream);
    locautXmlDoc.save('c:\temp2.xml');

    The web service is Capitalize and it has function Capitalize1 which take integer as a parameter.


    Thanks & Regards
    Vikas
  • kinekine Member Posts: 12,562
    Try this (commnts in code):
    CREATE(locautSoapHttpConnector);
    locautSoapHttpConnector.Property('EndPointURL', 'http://localhost:7047/DynamicsNav/ws/CRONUS_Retail_India_Ltd/Codeunit/Capitalize'); //<-This is path to the WSDL of the WS?
    locautSoapHttpConnector.Connect;
    locautSoapHttpConnector.Property('SoapAction','urn:microsoft-dynamics-schemas/codeunit/Capitalize1'); //<-Name of the called function
    locautSoapHttpConnector.BeginMessage;
    
    CREATE(locautSoapSerializer);
    locautSoapSerializer.Init(locautSoapHttpConnector.InputStream);
    locautSoapSerializer.startEnvelope('SOAP','STANDARD');  //I am using this, but without parameters
    //tempvar := 'helloworld';
    locautSoapSerializer.startBody('STANDARD');
    locautSoapSerializer.startElement('Capitalize1'); //I am using this, but with second parameter- WS namespace
    locautSoapSerializer.startElement('InputString');
    locautSoapSerializer.writeString('45');
    locautSoapSerializer.endElement;
    locautSoapSerializer.endElement;
    
    locautSoapSerializer.endBody;
    locautSoapSerializer.endEnvelope;
    locautSoapHttpConnector.EndMessage;
    
    CREATE(locautXmlDoc);
    locautXmlDoc.load(locautSoapHttpConnector.OutputStream);
    locautXmlDoc.save('c:\temp2.xml');
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • svikas1svikas1 Member Posts: 25
    Hi,

    I tried with the modification you send but the error remains the same.

    Thanks & Regards
    Vikas Sharma
  • freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    I don't know too much about the SOAP toolkit - could you dump the SOAP string you are sending together with the function in your codeunit (just the header)

    I did notice in your errormessage inputString was written with lower case i and in your SOAP above it is written with Capital I - I do think that they are case sensitive.
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • svikas1svikas1 Member Posts: 25
    Its working now. The reason was case sensitive.
    Thanx Freddy and Kamil.


    Regards
    Vikas
  • Pedro_IñiguezPedro_Iñiguez Member Posts: 7
    Hi,

    I have the same problem with my web service published in Dynamics. I'm trying to access to method "CreateOrder" with parameter "parVendor". But i have always the same error:

    Parameter parVendor in method CreateOrder in service CreateDocuments is null!

    I don't idea of what is the problem with my code. I hav e try to call another simple method like HelloWorld and i didn't have any problem.

    My code:

    CREATE(locautSoapHttpConnector);

    locautSoapHttpConnector.Property('EndPointURL',
    'http://localhost:7047/DynamicsNAV/WS/[MyCompany]/Codeunit/CreateDocuments');
    l
    ocautSoapHttpConnector.Connect;
    locautSoapHttpConnector.Property('Timeout', 5 * 1000);

    locautSoapHttpConnector.Property('SoapAction',
    'urn:microsoft-dynamics-schemas/Codeunit/CrearDocumentos/CreateOrder');

    locautSoapHttpConnector.BeginMessage;

    CREATE(locautSoapSerializer);
    locautSoapSerializer.Init(locautSoapHttpConnector.InputStream);
    locautSoapSerializer.startEnvelope('SOAP','STANDARD');
    locautSoapSerializer.startBody;
    locautSoapSerializer.startElement('CreateOrder');
    locautSoapSerializer.startElement('parVendor');
    locautSoapSerializer.writeString('Vend001'); //Any text
    locautSoapSerializer.endElement;
    locautSoapSerializer.endElement;
    locautSoapSerializer.endBody;

    locautSoapSerializer.endEnvelope;
    locautSoapHttpConnector.EndMessage;


    CREATE(locautXmlDoc);
    locautXmlDoc.load(locautSoapHttpConnector.OutputStream);
    locautXmlDoc.save('c:\temp1.xml'); //Here i save the result and is where i have the error i've said

    Can somebody help me with that.

    Thanks. ](*,)
  • Pedro_IñiguezPedro_Iñiguez Member Posts: 7
    I'm trying to connect to connect from one Nav2009SP1 instance "A" to another Nav20009SP1 instance "B". I don't know if this will show you more clearly what I want to do.
  • Erik_HeirbautErik_Heirbaut Member Posts: 16
    I also had a Webservice that gave a parameter NULL error, while the parameter (In our case a User ID) was certainly not NULL.

    At the customers site, the WebService servicetier was installed after and separated from the RTC Servicetier with another name.
    And believe it or not, but our solution to get rid of the NULL error was to remove both servicetiers and create them again, in one Service- subdirectory and, most important, with 1 instance name!
Sign In or Register to comment.