Hi,
I've got a problem with handling SOAP fault in my BPEL process.
I run
ODE as a service engine in Servicemix.
My BPEL process calls the web service that runs in Tomcat. The service is implemented using XFire.
It has the following operation (this WSDL is generated by XFire):
    <wsdl:portType name="WarehousePortType">
         <wsdl:operation name="OrderBook">
                <wsdl:input name="OrderBookRequest" message="tns:OrderBookRequest"/>
                <wsdl:output name="OrderBookResponse" message="tns:OrderBookResponse"/>
                <wsdl:fault name="OrderException" message="tns:OrderException"/>
         </wsdl:operation>
    </wsdl:portType>

that can throw the following fault:
    <wsdl:message name="OrderException">
        <wsdl:part name="OrderException" element="tns:OrderException"/>
    </wsdl:message>

... of the following type:
    <xsd:complexType name="OrderException">
        <xsd:sequence>
            <xsd:element minOccurs="0" name="orderMessage" nillable="true" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="OrderException" type="tns:OrderException"/>


My BPEL invokes this operation with the following code:
        <scope name="Scope1">
            <faultHandlers>
                <catchAll>
                    <empty/>
                </catchAll>
            </faultHandlers>
            <invoke name="callWarehouse"
                    partnerLink="warehousePartnerLink"
                    operation="OrderBook"
                    portType="warehouse:WarehousePortType"
                    inputVariable="orderBookIn"
                    outputVariable="orderBookOut"/>
        </scope>

The service replies with the following fault:
<soap:Envelope
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>unknown book: Design Patterns</faultstring>
            <detail>
                <OrderException xmlns="http://Warehouse.HelloBook.softech.com">
                    <orderMessage>There was an error processing the order.</orderMessage>
                </OrderException>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>


The log contains the following:
It receives the full SOAP message from the server:
21:44:44,508 | DEBUG | Thread-13  | header                   | apache.commons.httpclient.Wire   69 | << "HTTP/1.1 500 Internal Server Error[\r][\n]"
21:44:44,524 | DEBUG | Thread-13  | header                   | apache.commons.httpclient.Wire   69 | << "Content-Type: text/xml;charset=UTF-8[\r][\n]"
21:44:44,524 | DEBUG | Thread-13  | header                   | apache.commons.httpclient.Wire   69 | << "Transfer-Encoding: chunked[\r][\n]"
21:44:44,524 | DEBUG | Thread-13  | header                   | apache.commons.httpclient.Wire   69 | << "Date: Fri, 22 Dec 2006 18:44:44 GMT[\r][\n]"
21:44:44,524 | DEBUG | Thread-13  | header                   | apache.commons.httpclient.Wire   69 | << "Server: Apache-Coyote/1.1[\r][\n]"
21:44:44,524 | DEBUG | Thread-13  | header                   | apache.commons.httpclient.Wire   69 | << "Connection: close[\r][\n]"
21:44:44,524 | DEBUG | Thread-13  | content                  | apache.commons.httpclient.Wire   83 | << "1"
21:44:44,524 | DEBUG | Thread-13  | content                  | apache.commons.httpclient.Wire   83 | << "e"
21:44:44,524 | DEBUG | Thread-13  | content                  | apache.commons.httpclient.Wire   83 | << "9"
21:44:44,524 | DEBUG | Thread-13  | content                  | apache.commons.httpclient.Wire   83 | << "[\r]"
21:44:44,524 | DEBUG | Thread-13  | content                  | apache.commons.httpclient.Wire   69 | << "[\n]"
21:44:44,539 | DEBUG | Thread-13  | content                  | apache.commons.httpclient.Wire   83 | << "<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>unknown book: Design Patterns</faultstring><detail><OrderException xmlns="http://Warehouse.HelloBook.softech.com"><orderMessage>There was an error processing the order.</orderMessage></OrderException></detail></soap:Fault>&
lt;/soap:Body></soap:Envelope>"

Then the fault message is truncated and the JBI message will not contain faultstring and faultcode:
21:44:44,555 | DEBUG | Thread-12  | DeliveryChannelImpl      | .messaging.DeliveryChannelImpl  300 | Accepted: InOut[
  id: ID:alogvinov-3320-1166813006883-6:0
  status: Active
  role: consumer
  service: {http://Warehouse.HelloBook.softech.com}Warehouse
  endpoint: WarehouseHttpPort
  operation: {http://Warehouse.HelloBook.softech.com}OrderBook
  in: <?xml version="1.0" encoding="UTF-8"?><OrderBook xmlns="http://Warehouse.HelloBook.softech.com" xmlns:warehouse="http://Warehouse.HelloBook.softech.com">
							<customerID>123</customerID>
							<bookName>Design Patterns</bookName>
						</OrderBook>
  fault: <?xml version="1.0" encoding="UTF-8"?><OrderException xmlns="http://Warehouse.HelloBook.softech.com"><orderMessage>There was an error processing the order.</orderMessage></OrderException>
]

After a while I've got an error:
21:44:44,899 | ERROR | pool-3-thread-2 | Receiver                 | org.apache.ode.jbi.Receiver$1   192 | Error processing JBI message.
java.lang.AssertionError: todo
	at org.apache.ode.jbi.OdeConsumer$2.call(OdeConsumer.java:199)
	at org.apache.ode.jbi.OdeConsumer$2.call(OdeConsumer.java:183)
	at org.apache.ode.bpel.scheduler.quartz.QuartzSchedulerImpl.execTransaction(QuartzSchedulerImpl.java:212)
	at org.apache.ode.jbi.OdeConsumer.outResponse(OdeConsumer.java:182)
	at org.apache.ode.jbi.OdeConsumer.onJbiMessageExchange(OdeConsumer.java:134)
	at org.apache.ode.jbi.JbiMessageExchangeEventRouter.onJbiMessageExchange(JbiMessageExchangeEventRouter.java:40)
	at org.apache.ode.jbi.Receiver$1.run(Receiver.java:190)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
	at java.util.concurrent.FutureTask.run(FutureTask.java:123)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
	at java.lang.Thread.run(Thread.java:595)

It seems that it is raised by the following code in OdeConsumer.java

    Fault jbiFlt = jbiMex.getFault();
    if (jbiFlt != null) {

        // TODO: How are we supposed to figure out the fault type exactly?
        throw new AssertionError("todo");
    }


Here are my questions:
- Is there a proper way of
handling a fault in a BPEL process in the current version of ODE?
- Can the BPEL process receive the data from
faultstring and faultcode fields?

Thanks!



Reply via email to