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:

3p2lm1q16svb.png

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

gjxgi0j7k08t.png

This is how the function looks like:

0akboc2m6nxb.png

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....

Answers

  • ftorneroftornero Member Posts: 524
    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 ?

    Regards.
  • AitorEGAitorEG Member Posts: 342
    Hello @ftornero,

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

    ohy5d13sh7y8.png

    5kli3bjwn2qq.png


    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:

    4g8qyjanmfxl.png


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

    h7le4ljd9l20.png


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

    ptgghadf5km2.png


    Of course, seems that I must delete "@odata....." information
  • ftorneroftornero Member Posts: 524
    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.

    Regards.
  • 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: 524
    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.

    Regards.
Sign In or Register to comment.