You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Aki Yoshida (JIRA)" <ji...@apache.org> on 2012/10/25 00:44:12 UTC

[jira] [Comment Edited] (CXF-4600) Exception inheritance not working over SOAP protocol

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

Aki Yoshida edited comment on CXF-4600 at 10/24/12 10:43 PM:
-------------------------------------------------------------

i think you can transfer the values if you remove the XmlTransient annotation and add the corresponding property setters so that those properties are visible from both classes.

with this change, your serialized faults will look like:
<soap:Fault>
  <faultcode>soap:Server</faultcode>
  <faultstring>exception message</faultstring>
  <detail>
    <ns1:CustomException xmlns:ns1="http://issue.cxf/">
      <message xmlns:ns2="http://issue.cxf/">exception message</message>
      <description xmlns:ns2="http://issue.cxf/">exception description</description>
      <code xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://issue.cxf/" xsi:type="xs:int">500</code>
    </ns1:CustomException>
  </detail>
</soap:Fault>

<soap:Fault>
  <faultcode>soap:Server</faultcode>
  <faultstring>exception message</faultstring>
  <detail>
    <ns1:AbstractException xmlns:ns1="http://issue.cxf/">
      <message xmlns:ns2="http://issue.cxf/">exception message</message>
      <description xmlns:ns2="http://issue.cxf/">exception description</description>
      <code xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://issue.cxf/" xsi:type="xs:int">500</code>
    </ns1:AbstractException>
  </detail>
</soap:Fault>

and the properties can be transferred to the client.

does this solve your problem?

regards, aki
                
      was (Author: ay):
    i think you can transfer the values if you annotate the exception class.
e.g.
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "message",
    "description",
    "code"
})
@XmlRootElement(name = "faultDetail")
public class AbstractException extends Exception {
...

with your original non-annotated class, your serialized fault looks like this:
<soap:Fault>
  <faultcode>soap:Server</faultcode>
  <faultstring>exception message</faultstring>
  <detail>
    <ns1:AbstractException xmlns:ns1="http://issue.cxf/"/>
  </detail>
</soap:Fault>

so there are no attribute values transferred.

with the above annotated exception, your serialized fault looks like this:

<soap:Fault>
  <faultcode>soap:Server</faultcode>
  <faultstring>exception message</faultstring>
  <detail>
    <ns1:AbstractException xmlns:ns1="http://issue.cxf/">
      <message xmlns:ns2="http://issue.cxf/">exception message</message>
      <description xmlns:ns2="http://issue.cxf/">exception description</description>
      <code xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://issue.cxf/" xsi:type="xs:int">500</code>
    </ns1:AbstractException>
  </detail>
</soap:Fault>

and the attribute values are transferred to the client.

does this solve your problem?

regards, aki
                  
> Exception inheritance not working over SOAP protocol
> ----------------------------------------------------
>
>                 Key: CXF-4600
>                 URL: https://issues.apache.org/jira/browse/CXF-4600
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.4.10, 2.5.6, 2.6.3, 2.7.0
>            Reporter: Richard Opalka
>             Fix For: 2.4.11, 2.5.7, 2.6.4, 2.7.1
>
>         Attachments: CXF-4600-reproducer.zip
>
>
> If method parameter or return type are subject to object inheritance,
> passing such complex classes works without any problems over SOAP.
> But when exception is subject to object inheritance, the inheritance
> is unfunctional over SOAP protocol.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira