You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Ania <a....@gmail.com> on 2009/05/21 21:25:31 UTC

Invoking external web service problem

Hello,

I have problem with invoking external web service from BPEL process. 
I've found a post with a similar problem (  
http://mail-archives.apache.org/mod_mbox/ode-user/200812.mbox/%3Cbfba15ee0812040246q74739d59t7c083372620ff7d6@mail.gmail.com%3E 
), but there was no answer since then.

I've created a simple process. It gets an input of BPEL process and 
assigns it to an input of external WS. Then, it invokes the WS and the 
response is assigned to the output of the process.

When I am executing the BPEL process, the external WS is called, but it 
can't parse properly the message it receives. Except "Hello, Ania!" I 
get "Hello, null!" as a result from a BPEL process.

Here's a fragment from a server log:
(...)
DEBUG - GeronimoLog.debug(66) | Sending a message containing wsa 
endpoints in headers for session passing.
DEBUG - GeronimoLog.debug(66) | <?xml version='1.0' 
encoding='utf-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><addr:To 
xmlns:addr="http://www.w3.org/2005/08/addressing">http://localhost:9090/HelloWS/HelloService</addr:To><addr:Action 
xmlns:addr="http://www.w3.org/2005/08/addressing"></addr:Action><addr:ReplyTo 
xmlns:addr="http://www.w3.org/2005/08/addressing"><addr:Address>http://www.w3.org/2005/08/addressing/anonymous</addr:Address></addr:ReplyTo><addr:MessageID 
xmlns:addr="http://www.w3.org/2005/08/addressing">uuid:hqejbhcnphr4ajmbcqe459</addr:MessageID></soapenv:Header><soapenv:Body><sayHello 
xmlns="http://hello.ania.org/">
<imie>Ania</imie></sayHello></soapenv:Body></soapenv:Envelope>
DEBUG - GeronimoLog.debug(66) | Service response:
<?xml version='1.0' encoding='utf-8'?><S:Envelope 
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:sayHelloResponse 
xmlns:ns2="http://hello.ania.org/"><return>Hello, 
null!</return></ns2:sayHelloResponse></S:Body></S:Envelope>
(...)


How to resolve this problem? Any ideas?

Thanks,
Ania


PS. Here's wsdl and bpel content:

HelloProcessArtifacts.wsdl

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" 
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"

xmlns:tns="http://helloprocess.ania.org" 
xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop"

xmlns:wsdl="http://hello.ania.org/" name="HelloProcess" 
targetNamespace="http://helloprocess.ania.org"

xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     TYPE DEFINITION - List of types participating in this BPEL process
     The BPEL Designer will generate default request and response types
     but you can define or import any XML Schema type and use them as part
     of the message types.
     
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->    
    <plnk:partnerLinkType name="HelloServicePartnerLinkType">
    <plnk:role name="helloProviderRole" portType="wsdl:HelloService"/>
  </plnk:partnerLinkType>
    <import location="HelloService.wsdl" 
namespace="http://hello.ania.org/"/>
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" 
attributeFormDefault="unqualified" elementFormDefault="qualified"

targetNamespace="http://helloprocess.ania.org">

            <element name="HelloProcessRequest">
                <complexType>
                    <sequence>
                        <element name="input" type="string"/>
                    </sequence>
                </complexType>
            </element>

            <element name="HelloProcessResponse">
                <complexType>
                    <sequence>
                        <element name="result" type="string"/>
                    </sequence>
                </complexType>
            </element>
        </schema>
    </types>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     MESSAGE TYPE DEFINITION - Definition of the message types used as
     part of the port type defintions
     
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->    
    <message name="HelloProcessRequestMessage">
        <part element="tns:HelloProcessRequest" name="payload"/>
    </message>
    <message name="HelloProcessResponseMessage">
        <part element="tns:HelloProcessResponse" name="payload"/>
    </message>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PORT TYPE DEFINITION - A port type groups a set of operations into
     a logical service unit.
     
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->    

    <!-- portType implemented by the HelloProcess BPEL process -->
    <portType name="HelloProcess">
        <operation name="process">
            <input message="tns:HelloProcessRequestMessage"/>
            <output message="tns:HelloProcessResponseMessage"/>
        </operation>
    </portType>
 

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PARTNER LINK TYPE DEFINITION
     
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->    
    <plnk:partnerLinkType name="HelloProcess">
        <plnk:role name="HelloProcessProvider" portType="tns:HelloProcess"/>
    </plnk:partnerLinkType>
    
    <binding name="HelloProcessSoapBinding" type="tns:HelloProcess">
        <soap:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="process">
            <soap:operation
                soapAction="http://helloprocess.ania.org/process" />
            <input>
                <soap:body use="literal" />
            </input>
            <output>
                <soap:body use="literal" />
            </output>
        </operation>
    </binding>
    <service name="HelloProcessService">
        <port name="HelloProcessPort" binding="tns:HelloProcessSoapBinding">
            <soap:address 
location="http://localhost:8080/ode/processes/HelloProcess" />
        </port>
    </service>
</definitions>





HelloProces.bpel

<!-- HelloProcess BPEL Process [Generated by the Eclipse BPEL Designer] -->
<bpel:process name="HelloProcess"
         targetNamespace="http://helloprocess.ania.org"
         suppressJoinFailure="yes"
         xmlns:tns="http://helloprocess.ania.org"
         
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         xmlns:ns="http://hello.ania.org/">

    <!-- Import the client WSDL -->
    <bpel:import namespace="http://hello.ania.org/" 
