Cannot access to a function in a webService

AitorEGAitorEG Member Posts: 342
edited 2022-03-16 in NAV Three Tier
Hi all,

i am trying to consume a function in a web service published in BC. In postman, I get this error:


In the WSDL, I can see tthat the function is published:


This is how the function looks like:


Must add that in this codeunit, I already have fucntions that are consumed without any problem. I'm afraid that the problem might be the comples type sent by parameter....


  • ftorneroftornero Member Posts: 522
    Hello @AitorEG,

    Something doesn't add up because looks like you are calling a OData v4 WS and this function is returning an XML, and in the other hand I don't think is possible to publish a codeunit like a OData WS.

    How do you call the others functions in this codeunit that you consumed whitout any problem ?

  • AitorEGAitorEG Member Posts: 342
    Hello @ftornero,

    This is a call to a function in the same codeunit in BC:



    The codeunit is published as SOAP, but as far as I know, this is the way to call to webService in BC no?

    Anyway, i'm afraid that the main problem is the XMLPort parameter. If I quit it, I don't get the "resource not found" error.

    Must say that the aim of this function, and that XMLPort, is to be the datasource of a datagrid in a C# webApp.
  • AitorEGAitorEG Member Posts: 342
    I've changed the function to return a text instead of an XML parameter, and I get this:


    But now I have to use this text as datasource for the grid, so i assume I must convert it into XML


    When I', trying the conversion, I get this classic error


    Of course, seems that I must delete "@odata....." information
  • ftorneroftornero Member Posts: 522
    Hello @AitorEG,

    Yes, you get in return a json object with 2 properties ("@odata.context" and "value") and you need to get the "value" part that it's the XML.

  • AitorEGAitorEG Member Posts: 342
    Thank you @ftornero . ANd once I got the XML value, I should convert it into the type need by the datagrid, am I right?
  • ftorneroftornero Member Posts: 522
    Hello @AitorEG,

    That it's what you are trying to do with the C# code, I guess that the datagrid will work with the XML, I really don't know.

Sign In or Register to comment.