Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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: 23647
49
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!