location="HelloService.xsd"

importType="http://www.w3.org/2001/XMLSchema"></bpel:import>
    <bpel:import namespace="http://hello.ania.org/" 
location="HelloService.wsdl"

importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
    <bpel:import location="HelloProcessArtifacts.wsdl" 
namespace="http://helloprocess.ania.org"
            importType="http://schemas.xmlsoap.org/wsdl/" />
         
    <!-- 
================================================================= 
-->         
    <!-- 
PARTNERLINKS                                                      -->
    <!-- List of services participating in this BPEL 
process               -->
    <!-- 
================================================================= 
-->         
    <bpel:partnerLinks>
        <!-- The 'client' role represents the requester of this service. -->
        <bpel:partnerLink name="client"
                     partnerLinkType="tns:HelloProcess"
                     myRole="HelloProcessProvider"
                     />
        <bpel:partnerLink name="HelloServicePartnerLink" 
partnerLinkType="tns:HelloServicePartnerLinkType"

partnerRole="helloProviderRole"></bpel:partnerLink>
    </bpel:partnerLinks>
 
    <!-- 
================================================================= 
-->         
    <!-- 
VARIABLES                                                         -->
    <!-- List of messages and XML documents used within this BPEL 
process  -->
    <!-- 
================================================================= 
-->         
    <bpel:variables>
        <!-- Reference to the message passed as input during initiation -->
        <bpel:variable name="input"
                  messageType="tns:HelloProcessRequestMessage"/>
                  
        <!--
          Reference to the message that will be returned to the requester
          -->
        <bpel:variable name="output"
                  messageType="tns:HelloProcessResponseMessage"/>
        <bpel:variable name="HelloServicePartnerLinkResponse" 
messageType="ns:sayHelloResponse"></bpel:variable>
        <bpel:variable name="HelloServicePartnerLinkRequest" 
messageType="ns:sayHello"></bpel:variable>
    </bpel:variables>

    <!-- 
================================================================= 
-->         
    <!-- ORCHESTRATION 
LOGIC                                               -->
    <!-- Set of activities coordinating the flow of messages across 
the    -->
    <!-- services integrated within this business 
process                  -->
    <!-- 
================================================================= 
-->         
    <bpel:sequence name="main">
        
        <!-- Receive input from requester.
             Note: This maps to operation defined in HelloProcess.wsdl
             -->
        <bpel:receive name="receiveInput" partnerLink="client"
                 portType="tns:HelloProcess"
                 operation="process" variable="input"
                 createInstance="yes"/>
        
        <!-- Generate reply to synchronous request -->
        <bpel:assign validate="no" name="Assign">
            <bpel:copy>
                <bpel:from>
                    <bpel:literal 
xml:space="preserve"><tns:HelloProcessResponse 
xmlns:tns="http://helloprocess.ania.org"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <tns:result></tns:result>
</tns:HelloProcessResponse>
</bpel:literal>
                </bpel:from>
                <bpel:to variable="output" part="payload"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from>
                    <bpel:literal 
xml:space="preserve"><ns:sayHelloResponse xmlns:ns="http://hello.ania.org/"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns:return></ns:return></ns:sayHelloResponse>
</bpel:literal>
                </bpel:from>
                <bpel:to variable="HelloServicePartnerLinkResponse" 
part="parameters"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from>
                    <bpel:literal xml:space="preserve"><ns:sayHello 
xmlns:ns="http://hello.ania.org/"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns:imie>tomasz</ns:imie></ns:sayHello>
</bpel:literal>
                </bpel:from>
                <bpel:to variable="HelloServicePartnerLinkRequest" 
part="parameters"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from part="payload" variable="input">
                    <bpel:query 
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]

 ></bpel:query>
                </bpel:from>
                <bpel:to part="parameters" 
variable="HelloServicePartnerLinkRequest">
                    <bpel:query 
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:imie]]

 ></bpel:query>
                </bpel:to>
            </bpel:copy>
            
            
        </bpel:assign>
        <bpel:invoke name="Invoke" partnerLink="HelloServicePartnerLink" 
operation="sayHello" portType="ns:HelloService"

inputVariable="HelloServicePartnerLinkRequest" 
outputVariable="HelloServicePartnerLinkResponse"></bpel:invoke>
        <bpel:assign validate="no" name="Assign1">
            <bpel:copy>
                <bpel:from>
                    <bpel:literal 
xml:space="preserve"><tns:HelloProcessResponse 
xmlns:tns="http://helloprocess.ania.org"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <tns:result></tns:result>
</tns:HelloProcessResponse>
</bpel:literal>
                </bpel:from>
                <bpel:to variable="output" part="payload"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from part="parameters" 
variable="HelloServicePartnerLinkResponse">
                    <bpel:query 
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[return]]

 ></bpel:query>
                </bpel:from>
                <bpel:to part="payload" variable="output">
                    <bpel:query 
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]

 ></bpel:query>
                </bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:reply name="replyOutput"
               partnerLink="client"
               portType="tns:HelloProcess"
               operation="process"
               variable="output"
               />
        
        
        
    </bpel:sequence>
</bpel:process>