Custom Web Service Responses

TimAdams75TimAdams75 Member Posts: 6
Hi,

I have been designing a web service based integration for one my customers where NAV will broker a relationship between their web site and 3PL, but I have hit a slight stumbling block.

The message that the website passes me has a lot of nodes and I would like to be selective with the nodes I return back i.e. Order No. and Status.

My question is, if I use a VAR XMLPort as a parameter of the codeunit all of the nodes are returned to the caller. If I set the XMLport to import only and remove the VAR element of the parameter I only get a basic message!

Is there a way of specifying which nodes are returned in the response message?

Thanks In Advance

Comments

  • SeeSharpSeeSharp Member Posts: 19
    Hi Tim,

    I suppose one way of doing it could be to have two XML ports, once which is import only and a second which is by reference.

    Within the codeunit which exposes the web method it might look something like:
    SomeMethod(InboundXML : XMLport "Inbound Orders";VAR ProcessedOrders : XMLport "Orders Returned")
    

    Within that do whatever you need to do with the data from the inbound call and finally pass back the 'streamlined' XML port.
    ProcessedOrdersRec.SETRANGE("Date Processed", TODAY); // or whatever
    ProcessedOrders.SETTABLEVIEW(ProcessedOrdersRec);
    

    Not the cleanest way, admittedly, but it might solve the issue?
  • TimAdams75TimAdams75 Member Posts: 6
    Hi SeeSharp,

    how would that be rendered to the consuming web service? i.e. would the VAR be treated as the synchronous response?
  • TimAdams75TimAdams75 Member Posts: 6
    Well the good news is that that solution does work! The bad news is the the request page leaves alot to be desired :smiley:
  • SeeSharpSeeSharp Member Posts: 19
    Glad to hear, but yes, it's far from clean to work with. Not sure I know of a better / more efficient way though.

    I suppose you could always develop your own solution which acts as a MITM between your service tier and whoever's doing the consumption? Additional overhead, but a little cleaner to the outside world.
  • kinekine Member Posts: 12,562
    You can try to use BigText as a parameter. In this way, if I am correct, you can process and return what you want...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.