You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2008/02/15 20:44:10 UTC

[jira] Resolved: (CXF-1417) SOAPFaultException built programmatically and thrown in a JAX-WS handler are not correctly populated

     [ https://issues.apache.org/jira/browse/CXF-1417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-1417.
------------------------------

    Resolution: Fixed

> SOAPFaultException built programmatically and thrown in a JAX-WS handler are not correctly populated
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1417
>                 URL: https://issues.apache.org/jira/browse/CXF-1417
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1, 2.0.5
>         Environment: whatever
>            Reporter: Davide Gesino
>            Assignee: Daniel Kulp
>             Fix For: 2.1, 2.0.5
>
>
> Create a SOAPFaultException filled with a SOAPFault and throw it from a JAX-WS Hander.
> On the other side some content of the SOAPFaultException is missing.
> Here is a code that can be tried: create a SOAPHandler with the following handleMessage().
> public boolean handleMessage(SOAPMessageContext ctx) {
>                 Boolean outboundProperty = (Boolean) ctx
>                                 .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
>                 if (!outboundProperty) {
>                         SOAPMessage msg = ctx.getMessage();
>                         SOAPBody body;
>                         try {
>                                 body = msg.getSOAPBody();
>                                 SOAPFault fault = body.addFault();
>                                 QName faultName = new QName(SOAPConstants.URI_NS_SOAP_ENVELOPE,
>                                                 "Server");
>                                 fault.setFaultCode(faultName);
>                                 fault.setFaultActor("http://gizmos.com/orders");
>                                 fault.setFaultString("Server not responding");
>                                 Detail detail = fault.addDetail();
>                                 QName entryName = new QName("http://gizmos.com/orders/",
>                                                 "order", "PO");
>                                 DetailEntry entry = detail.addDetailEntry(entryName);
>                                 entry.addTextNode("Quantity element does not have a value");
>                                 QName entryName2 = new QName("http://gizmos.com/orders/",
>                                                 "order", "PO");
>                                 DetailEntry entry2 = detail.addDetailEntry(entryName2);
>                                 entry2.addTextNode("Incomplete address: no zip code");
>                                 throw new SOAPFaultException(fault);
>                         } catch (SOAPException e) {
>                                 // TODO Auto-generated catch block
>                                 e.printStackTrace();
>                         }
>                 }
>                 return true;
>         } 
> This is what I would expect:
> <soapenv:Fault>
>       <faultcode>soapenv:Server</faultcode>
>       <faultstring>Server not responding</faultstring>
>       <faultactor>http://gizmos.com/orders</faultactor>
>       <detail>
>         <PO:order xmlns:PO="http://gizmos.com/orders/">Quantity element does not have a value</PO:order>
>         <PO:order xmlns:PO="http://gizmos.com/orders/">Incomplete address: no zip code</PO:order>
>       </detail>
>   </soapenv:Fault>
> And this is what I get:
>  <soap:Fault>
>       <faultcode>soap:Server</faultcode>
>       <faultstring>Server not responding</faultstring>
> </soap:Fault>

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