Receive List of Records of MyTable through SOAP webservice.

zohaibu95@hotmail.comzohaibu95@hotmail.com Member Posts: 223
edited 2017-01-23 in NAV Three Tier
Hi guys,
I am developing a SOAP webservice, in which i want to update the items in bulk. For this, i have create a table which will have the records of all the items which have to be updated.
Now the challenge which i m facing is, the input of the webservice will be the List of items e.g. if i created a table MyItems then on the input of this method i will have the List<MyItems> .
So how can i receive it in my method as a parameter? how can i treat it as list because in NAV we cannot make dynamics array.

Suggestions will be appreciated. Thanks
Best Regards
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.

please like / agree / verify my answer, if it was helpful for you. thanks.

Best Answer

Answers

  • zaidtariqzaidtariq Member Posts: 52
    I guss you can do it like
    ListFunction(myList : DotNet "System.Collections.Generic.List`1")
    Best Regards:
    Zaid Tariq
    Dynamics NAV/365 BC Developer at Dynamics 360

    please like / agree / verify my answer, if was helpful.
  • RockWithNAVRockWithNAV Member Posts: 1,139
    Why not using XMLPORT as a webservice parameter in which you will have list of all the Items.
  • zohaibu95@hotmail.comzohaibu95@hotmail.com Member Posts: 223
    Why not using XMLPORT as a webservice parameter in which you will have list of all the Items.

    How to do that? do you have any tutorial for this? how to send parameter to the webservice?
    Best Regards
    Zohaib Ahmed
    Dynamics NAV ERP Technical Consultant.

    please like / agree / verify my answer, if it was helpful for you. thanks.
  • zohaibu95@hotmail.comzohaibu95@hotmail.com Member Posts: 223
    Just you need to play with the Instreams OR Outstreams, either you want to send xmlport as a Parameter from NAV or to get in NAV.

    The below example is getting an XML as parameter from WebService.

    First you need to make the XMLPORT in NAV, make sure the schema would be exactly the same as you will get in parameter. IN the Parameter add Bigtext and get your xmlport as a parameter in it.

    Now write this code.

    TempBlob.INIT;
    TempBlob.Blob.CREATEOUTSTREAM(OutStream);
    Bigtest.WRITE(OutStream);//This Bigtext is the Parameter which consists of XML
    TempBlob.INSERT;
    TempBlob.CALCFIELDS(Blob);
    TempBlob.Blob.CREATEINSTREAM(InStream);
    XMLPORT.IMPORT(XMLPORT::Your Created XMLPORT,InStream);

    so when i call the webservice in .NET then can i pass the c# List or i need to first translate the c# list into xml string and send then xml string to this webservice?
    Best Regards
    Zohaib Ahmed
    Dynamics NAV ERP Technical Consultant.

    please like / agree / verify my answer, if it was helpful for you. thanks.
  • RockWithNAVRockWithNAV Member Posts: 1,139
    You should translate in XML String.
Sign In or Register to comment.