You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by Dobri Kitipov <kd...@googlemail.com> on 2009/01/13 16:41:51 UTC

Rampart and SOAP 1.2 Fault

Hi everybody,
I have done a test with asymmetric binding where the service jks was missing
from the AAR used. As a result an Exception is throw that in turn is send
back to client as a SOAP  Fault. The problem is that  <soapenv:Code> has the
following value:

                <soapenv:Value>axis2ns2:Sender</soapenv:Value>

IMHO it should have "axis2ns2:Receiver" as Value (refer to
http://www.w3.org/TR/soap12-part1/#faultcodes). Currently the Value is
hardcoded into RampartReceiver method:

    private void setFaultCodeAndThrowAxisFault(MessageContext msgContext,
Exception e) throws AxisFault {

        msgContext.setProperty(RampartConstants.SEC_FAULT, Boolean.TRUE);

        String soapVersionURI =
msgContext.getEnvelope().getNamespace().getNamespaceURI();
        QName invalidSecurity = new
QName(WSConstants.INVALID_SECURITY.getNamespaceURI(),WSConstants.INVALID_SECURITY.getLocalPart(),"wsse");

        if
(soapVersionURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) ) {

            throw new AxisFault(invalidSecurity,e.getMessage(),e);

        } else if
(soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
{
            List subfaultCodes = new ArrayList();
            subfaultCodes.add(invalidSecurity);
            throw new
AxisFault(Constants.FAULT_SOAP12_SENDER,subfaultCodes,e.getMessage(),e);

        }
    }

The line of code we are interested in is the last one : throw new
AxisFault(Constants.FAULT_SOAP12_SENDER,subfaultCodes,e.getMessage(),e);
where the Constants.FAULT_SOAP12_SENDER is hardcoded into the thrown
AxisFault.
I think that a flag should be set into the RampartException/MessageCtx so it
is possible to check if the problem was Sender or Receiver.

What do you think?

Regards,
Dobri