[ 
https://issues.apache.org/jira/browse/AXIS2-3296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537004
 ] 

Vincent Brabant commented on AXIS2-3296:
----------------------------------------

Here is a proposal to fix the issue.

Problem is caused by a bug in the MessageContextBuilder

By replacing the following code (snapshot of 17/10/2007)

        if (faultCode != null) {
            fault.setCode((SOAPFaultCode) faultCode);
        } else if (soapException != null) {
            soapFaultCode = soapException.getFaultCode();
        } else if (axisFault != null) {
            if (axisFault.getFaultCodeElement() != null) {
                fault.setCode(axisFault.getFaultCodeElement());
            } else {
                QName faultCodeQName = axisFault.getFaultCode();
                if (faultCodeQName != null) {
                    if (faultCodeQName.getLocalPart().indexOf(":") == -1) {
                        String prefix = faultCodeQName.getPrefix();
                        String uri = faultCodeQName.getNamespaceURI();
                        // Get the specified prefix and uri
                        prefix = prefix == null ? "" : prefix;
                        uri = uri == null || "" .equals(uri) ?
                                fault.getNamespace().getNamespaceURI() : uri;
                        // Make sure the prefix and uri are declared on the 
fault, and 
                        // get the resulting prefix.
                        prefix = fault.declareNamespace(uri, 
prefix).getPrefix();
                        soapFaultCode = prefix + ":" + 
faultCodeQName.getLocalPart();
                    } else {
                        soapFaultCode = faultCodeQName.getLocalPart();
                    }
                }
            }
        }

by this one

        if (faultCode != null) {
            fault.setCode((SOAPFaultCode) faultCode);
        } else if (soapException != null) {
            soapFaultCode = soapException.getFaultCode();
        } else if (axisFault != null) {
            if (axisFault.getFaultCodeElement() != null) {
                fault.setCode(axisFault.getFaultCodeElement());
                soapFaultCode = faultCodeElement.getText();  // The line I added
            } else {
                QName faultCodeQName = axisFault.getFaultCode();
                if (faultCodeQName != null) {
                    if (faultCodeQName.getLocalPart().indexOf(":") == -1) {
                        String prefix = faultCodeQName.getPrefix();
                        String uri = faultCodeQName.getNamespaceURI();
                        // Get the specified prefix and uri
                        prefix = prefix == null ? "" : prefix;
                        uri = uri == null || "" .equals(uri) ?
                                fault.getNamespace().getNamespaceURI() : uri;
                        // Make sure the prefix and uri are declared on the 
fault, and 
                        // get the resulting prefix.
                        prefix = fault.declareNamespace(uri, 
prefix).getPrefix();
                        soapFaultCode = prefix + ":" + 
faultCodeQName.getLocalPart();
                    } else {
                        soapFaultCode = faultCodeQName.getLocalPart();
                    }
                }
            }
        }

the problem is then solved. The response will contains a soapFault having the 
same error code than the one filled in the SoapFault given to the AxisFault.

Hope it helps a lot.

P.S. I also noted that the private method getSenderFaultCode(OMNamespace) of 
that MessageContextBuilder class is not used. Would be a good idea to remove it

> When I am creating a AxisFault by giving a SoapFault, the SoapFaultCode is 
> ignored.
> -----------------------------------------------------------------------------------
>
>                 Key: AXIS2-3296
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3296
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.3, nightly
>         Environment: Windows XP / JDK 1.4 (but also Sun Machine with 
> WebSphere 5.1 and JDK 1.4)
>            Reporter: Vincent Brabant
>
> I have a SoapFault where the SoapFaultCode is soapenv:Client.
> I am throwing an AxisFault by giving the SoapFault as argument
>           throw new AxisFaul(soapFault)
> But it return always a soapenv:Receiver (SOAP1.2) or a soapenv:Server 
> (SOAP1.1).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to