This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

soap change prefix for response  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 23509
47
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
stefano tud
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using a workaround:
is full while is empty, then I can get tags I need using and then traversal NodeList
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
 
Get me the mayor's office! I need to tell him about this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!