• Post Reply Bookmark Topic Watch Topic
  • New Topic

Missing namespaces in JAX-WS request  RSS feed

 
Andrew Dambrosio
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a JAX-WS client based on a 3rd party WSDL.
The request should look like the following:



However, my actual request is looking like this:

As you can see, the AuthHeader is missing some namespaces and the "h:" prefix, and the s:body element is missing all namespaces.
What do I need to do to get my request XML to match what I should be sending?
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally I would say your version of the document is preferable, because it doesn't have unused and duplicated namespace declarations. And in fact both versions are exactly equivalent as far as namespaces are concerned. For example the AuthHeader element is in the "http://localhost/DAPC/" namespace in both documents. (Your document puts it in the default namespace and the original puts it in a prefixed namespace, but they are the same namespace.)

So, is your desire to make your document look like the original simply based on the fact that the two documents look different, or do they behave differently in practice? They shouldn't behave differently as far as I can see.

Edit:

Wait a minute, the original document has <Data xsi:type="PVData"> and yours only has <Data>. Does that make a difference in processing? If the WSDL doesn't require that attribute, and it appears it doesn't, then the attribute should be irrelevant. I think.
 
Andrew Dambrosio
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, the WSDL is a 3rd party and I have no control over it. My version (bottom) must match the top, otherwise the request is rejected.
And yes, my <Data> should have <Data xsi:type="PVData">

 
g tsuji
Ranch Hand
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to tell the forum what technologies and/or frameworks/toolkits are involved in building the soap envelope and in particular some details in the building of the body. Expected result and the actual result help but the need info, to put everything into practical context, is how you come up with or build that actual result where the dynamic typing is missing but needed.
 
Andrew Dambrosio
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To give a bit more information, I generated the java classes using wsdl2java using java 1.6 (this is what our website is using).
Below is a cut down version of the client that i've created:

 
g tsuji
Ranch Hand
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you build the request from your domain (java) object graph through xml binding, this is what you should look a bit more into the code generated by wsdl2java or whatever.

[1] In your collection of the source files, you should have something like this (apart from possible customization).

[2] Then in your set up of request, this particular request, you want to pass a price data (and other occasion, you may want to pass an sku data ...). The Request class may look like this.

[3] When request object is set up, in the case you want to pass PVData to Data this time, you might have this.

[4] When you conduct the marshalling, you obviously set up your JAXBContext including all your object class necessary to the task...

By consequence of all these, the xsi:type="PVData" will be taken care of by the marshaller.

This is the big picture. Details you have to take care of on top of that.

edit: I see now that the forum has its own idea of formatting against members ...
 
Andrew Dambrosio
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I should be using this marshaller then? I've never used that before. Is that what creates the SOAP request?
 
g tsuji
Ranch Hand
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I should be using this marshaller then? I've never used that before. Is that what creates the SOAP request?

I am a bit surprised by the question - I do not expect that at all. I have seen you're using JAXB (JAXBElement class, say) and marshaller/unmarshaller is central to jaxb; and your code looks like vested with some sophistication (of some soa/esb general setting) not possibly be written by somebody without some sophisticated skill. If I recall, I had said some details on how request is set up would help the forum and your return were just a comment line of /* ... */ without substantive info (this is not a complaint, just an observation, and plenty members can help too). In any case, the answer is : of course not, whatever xml binding tool you use should behave reasonably similarly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!