Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting namespaces in SOAP request payload from a java client

 
Udayan Kumar
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All - I currently have to write a java client which consumes a RPC web service.

I did use the SOAPUI utility to verify the web service and I am able to see the response from the web service. But only when i pass the SOAP request and all the containing elements in the body contain namespace qualified attributes something like this

<com:testOperation>
<testInputObject xsi:type="ns1:com_example_app_model_TestInput" xmlns:ns1="http://com.example.app.facade/TestWebService1.xsd">
<scoreDto xsi:type="ns1:com_example_app_model_ScoreInput">
<requestType xsi:type="xsd:string">N</requestType>


If I don't provide the namespace attributes I run into "No Deserializer found error"

For the java web service client I am using generated stubs. How can I set the namespace attributes for each and every element I pass in the java equivalent of the SOAP request payload.

Do let me know your thoughts.

Thanks,
 
Udayan Kumar
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone respond.

The WSDL we have created in this scenario is a combinations of the WSDL's from two other web services. Is there a way where in we can provide an instruction to suppress the need for namespace in SOAP payloads or to automatically set the namespace attributes in the SOAP payloads.

When I use the underlying web service WSDL directly to generate the w/service client stubs and use the same from the java front end apps it seems to be generating the SOAP request payloads correctly.
 
aruna sydu
Ranch Hand
Posts: 98
MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Udayan Kumar wrote:Can someone respond.

The WSDL we have created in this scenario is a combinations of the WSDL's from two other web services. Is there a way where in we can provide an instruction to suppress the need for namespace in SOAP payloads or to automatically set the namespace attributes in the SOAP payloads.

When I use the underlying web service WSDL directly to generate the w/service client stubs and use the same from the java front end apps it seems to be generating the SOAP request payloads correctly.


Hi Uday,

As far as I understood the problem, the appending of namespaces to each element and attribute in the SOAPUI project is because of these two atttributes
attributeFormDefault="qualified" elementFormDefault="qualified" mentioned in your WSDL or XSD.
To make them unqualified try setting attributeFormDefault="unqualified" elementFormDefault="unqualified" in your schema definition.
Validate your WSDL,build the soapUI project and test again.

2.While calling the webservice provider from client using the Stub , The JAX-RPC or JAX-WS depending on the webservice stack you are using will take care of building the SOAP request for you with or without namspaces .


Aruna.




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic