Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ability to parse SOAP1.1 or SOAP 1.2 messages #21

Open
Tomas-Kraus opened this issue Mar 22, 2007 · 5 comments
Open

Provide ability to parse SOAP1.1 or SOAP 1.2 messages #21

Tomas-Kraus opened this issue Mar 22, 2007 · 5 comments

Comments

@Tomas-Kraus
Copy link
Member

Email discussion of the issue :

I would like to be able to parse both SOAP 1.1 and 1.2. So if I use
DYNAMIC_SOAP_PROTOCOL I must use createMessage(MIMEHeaders, InputStream).
But I don't have MIMEHeaders or an InputStream, I only have the string,
pXml.

So is the only way to do this to get the uri of the namespace associated
with the Envelope and put an 'if'? IOW:

if (uri.equals('http://www.w3.org/2003/05/soap-envelope/')
factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
else factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);

This seems kind of kludgy. What happens when SOAP 1.3 comes out? I would
think that the existence of a DYNAMIC_SOAP_PROTOCOL constant would indicate
that it recognizes the document ... you know, dynamically?

Anything other than this kludgy 'if' that I can do?

Thanks,
Bob

V B Kumar Jayanti wrote:

If you need a message Factory that should work for both SOAP 1.1 and 1.2
envelopes then you need to do the following :

MessageFactory factory =
MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL);

But NOTE that factory.createMessage() would then throw
UnsupporteOperationException.

User Code :

This is my code:

StringReader sr = new StringReader(pXml);
StreamSource ss = new StreamSource(sr);
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage soapMessage = mf.createMessage();
SOAPPart soapPart = soapMessage.getSOAPPart();
soapPart.setContent(ss);
SOAPEnvelope env = soapPart.getEnvelope();

pXml is a String containing the uploaded SOAP document, whose Envelope
section has the SOAP 1.2 uri (http://www.w3.org/2003/05/soap-envelope/).
When I use the SOAP 1.1 uri (http://schemas.xmlsoap.org/soap/envelope/) it
works fine. It also used to work fine on Java 1.5.

Environment

Operating System: Windows XP
Platform: All

Affected Versions

[current]

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
Reported by @vbkumarjayanti

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
Was assigned to saaj-issues

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
@vbkumarjayanti said:
MessageFactory factory =
MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL);

followed by

factory.createMessage(null, InputStream) could be handled in such a way that the
content-type is detected from the inputstream. It may require InputStream to
support mark and reset (not sure about this at the moment, need to investigate
more into the RI).

@Tomas-Kraus
Copy link
Member Author

@glassfishrobot Commented
This issue was imported from java.net JIRA SAAJ-21

@Tomas-Kraus
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants