This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Services and the fly likes soap change prefix for response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "soap change prefix for response" Watch "soap change prefix for response" New topic
Author

soap change prefix for response

stefano tud
Greenhorn

Joined: Dec 02, 2010
Posts: 3
Hello,

I need to consume a web service I cannot control
the problem is the ws needs a prefix like soapenv instead of default SOAP-ENV
I solved request creation using this code:

now the request is OK
but how can i change the prefix I read from SOAPEnvelop?
the response has soapenv instead of SOAP-ENV too

thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

stefano tud wrote:the problem is the ws needs a prefix like soapenv instead of default SOAP-ENV


Why is that the case? Normally the choice of prefix is irrelevant, it's the namespace URI which is important. If you have written an application which depends on a specific prefix instead of a specific namespace URI, there's a good chance you haven't written that application correctly.
stefano tud
Greenhorn

Joined: Dec 02, 2010
Posts: 3
As I wrote, I'm not controlling the ws, I need just to consume it and it wants a <soapenv> prefix for request and response.
don't ask me why...
the request was not working till I change prefix
and I cannot read response because functions look for <SOAP-ENV> prefix
In the response I removed namespace and added that ws required
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Stefano,
the request was not working till I change prefix

This makes sense, if I presume the service provider is using some XML parser to read your request SOAP message than standard Web Services API.
but how can i change the prefix I read from SOAPEnvelop?

I'm sure if you are getting response SOAP message, it'd be conformed to SOAP specification and so it is a valid SOAP message. If so, it can be read by your Web Services API irrespective of whatever prefix it uses.

Otherwise, if the response SOAP message is not a valid SOAP message then use any XML parser to read it.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
stefano tud
Greenhorn

Joined: Dec 02, 2010
Posts: 3
I'm using a workaround:
is full while is empty, then I can get tags I need using and then traversal NodeList
Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
@Naren Chivukula:
This makes sense, if I presume the service provider is using some XML parser to read your request SOAP message than standard Web Services API.

Otherwise, if the response SOAP message is not a valid SOAP message then use any XML parser to read it.


I am not sure I understand these comments.
SOAP is XML. So any XML parser can be used to parse SOAP messages. Standard Web Services API use regular XML parsers under the hood(DOM or StAX); so I am not sure what you are saying here
 
GeeCON Prague 2014
 
subject: soap change prefix for response