[ 
https://issues.apache.org/jira/browse/CXF-6908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15403635#comment-15403635
 ] 

Colm O hEigeartaigh commented on CXF-6908:
------------------------------------------

CXF 2.7.x is no longer maintained, there will be no more releases.

Colm.

> Prefix "SOAP-ENV" for element "SOAP-ENV:Fault" is not bound
> -----------------------------------------------------------
>
>                 Key: CXF-6908
>                 URL: https://issues.apache.org/jira/browse/CXF-6908
>             Project: CXF
>          Issue Type: Bug
>          Components: Soap Binding
>            Reporter: Alessio Soldano
>            Assignee: Daniel Kulp
>             Fix For: 3.1.7, 3.2.0
>
>
> I have an endpoint as follows:
> {noformat}
> @WebServiceProvider(wsdlLocation = "WEB-INF/FaultService.wsdl", 
> targetNamespace = "http://signencrypt.foo.github.com/";)
> @ServiceMode(Mode.MESSAGE)
> @BindingType(SOAPBinding.SOAP11HTTP_BINDING)
> public class FaultService implements Provider<SOAPMessage>
> {
>    @Resource
>    private WebServiceContext _wsContext;
>    @Override
>    public SOAPMessage invoke(SOAPMessage request)
>    {
>       try
>       {
>          MessageFactory messageFactory = MessageFactory.newInstance();
>          SOAPMessage msg = messageFactory.createMessage();
>          msg.getSOAPBody().addFault(new 
> QName("http://schemas.xmlsoap.org/soap/envelope/";, "Server"),
>                "Reason: cos I'm hungry");
>          return msg;
>       }
>       catch (Exception e)
>       {
>          e.printStackTrace();
>       }
>       return null;
>    }
> }
> {noformat}
> The client fails in processing the ws-security soap message that's returned 
> by the endpoint above:
> {noformat}
> ...
> Caused by: org.apache.xml.security.encryption.XMLEncryptionException: The 
> prefix "SOAP-ENV" for element "SOAP-ENV:Fault" is not bound.
>       [java] Original Exception was org.xml.sax.SAXParseException; 
> lineNumber: 1; columnNumber: 212; The prefix "SOAP-ENV" for element 
> "SOAP-ENV:Fault" is not bound.
>       [java]     at 
> org.apache.xml.security.encryption.DocumentSerializer.deserialize(DocumentSerializer.java:93)
>       [java]     at 
> org.apache.xml.security.encryption.DocumentSerializer.deserialize(DocumentSerializer.java:49)
>       [java]     at 
> org.apache.xml.security.encryption.XMLCipher.decryptElement(XMLCipher.java:1685)
>       [java]     at 
> org.apache.xml.security.encryption.XMLCipher.decryptElementContent(XMLCipher.java:1716)
>       [java]     at 
> org.apache.xml.security.encryption.XMLCipher.doFinal(XMLCipher.java:990)
>       [java]     at 
> org.apache.ws.security.processor.ReferenceListProcessor.decryptEncryptedData(ReferenceListProcessor.java:340)
>       [java]     ... 27 more
>       [java] Caused by: org.xml.sax.SAXParseException; lineNumber: 1; 
> columnNumber: 212; The prefix "SOAP-ENV" for element "SOAP-ENV:Fault" is not 
> bound.
>       [java]     at 
> org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:244) 
> {noformat}
> It seems that when the soap fault in the endpoint is created with no explicit 
> ns prefix for the envelope, the code in 
> SoapOutInterceptor::writeSoapEnvelopeStart modifies the namespace prefixes 
> and basically turns a message like
> {noformat}
> <SOAP-ENV:Envelope 
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";><SOAP-ENV:Header/><SOAP-ENV:Body/></SOAP-ENV:Envelope>
> {noformat}
> into
> {noformat}
> <soap:Envelope 
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><SOAP-ENV:Header 
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/><soap:Body/></soap:Envelope>
> {noformat}
> (SOAP-ENV is the saaj impl default value for missing explicit soap envelope 
> prefix)
> This is probably causing a problem with the fault later added in the body 
> because of the ns prefix SOAP-ENV not being bound anymore in the envelope.
> The problem is avoided by explicitly setting the fault prefix in the endpoint:
> {noformat}
> msg.getSOAPPart().getEnvelope().setPrefix("fooe");
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to