ode-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LeeCK <leechin_k...@yahoo.com>
Subject Re: How to handle soap fault
Date Wed, 09 Sep 2009 07:04:51 GMT

Hi Milinda,

I've applied <ext:failureHandling> in to my bpel script. But I still got the
same result. My problem is: no fault is being thrown!!

My case is slightly different to your test case. I am trying to invoke a
VALID external web service operation. The soapFault that I am expecting is
thrown by external ws operation. 

For example:
                <invoke name="invokeAddUserToGroupOperation"
                operation="AddUserToGroup"
                inputVariable="addUserToGroupRequest"
                outputVariable="addUserToGroupResponse"
                partnerLink="mossUserGroupPartnerLink"
                portType="ssdir:UserGroupSoap">

where addUserToGroupRequest's and addUserToGroupResponse's schema looks like
this:
      <s:element name="AddUserToGroup">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="groupName"
type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="userName"
type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="userLoginName"
type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="userEmail"
type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="userNotes"
type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>

      <s:element name="AddUserToGroupResponse">
        <s:complexType />
      </s:element>

Let's say when I passed in an invalid "groupName", the endpoint will returns
a soapFault telling me that the groupName is invalid.

The strange thing is, the soapFault message gets written into the invoke's
outputVariable. So my first question is: Why does a soapFault gets written
into invoke's outputVariable? Should'nt the content of the outputVariable
comply to the defined schema in WSDL? According to the schema, the
outputVariable should look like
<AddUserToGroupResponse>....</AddUserToGroupResponse>

My second question is: Will ODE propogate the soapFault thrown by external
endpoint? How does ODE differentiates a soap envelope with a normal response
to a soap envelope that has a soapFault in it?

Thanks,
Lee


Log shows soapFault get written into outputVariable:
16:10:49,190 | DEBUG | pool-5-thread-13 | BpelRuntimeContextImpl   |
.engine.BpelRuntimeContextImpl  976 | Triggering response
16:10:49,190 | DEBUG | pool-5-thread-13 | ScopeFrame               |
he.ode.bpel.runtime.ScopeFrame  237 | Initialize variable: name={Variable
__PROCESS_SCOPE:Moss.addUserToGroupResponse:OMessageVarType#22} value=<?xml
version="1.0" encoding="UTF-8"?>
<soap:Fault
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><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>


Milinda Pathirage wrote:
> 
> 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
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/How-to-handle-soap-fault-tp25325263p25359695.html
Sent from the Apache Ode User mailing list archive at Nabble.com.


Mime
View raw message