Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Processing Instructions are not allowed in SOAP documents

843833Oct 19 2005 — edited Oct 19 2005
Hi, there. I am trying to integrate WS-Security into our server using the api-sample in JWSDP 1.6 as it is the one that fits into our current architecture in place.

I have the following code:

DOMSource domSource = new DOMSource( indoc );
SOAPPart soapPart = msg.getSOAPPart();
soapPart.setContent( domSource );

ProcessingContext context = new ProcessingContext();
context.setSOAPMessage( msg );

where indoc is an org.w3c.dom.Document object.

The last line throws an exception that is ultimately caused by:

java.lang.UnsupportedOperationException: Processing Instructions are not allowed in SOAP documents
at com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.createProcessingInstruction(SOAPDocumentImpl.java:109)

(Please find the complete (partially edited) stack trace at the end of this message.)

The exception is thrown even when the following very simple (unsigned) SOAP message is submitted:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><requestMessage xmlns="urn:schemas-company-com:transaction-data-1.17"><merchantID>ever03</merchantID><ccAuthService run="true"/></requestMessage></soap:Body></soap:Envelope>

As you can see, the only processing instruction is the XML processing instruction, which I don't believe is disallowed in SOAP documents, right? So, I'm not sure why it's complaining about processing instructions. I'm guessing during the transformation into whatever form ProcessingContext wants the document to be in, certain processing instructions are erroneously being inserted.

I would appreciate any inputs. Below is the stack trace, partially edited to show only the relevant lines.

Thanks,
Ever

com.sun.xml.wss.XWSSecurityException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.wss.SecurableSoapMessage.getEnvelope(SecurableSoapMessage.java:109)
at com.sun.xml.wss.SecurableSoapMessage.init(SecurableSoapMessage.java:89)
at com.sun.xml.wss.SecurableSoapMessage.setSOAPMessage(SecurableSoapMessage.java:400)
at com.sun.xml.wss.ProcessingContext.setSOAPMessage(ProcessingContext.java:199)

Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:111)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:39)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:98)
at com.sun.xml.wss.SecurableSoapMessage.getEnvelope(SecurableSoapMessage.java:107)
... 32 more

Caused by: javax.xml.transform.TransformerException: java.lang.UnsupportedOperationException: Processing Instructions are not allowed in SOAP documents
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:647)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:279)
at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:97)
... 35 more

Caused by: java.lang.UnsupportedOperationException: Processing Instructions are not allowed in SOAP documents
at com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.createProcessingInstruction(SOAPDocumentImpl.java:109)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.createProcessingInstruction(SOAPPartImpl.java:368)
at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.processingInstruction(SAX2DOM.java:177)
at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.processingInstruction(ToXMLSAXHandler.java:583)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:224)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:121)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:85)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:592)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:638)
... 37 more
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 16 2005
Added on Oct 19 2005
2 comments
1,773 views