You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sengel <s....@tarent.de> on 2011/10/18 14:41:41 UTC

Missing "detail" element in SOAP fault

Hello,

we have a system consisting of (web and other) clients and our backend (SOAP
web services). Now when we throw a Fault/Exception in a backend operation,
the SOAP fault looks like this:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <env:Fault>
         <faultcode>env:Server</faultcode>
         <faultstring>An entity with the same ID already
exists</faultstring>
         <detail>
            <ns2:duplicateEntityFault
xmlns:ns2="http://www.example.com/example/">
               <reason>Entity was not created. An entity with the same ID
already exists</reason>
            </ns2:duplicateEntityFault>
         </detail>
      </env:Fault>
   </env:Body>
</env:Envelope>

The client side uses the subelement "duplicateEntityFault" of "detail" to
generate the Exception class which we expect and catch
(DuplicateEntityFault_Exception).

So now we added Camel to the setup which routes requests to the backend. We
expected that if a Fault/Exception is thrown on the backend, Camel would
just pass it back to the client. But, no. Instead the client gets this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>HTTP operation failed invoking
http://www.example.com/example/example-service with statusCode:
500</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

So the problem is that there is no "detail" element in the fault message
from which the client can generate the Exception. Camel logs this:
Exhausted after delivery attempt: 1 caught:
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://www.example.com/example/example-service with
statusCode: 500

Could you please tell us what is missing or what we do wrong?
Thanks in advance,

Sebastian

--
View this message in context: http://camel.465427.n5.nabble.com/Missing-detail-element-in-SOAP-fault-tp4913512p4913512.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Missing "detail" element in SOAP fault

Posted by Daniel Kulp <dk...@apache.org>.
 
I guess the questions would be:

1) What version of Camel?

2) What does the route look like?   Is it using camel-cxf or similar?


Dan


On Tuesday, October 18, 2011 5:41:41 AM sengel wrote:
> Hello,
> 
> we have a system consisting of (web and other) clients and our backend (SOAP
> web services). Now when we throw a Fault/Exception in a backend operation,
> the SOAP fault looks like this:
> 
> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
>    <env:Header/>
>    <env:Body>
>       <env:Fault>
>          <faultcode>env:Server</faultcode>
>          <faultstring>An entity with the same ID already
> exists</faultstring>
>          <detail>
>             <ns2:duplicateEntityFault
> xmlns:ns2="http://www.example.com/example/">
>                <reason>Entity was not created. An entity with the same ID
> already exists</reason>
>             </ns2:duplicateEntityFault>
>          </detail>
>       </env:Fault>
>    </env:Body>
> </env:Envelope>
> 
> The client side uses the subelement "duplicateEntityFault" of "detail" to
> generate the Exception class which we expect and catch
> (DuplicateEntityFault_Exception).
> 
> So now we added Camel to the setup which routes requests to the backend. We
> expected that if a Fault/Exception is thrown on the backend, Camel would
> just pass it back to the client. But, no. Instead the client gets this:
> 
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Server</faultcode>
>          <faultstring>HTTP operation failed invoking
> http://www.example.com/example/example-service with statusCode:
> 500</faultstring>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
> 
> So the problem is that there is no "detail" element in the fault message
> from which the client can generate the Exception. Camel logs this:
> Exhausted after delivery attempt: 1 caught:
> org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
> failed invoking http://www.example.com/example/example-service with
> statusCode: 500
> 
> Could you please tell us what is missing or what we do wrong?
> Thanks in advance,
> 
> Sebastian
> 
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Missing-detail-element-in-SOAP-fault-tp49
> 13512p4913512.html Sent from the Camel - Users mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: Missing "detail" element in SOAP fault

Posted by Gnanaguru S <gn...@gmail.com>.
Hi Williem, 

I see this issue is fixed. But I still get the faultcode like this. By the
way, I am setting a header for the faultcode in my route. Please suggest. 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         *<faultcode>soap:Server</faultcode>*
         <faultstring>4jKitj1j</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

My route: ( Am using '*MESSAGE*' as the dataformat )

<when>
	<xpath>/v:error</xpath>
	*<setHeader headerName="HTTP_RESPONSE_CODE">*
		<constant>500</constant>
	</setHeader>
	<setFaultBody>
		<xpath resultType="java.lang.String">/v:error/v:description</xpath>
	</setFaultBody>
</when>


Regards
Guru
gnanaguru.com






--
View this message in context: http://camel.465427.n5.nabble.com/Missing-detail-element-in-SOAP-fault-tp4913512p5750023.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Missing "detail" element in SOAP fault

Posted by "Willem.Jiang" <wi...@gmail.com>.
This issue should be fixed by CAMEL-4570[1]

[1] https://issues.apache.org/jira/browse/CAMEL-4570

--
View this message in context: http://camel.465427.n5.nabble.com/Missing-detail-element-in-SOAP-fault-tp4913512p4931073.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Missing "detail" element in SOAP fault

Posted by sengel <s....@tarent.de>.
Hi,

we are using Camel 2.8.0. in form of a webapp deployed in JBoss AS. 
The webapp uses the following camel dependencies:
- camel-spring
- camel-cxf
- camel-cxf-transport
- camel-servlet
- camel-http


Our routes are defined in Spring xml style:


<cxf:cxfEndpoint id="exampleService" address="${example-service.ep.address}"
serviceName="s:example-service" endpointName="s:internal-portSOAP"
wsdlURL="classpath:/webservices/example-service.wsdl"
xmlns:s="http://www.example.com/example/" />


<camel:camelContext xmlns="http://camel.apache.org/schema/spring">

    <endpoint id="originExampleService"
uri="${origin.example-service.ep.address}?transferException=true" />

    <route>
        <from uri="cxf:bean:exampleService?dataFormat=MESSAGE" />
        <to ref="originExampleService" />
    </route>

</camel:camelContext>


"${example-service.ep.address}" and "${origin.example-service.ep.address}"
are replaced with values from the Spring PropertyPlaceHolder.

There are no java classes in the webapp. Only the Spring xml configuration
file and the dependencies.
Any hints?

@willem You talked about the camel-http component. Should we use another
one?

Thanks!

--
View this message in context: http://camel.465427.n5.nabble.com/Missing-detail-element-in-SOAP-fault-tp4913512p4921983.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Missing "detail" element in SOAP fault

Posted by "Willem.Jiang" <wi...@gmail.com>.
It looks like you are using the camel-http component to send the request to
the server.
Can you show us you camel route ?


--
View this message in context: http://camel.465427.n5.nabble.com/Missing-detail-element-in-SOAP-fault-tp4913512p4920338.html
Sent from the Camel - Users mailing list archive at Nabble.com.