Cannot access Newly created Codeunit in Web Service

Deepankar1982Deepankar1982 Member Posts: 38
edited 2011-05-02 in NAV Three Tier
I have created a function named "PostPayment" in a codeunit which accepting Gen. Journal Line as a parameter and after publishing it to the Web Service form with name "Gen_Journal_1", I can get the Service in the WSDL file but when i am going to access that service it's giving an error.

Error in xml format

- <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
- <s:Body>
- <s:Fault>
<faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Service.WebServices.ServiceBrokerException</faultcode>
<faultstring xml:lang="en-US">Parameter genJrnl of the type INavRecordHandle in method PostPayment in service Gen_Journal_1 is invalid!</faultstring>
- <detail>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Parameter genJrnl of the type INavRecordHandle in method PostPayment in service Gen_Journal_1 is invalid!</string>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

Please let me know where i am wrong.

With regards,
Deepankar

Comments

  • Ashish_GuptaAshish_Gupta Member Posts: 56
    Hi

    If u use Record type variable in parameters in code unit and want to use as web service then u get problem so, do not use record type variable in code parameter unit which u want in web service
    :thumbsup:


    Ashish Gupta
    SS Dynamics Solutions Pvt. Ltd.
    Ashish Gupta
    Navision Technical Consultant
  • Deepankar1982Deepankar1982 Member Posts: 38
    Thanks, for the reply but I am using it during Sales order posting. I have created a function in Codeunit there, I am passing Sales Header as a Parameter and it's working fine.
  • ara3nara3n Member Posts: 9,256
    Yes, it's working fine because you are using the CU as codeunit helper for a Page and when you publish it webservice, the name has to be the same.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Deepankar1982Deepankar1982 Member Posts: 38
    Yes, you are correct it's working fine the way you told me.
    Can you tell me, one more thing that if we want to return record set or array variables then what method shall we follow ?

    With regards,
    Deepankar
  • ara3nara3n Member Posts: 9,256
    I suggest to use xmlport as parameter.

    http://blogs.msdn.com/nav/archive/2009/ ... am+Blog%29
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ArmondsArmonds Member Posts: 66
    ara3n wrote:
    Yes, it's working fine because you are using the CU as codeunit helper for a Page and when you publish it webservice, the name has to be the same.

    What's interesting service name can't contain spaces, otherwise functions from CU will not be added to page methods
Sign In or Register to comment.