aspose file tools*
The moose likes Web Services and the fly likes Issue with namespaces while consuming a service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Issue with namespaces while consuming a service" Watch "Issue with namespaces while consuming a service" New topic
Author

Issue with namespaces while consuming a service

Ravikanth Reddy Bapathi
Greenhorn

Joined: Apr 13, 2007
Posts: 29
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

Joined: Feb 19, 2010
Posts: 215
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Issue with namespaces while consuming a service