Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with namespaces while consuming a service

 
Ravikanth Reddy Bapathi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have exposed a service
the wsdl has a namespace with impl.

the service implementation extracts the name space for the operation and executes a business logic based on name space.


i am trying to consume the web service by java client.

i am able to invoke the service but name space is missing in the request.
the current request is
<getSecurityParam xmlns="http://impl.endpoint.security.ws.com">

it has to be

<getSecurityParam xmlns:impl="http://impl.endpoint.security.ws.com">

i have generated client using eclipse.

any help is appreciated.


 
R Srini
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. To prefix the namespace, you could modify the generated client and call addNamespaceDeclaration: http://java.sun.com/javase/6/docs/api/javax/xml/soap/SOAPElement.html#addNamespaceDeclaration(java.lang.String, java.lang.String)

Please see an example here: http://www.devdaily.com/java/jwarehouse/axis2-1.3/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java.shtml
And let me know if that works
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic