ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milinda Pathirage <milinda.pathir...@gmail.com>
Subject Re: How to handle soap fault
Date Tue, 08 Sep 2009 18:38:35 GMT
Hi Lee,
I have attached a example which use faultOnFailure=true. Can you try it. I
have also attached the service archive with SOAP fault. What I did was,
generate code using WSDL2Java tool and keep the unsupported operation
exception thrown inside skeleton's method unchanged, so that it'll generate
a SOAP fault.

Once the invoke failed due to that fault ODE will send response like
following:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring xmlns:axis2ns1="http://ode.apache.org/activityRecovery
">axis2ns1:activityFailure</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

I think you can improve this to suite your requirements. Please let me know
if you have any questions.

Thanks
Milinda


On Tue, Sep 8, 2009 at 6:51 AM, Milinda Pathirage <
milinda.pathirage@gmail.com> wrote:

> Hi Lee,
>
> I'll try this today and let you know about a solution if available.
>
> Thanks
> Milinda
>
>
> On Tue, Sep 8, 2009 at 5:34 AM, LeeCK <leechin_kong@yahoo.com> wrote:
>
>>
>> Hi Milinda,
>>
>> I am expecting to get a soap fault from invoke and I can see in TCPMon
>> that
>> a soap fault has been thrown by the endpoint. I tried to use the scripts
>> below to catch the soap fault but failed. This is because no soap fault
>> has
>> been thrown by invoke and the soap fault message has been written into
>> addUserToGroupResponse. Perhaps the question should be: Why is the soap
>> fault message gets written into the outputVariable?
>>
>>        <invoke name="invokeAddUserToGroupOperation"
>>                operation="AddUserToGroup"
>>                inputVariable="addUserToGroupRequest"
>>                outputVariable="addUserToGroupResponse"
>>                partnerLink="mossUserGroupPartnerLink"
>>                portType="ssdir:UserGroupSoap">
>>
>>             <ext:failureHandling>
>>                <ext:faultOnFailure>true</ext:faultOnFailure>
>>            </ext:failureHandling>
>>
>>            <catchAll>
>>                <rethrow/>
>>            </catchAll>
>>
>>        </invoke>
>>
>>
>>
>> Milinda Pathirage wrote:
>> >
>> > Hi Lee,
>> >
>> > ODE has it's own failure handling mechanism for Invoke activities. You
>> can
>> > disable that using configurations. Please have a look at the 'example'
>> > section of ODE's activity failure and recovery document at[1]
>> >
>> > Thanks
>> > Milinda
>> >
>> > [1] http://ode.apache.org/activity-failure-and-recovery.html
>> >
>> > On Mon, Sep 7, 2009 at 12:20 PM, LeeCK <leechin_kong@yahoo.com> wrote:
>> >
>> >>
>> >> Hi Milinda,
>> >>
>> >> I've tried to use
>> <faultHandlers><catchAll>...</catchAll></faultHandlers>
>> >> to
>> >> catch the soap fault, but nothing has been caught. That is when i found
>> >> out
>> >> that the soap fault has been written into the invoke's outputVariable.
>> >>
>> >> Is this a correct behaviour? How can I stop <invoke> writing the soap
>> >> fault
>> >> into the outputVariable?
>> >>
>> >>
>> >>
>> >> Milinda Pathirage wrote:
>> >> >
>> >> > You can use fault handlers to implement your requirements. Please
>> have
>> >> > look
>> >> > at the fault handling section of BPEL specification and fault
>> handling
>> >> > tests
>> >> > come with Apache ODE tests. You can find tests at
>> >> > 'bpel-test/src/test/resources/bpel/2.0' directory of Apache ODE trunk
>> >> > source.
>> >> >
>> >> > Thanks
>> >> > Milinda
>> >> >
>> >> > On Mon, Sep 7, 2009 at 11:11 AM, LeeCK <leechin_kong@yahoo.com>
>> wrote:
>> >> >
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> When invoking the bpel script below, I was expecting the invoke
>> script
>> >> to
>> >> >> throw an exception when there's a soap fault so that I can catch
the
>> >> soap
>> >> >> fault and report the error to the user. But no exception was thrown
>> >> and
>> >> >> the
>> >> >> soap fault is written into the addUserToGroupResponse variable.
What
>> >> did
>> >> >> I
>> >> >> do wrong? How can I force the invoke script to throw an exception
>> when
>> >> >> soap
>> >> >> fault is received? Is there another way to handle soap fault? Please
>> >> >> help.
>> >> >> Thanks.
>> >> >>
>> >> >> Bpel script:
>> >> >>    <variables>
>> >> >>        <variable name="addUserToGroupRequest"
>> >> >> messageType="ssdir:AddUserToGroupSoapIn"/>
>> >> >>        <variable name="addUserToGroupResponse"
>> >> >> messageType="ssdir:AddUserToGroupSoapOut"/>
>> >> >>    </variables>
>> >> >>
>> >> >>    <sequence>
>> >> >>        <invoke name="invokeAddUserToGroupOperation"
>> >> >>                operation="AddUserToGroup"
>> >> >>                inputVariable="addUserToGroupRequest"
>> >> >>                outputVariable="addUserToGroupResponse"
>> >> >>                partnerLink="mossUserGroupPartnerLink"
>> >> >>                portType="ssdir:UserGroupSoap">
>> >> >>        </invoke>
>> >> >>    </sequence>
>> >> >>
>> >> >> Wsdl:
>> >> >>  <wsdl:types>
>> >> >>    <s:schema
>> >> >> targetNamespace="
>> >> http://schemas.microsoft.com/sharepoint/soap/directory/">
>> >> >>      <s:element name="AddUserToGroupResponse">
>> >> >>        <s:complexType />
>> >> >>      </s:element>
>> >> >>    </s:schema>
>> >> >>  </wsdl:types>
>> >> >>  <wsdl:message name="AddUserToGroupSoapOut">
>> >> >>    <wsdl:part name="parameters" element="tns:AddUserToGroupResponse"
>> >> />
>> >> >>  </wsdl:message>
>> >> >>
>> >> >> Soap envelope returns by endpoint:
>> >> >>   <soap:Envelope xmlns:soap="
>> http://www.w3.org/2003/05/soap-envelope"
>> >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> >> >>      <soap:Body>
>> >> >>         <soap:Fault>
>> >> >>            <soap:Code>
>> >> >>               <soap:Value>soap:Receiver</soap:Value>
>> >> >>            </soap:Code>
>> >> >>            <soap:Reason>
>> >> >>               <soap:Text xml:lang="en">Exception of type
>> >> >> 'Microsoft.SharePoint.SoapServer.SoapServerException' was
>> >> >> thrown.</soap:Text>
>> >> >>            </soap:Reason>
>> >> >>            <detail>
>> >> >>               <errorstring
>> >> >> xmlns="http://schemas.microsoft.com/sharepoint/soap/">Group
cannot
>> be
>> >> >> found.</errorstring>
>> >> >>               <errorcode
>> >> >> xmlns="http://schemas.microsoft.com/sharepoint/soap/
>> >> >> ">0x80131600</errorcode>
>> >> >>            </detail>
>> >> >>         </soap:Fault>
>> >> >>      </soap:Body>
>> >> >>   </soap:Envelope>
>> >> >>
>> >> >> Content of addUserToGroupResponse after invoke is called:
>> >> >>            <soap:Code>
>> >> >>               <soap:Value>soap:Receiver</soap:Value>
>> >> >>            </soap:Code>
>> >> >>            <soap:Reason>
>> >> >>               <soap:Text xml:lang="en">Exception of type
>> >> >> 'Microsoft.SharePoint.SoapServer.SoapServerException' was
>> >> >> thrown.</soap:Text>
>> >> >>            </soap:Reason>
>> >> >>            <detail>
>> >> >>               <errorstring
>> >> >> xmlns="http://schemas.microsoft.com/sharepoint/soap/">Group
cannot
>> be
>> >> >> found.</errorstring>
>> >> >>               <errorcode
>> >> >> xmlns="http://schemas.microsoft.com/sharepoint/soap/
>> >> >> ">0x80131600</errorcode>
>> >> >>            </detail>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/How-to-handle-soap-fault-tp25325263p25325263.html
>> >> >> Sent from the Apache Ode User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Milinda Pathirage
>> >> > Senior Software Engineer & Project Lead; WSO2 BPS;
>> http://wso2.org/bps
>> >> > WSO2 Inc.; http://wso2.com
>> >> > E-mail: milinda@wso2.com, milinda.pathirage@gmail.com
>> >> > Blog: http://mpathirage.com
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/How-to-handle-soap-fault-tp25325263p25325748.html
>> >> Sent from the Apache Ode User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Milinda Pathirage
>> > Senior Software Engineer & Project Lead; WSO2 BPS; http://wso2.org/bps
>> > WSO2 Inc.; http://wso2.com
>> > E-mail: milinda@wso2.com, milinda.pathirage@gmail.com
>> > Blog: http://mpathirage.com
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-handle-soap-fault-tp25325263p25338102.html
>> Sent from the Apache Ode User mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Milinda Pathirage
> Senior Software Engineer & Project Lead; WSO2 BPS; http://wso2.org/bps
> WSO2 Inc.; http://wso2.com
> E-mail: milinda@wso2.com, milinda.pathirage@gmail.com
> Blog: http://mpathirage.com
>



-- 
Milinda Pathirage
Senior Software Engineer & Product Manager WSO2 BPS; http://wso2.org/bps
WSO2 Inc.; http://wso2.com
E-mail: milinda@wso2.com, milinda.pathirage@gmail.com
Web: http://mpathirage.com
Blog: http://blog.mpathirage.com

Mime
View raw message