Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

remove namespace from webservice response

 
Rajendar Chintala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Recently we moved to Z/Linux with WAS6.1 from Z/OS with WAS5.1.

one of my webservice clients are reporting there application is breaking because of its adding namspces infront of tags like below.
there are using raw xml formats for request and response not like beans.

how can i get rid of name spaces infront of tags from webservice response or how can I set a standard name space.

is it some with with was6.1 or Z/Linux?

Please help me with good solution.

Thanks in Advance.

-Raj





<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<p624:createOverageShortageResponse xmlns:p624="http://v1_0.returns.services.view.jdpoint.parts.deere.com">
<p624:createOverageShortageReturn>
<p181:setCaseId xmlns:p181="http://beans.v1_0.returns.services.view.jdpoint.parts.deere.com">0100S00679</p181:setCaseId>
<p181:statusCode xmlns:p181="http://beans.v1_0.returns.services.view.jdpoint.parts.deere.com">0000</p181:statusCode>
<p181:statusMessage xmlns:p181="http://beans.v1_0.returns.services.view.jdpoint.parts.deere.com">Creation Successful.</p181:statusMessage>
</p624:createOverageShortageReturn>
</p624:createOverageShortageResponse>
</soapenv:Body>
</soapenv:Envelope>
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want prefixes on the names of elements which are in a namespace, then you would have to make that namespace the default namespace. That would involve declaring the namespace in the root element like this:



Or you could declare this namespace as the default namespace in each element where it applies, rather like the example you posted did.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajendar Chintala wrote:how can i get rid of namespaces in front of tags from webservice response or how can I set a standard name space.

Unfortunately you rarely have that level of control on the XML that is generated by your SOAP stack. Chances are that in terms of XML the old and the new versions are equivalent. I'm not aware of any SOAP stack that lets you control the namespace prefixes and/or default namespace.

one of my webservice clients are reporting their application is breaking because of its adding namespaces infront of tags like below.

It is adding prefixes - the "namespaces" always have been part of the of the element names.

Appearently your client is hoping for:

and is simply scraping for the element's local names while ignoring the element namespaces.

For example: in terms of XML "setCaseId" is actually {http://beans.v1_0.returns.services.view.jdpoint.parts.deere.com}setCaseId.
<setCaseId xmlns="http://beans.v1_0.returns.services.view.jdpoint.parts.deere.com">0100S00679</setCaseId>
is identical to
<p181:setCaseId xmlns:p181="http://beans.v1_0.returns.services.view.jdpoint.parts.deere.com">0100S00679</p181:setCaseId>
or
<tns:setCaseId xmlns:tns="http://beans.v1_0.returns.services.view.jdpoint.parts.deere.com">0100S00679</tns:setCaseId>
etc.
Ronald Bourret's XML Namespaces FAQ
James Clark: XML Namespaces

This strongly suggests that the client's "web service client program" is not sufficiently "namespace" aware. It needs to be updated to deal with arbitrary namespace prefixes.
 
Yu Limin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can implement handleResponse(MessageContext messageContext) method in the Web Services Handler, then remove the namespace and set the new Message without namespace to MessageContext

public class RemoveNameSpaceHandler extends GenericHandler
{
public boolean handleResponse(MessageContext messageContext)
{
//....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic