You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marco Pas <ma...@gmail.com> on 2012/04/24 16:00:27 UTC

Soap Fault (SOAP 1.2) losing subcodes?

Hi there,

I am trying to throw a SOAP Fault using subcodes, but whatever i do i
seem to be loosing the subcodes.

I am using the follow code to construct my soap fault:

SOAPFactory sf = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);

SOAPFault f = sf.createFault("Reason", SOAPConstants.SOAP_RECEIVER_FAULT);

QName qname = new QName("http://example.com", "myfault1", "flt1");
f.appendFaultSubcode(qname);
QName qname2 = new QName("http://example2.com", "myfault2", "flt2");
f.appendFaultSubcode(qname2);
QName qname3 = new QName("http://example3.com", "myfault3", "flt3");
f.appendFaultSubcode(qname3);

throw new SOAPFaultException(f);

Whatever i do the result is always a soap fault without!! the subcodes..

   <soap:Body>
      <soap:Fault>
         <soap:Code>
            <soap:Value>soap:Receiver</soap:Value>
         </soap:Code>
         <soap:Reason>
            <soap:Text xml:lang="en">Reason</soap:Text>
         </soap:Reason>
      </soap:Fault>
   </soap:Body>

Any suggestion on how tackle this?

Re: Soap Fault (SOAP 1.2) losing subcodes?

Posted by Daniel Kulp <dk...@apache.org>.
Can you file a JIRA and attach a testcase? 

There definitely is an issue internally in CXF.   The CXF internal SoapFault 
class only contains a single subcode QName.   Thus, a list of subcodes like 
this cannot be represented.   However, I would have expected ONE of the 
subcodes to at least be returned.  Your fault isn't showing any though. 

In either case, there definitely is a bug.   A test case would be great.  
Patch even better.   :-)

Dan


On Tuesday, April 24, 2012 04:00:27 PM Marco Pas wrote:
> Hi there,
> 
> I am trying to throw a SOAP Fault using subcodes, but whatever i do i
> seem to be loosing the subcodes.
> 
> I am using the follow code to construct my soap fault:
> 
> SOAPFactory sf = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
> 
> SOAPFault f = sf.createFault("Reason", SOAPConstants.SOAP_RECEIVER_FAULT);
> 
> QName qname = new QName("http://example.com", "myfault1", "flt1");
> f.appendFaultSubcode(qname);
> QName qname2 = new QName("http://example2.com", "myfault2", "flt2");
> f.appendFaultSubcode(qname2);
> QName qname3 = new QName("http://example3.com", "myfault3", "flt3");
> f.appendFaultSubcode(qname3);
> 
> throw new SOAPFaultException(f);
> 
> Whatever i do the result is always a soap fault without!! the subcodes..
> 
>    <soap:Body>
>       <soap:Fault>
>          <soap:Code>
>             <soap:Value>soap:Receiver</soap:Value>
>          </soap:Code>
>          <soap:Reason>
>             <soap:Text xml:lang="en">Reason</soap:Text>
>          </soap:Reason>
>       </soap:Fault>
>    </soap:Body>
> 
> Any suggestion on how tackle this?
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com