Webservice, Use XMLPort og Not?

Johannes_NielsenJohannes_Nielsen Member Posts: 206
edited 2013-04-24 in NAV Three Tier
Hi all

I'm doing a WebService for returning item prices based on a query of items.

The WebService must conform to a WSDL that has been already been defined.
http://biblstandard.dk/acq/serviceman/pricequery.wsdl

This gives me a dilemma, because NAV generates the WSDL automatically.

I can expose a CodeUnit Function and set a XMLPort as VAR Parameter, this gives me a WSDL that has the right Request structure, but not exactly like the standard.

The reply structure is real problem - you can only specify simple types like Text as an return value - not an XML structure as return value of a function.

For your amusement and to clarify, here's examples of the XML Request and Reply

Request:
<PriceQuery>
	- <Customer>
		  <CustomerIDType>AB-123</CustomerIDType> 
	 	 <CustomerID>ABCD</CustomerID> 
	</Customer>
	- <Material>
		  <MatIDType>IDx</MatIDType> 
		  <MatID>1234567899</MatID> 
	  </Material>
	- <Material>
		  <MatIDType>IDx</MatIDType> 
		  <MatID>1234567899</MatID> 
	  </Material>
</PriceQuery>

Response:
- <PriceQueryResponse>
	- <MaterialPrice>
		- <Material>
			  <MatIDType>IDx</MatIDType> 
			  <MatID>1234567899</MatID> 
		  </Material>
		- <Price>
			  <PriceType>LockedPrice</PriceType> 
			  <Amount>111</Amount> 
			  <Currency>DKK</Currency> 
			  <ValidToDate>01012013</ValidToDate> 
		  </Price>
	  </MaterialPrice>
  </PriceQueryResponse>

Now, should I give up on using XML ports and ignore the WSDL? (and use BigText as parameter for the Webservice CodeUnit function)
And what should I use as a reply value?

Any pointers to what direction to go in, would be appreciated.
Best regards / Venlig hilsen
Johannes Sebastian
MB7-840,MB7-841

Answers

  • zyrosevenzyroseven Member Posts: 20
    I am having the same problem, still don't know how to deal with the response. in my situation xmlport is not even possible because the reponse xml structure has to change according to the request #-o
  • kinekine Member Posts: 12,562
    AS response you can use VAR parameter of type XMLPort. Of course, if you kow the structure in advance. If not, you can use BigText parameters for imput and for output.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Johannes_NielsenJohannes_Nielsen Member Posts: 206
    Thank you kine

    The output has a different XML root element, than input.
    And and XMLport/XMLdocument can only have one Root.

    So Bigtext Input/Output it is...

    -
    Except I still have the problem of the WSDL not being as the client wants so, I might end up using some ASP.net Proxy, to do that. :roll:
    Best regards / Venlig hilsen
    Johannes Sebastian
    MB7-840,MB7-841
  • kinekine Member Posts: 12,562
    In most cases the wsdl is created by the server developer, and not "dictated" by the consuming client. The client must fullfill the contract, which is described with the WSDL. Of course, it could be in oposite, if there is "universal" client consuming only webservices with predefined interface. Than you need to use some proxy (e.g. like when you want to use event subscription in Team Foundation Server 2010, where you cannot create correct WS from within NAV)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mdPartnerNLmdPartnerNL Member Posts: 802
    kine wrote:
    ... Than you need to use some proxy (e.g. like when you want to use event subscription in Team Foundation Server 2010, where you cannot create correct WS from within NAV)
    Interesting remark.. Could you elaborate a bit more or give an example how they solved this?
  • Benno67Benno67 Member Posts: 39
    Hi All,

    We did run into the same problem, and more, like namespaces, webservices that require different input-output structures (2 xml port var's). And every time we solved a problem a new problem popped up.
    Finaly we decided on buiding a WEBService Broker, that solved all the problems, authentication an logging also, and is capable in handling all kind of xslt translations.

    The solution is not for free, because the project was build for us by ASP.NET specialists, and we need to get back some money for it.

    If anyone is interested, please send a mail.

    Benno
Sign In or Register to comment.