[
https://issues.apache.org/jira/browse/AXIS2-2752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502032
]
Davanum Srinivas commented on AXIS2-2752:
-----------------------------------------
Glen,
Please take a look at this
thanks,
dims
> Creating a AxisFault using the SOAPFactory does not include the FaultReason
> in the SOAP fault response
> ------------------------------------------------------------------------------------------------------
>
> Key: AXIS2-2752
> URL: https://issues.apache.org/jira/browse/AXIS2-2752
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: kernel
> Affects Versions: 1.2
> Reporter: Wolfgang Moestl
> Assignee: Glen Daniels
> Priority: Minor
>
> First creating a AxisFault using the SOAPFactory and throw it
> SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
> SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();
> SOAPFaultValue soapFaultValue =
> soapFactory.createSOAPFaultValue(soapFaultCode);
> soapFaultValue.setText(new
> QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, "Sender"));
> SOAPFaultReason soapFaultReason =
> soapFactory.createSOAPFaultReason();
> SOAPFaultText soapFaultText =
> soapFactory.createSOAPFaultText(soapFaultReason);
> soapFaultText.setText("ReasonValue");
>
> SOAPFaultDetail soapFaultDetail =
> soapFactory.createSOAPFaultDetail();
> QName qName = new QName("http://mycompany.com",
> "FaultException", "ex");
> OMElement exception = soapFactory.createOMElement(qName,
> soapFaultDetail);
> exception.setText("Detail text");
>
> throw new AxisFault(soapFaultCode, soapFaultReason, null, null,
> soapFaultDetail);
> The resulting SOAP envelope will look like:
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing"
> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
> <soapenv:Header>
> <wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
> <wsa:RelatesTo>urn:uuid:EAC15BF38C43D5DD571180618021415</wsa:RelatesTo>
> </soapenv:Header>
> <soapenv:Body>
> <soapenv:Fault>
> <soapenv:Code>
> <soapenv:Value>soapenv:Sender</soapenv:Value>
> </soapenv:Code>
> <soapenv:Reason>
> <soapenv:Text xml:lang="en-US">unknown</soapenv:Text>
> </soapenv:Reason>
> <soapenv:Detail>
> <ex:FaultException xmlns:ex="http://mycompany.com">Detail
> text</ex:FaultException>
> </soapenv:Detail>
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
> Please note that the Code and Detail are present as expected, but the Reason
> has been substituted with the default reason "unknown".
> Fix: If you put the soapFaultReason into the MessageContext before you throw
> the AxisFault, the reason appears in the SOAP Fault:
> // ... SAME CODE AS ABOVE FROM THE BEGINNING TO THE THROW
> COMMAND HERE
> MessageContext inMessageContext =
> MessageContext.getCurrentMessageContext();
>
> inMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME,
> soapFaultCode);
>
> inMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME,
> soapFaultReason);
>
> inMessageContext.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,
> soapFaultDetail);
> throw new AxisFault(soapFaultCode, soapFaultReason, null, null,
> soapFaultDetail);
> Putting the reason into the MessageContext should not be necessary IMHO.
> Either all 3 items (code, reason, detail) have to be put into the
> MessageContext or none of them.
--
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]