3 Replies Latest reply on Jan 8, 2007 9:46 AM by bertrand.njiipwo

    How can I assign attribute of the complex object?

    pkovgan

      Hi,

      consider complex object returned from web service call.

      Is it possible to assign its attribute to the input message of the next call?

      Example:

      Call to 1-st WS returns class Foo{ int id;}

      How can I assign foo.id to the input parameter of the subsequent call?

      Is it possible at all?

      Thanks !

        • 1. Re: How can I assign attribute of the complex object?
          pkovgan

          Ok ,
          I'll try to give concrete example:

          I failed on last assign in BPEL description below.
          Actually I did not fail(no errors), but I do know that last invoke was not completed. Probably because last assign is wrong.

          My process should connect to WS called Customer and retrieve Complex object as response:

          My bpel is:

          <?xml version="1.0" encoding="UTF-8"?>
          <process name="salesOrderCreationBusinessProcess" targetNamespace="http://xtp.sap.com/bp/salesOrderCreation" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:tns="http://xtp.sap.com/bp/salesOrderCreation" xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:impl1="http://com.sap.xtp/services/Salesorder" xmlns:impl2="http://com.sap.xtp/services/Item" xmlns:impl0="http://com.sap.xtp/services/Customer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
           http://schemas.xmlsoap.org/ws/2003/03/business-process/">
           <partnerLinks>
           <partnerLink name="salesOrderCreationcaller" partnerLinkType="tns:salesOrderCreationLinkType" myRole="SalesOrderCreationConsumer"/>
           <partnerLink name="Customer" partnerLinkType="tns:CustomerLinkType" partnerRole="ICustomerService"/>
           <partnerLink name="Item" partnerLinkType="tns:ItemLinkType" partnerRole="IItemService"/>
           <partnerLink name="Salesorder" partnerLinkType="tns:SalesorderLinkType" partnerRole="ISalesorderService"/>
           </partnerLinks>
           <!--Variables of BP-->
           <variables>
           <variable name="_var0" messageType="tns:startCreateOrderMessage"/>
           <variable name="_var1" messageType="impl0:ICustomerService_DiscoveryService_findCustomer"/>
           <variable name="_var2" messageType="impl0:ICustomerService_DiscoveryService_findCustomerResponse"/>
           <variable name="_var3" messageType="impl2:IItemService_DiscoveryService_findItem"/>
           <variable name="_var4" messageType="impl2:IItemService_DiscoveryService_findItemResponse"/>
           <variable name="_var5" messageType="impl1:ISalesorderService_CreationService_createOrder"/>
           <variable name="_var6" messageType="impl1:ISalesorderService_CreationService_createOrderResponse"/>
           </variables>
           <sequence>
           <!-- receive the name of a person -->
           <receive operation="startCreateOrder" partnerLink="salesOrderCreationcaller" portType="tns:SalesOrderCreationConsumer" variable="_var0" createInstance="yes"/>
           <assign>
           <copy>
           <from variable="_var0" part="customerName"/>
           <to variable="_var1" part="customerName"/>
           </copy>
           </assign>
           <invoke name="DiscoveryService_findCustomer" operation="DiscoveryService_findCustomer" partnerLink="Customer" portType="impl0:ICustomerService" inputVariable="_var1" outputVariable="_var2">
           </invoke>
           <assign>
           <copy>
           <from variable="_var0" part="itemName"/>
           <to variable="_var3" part="itemName"/>
           </copy>
           </assign>
           <invoke name="DiscoveryService_findItem" operation="DiscoveryService_findItem" partnerLink="Item" portType="impl2:IItemService" inputVariable="_var3" outputVariable="_var4">
           </invoke>
           <assign>
           <copy>
           <from variable="_var2" part="return" query="/return/id"/>
           <to variable="_var5" part="customerId"/>
           </copy>
           <copy>
           <from variable="_var4" part="return" query="/return/id"/>
           <to variable="_var5" part="itemId"/>
           </copy>
           </assign>
           <invoke name="CreationService_createOrder" operation="CreationService_createOrder" partnerLink="Salesorder" portType="impl1:ISalesorderService" inputVariable="_var5" outputVariable="_var6">
           </invoke>
           </sequence>
          </process>
          
          
          



          As you noticed last assign takes variable _var2 from call to WS,
          WSDL of this WS below:

          <definitions name='CustomerService' targetNamespace='http://com.sap.xtp/services/Customer' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://com.sap.xtp/services/Customer' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
           <types>
           <schema elementFormDefault='qualified' targetNamespace='http://com.sap.xtp/services/Customer' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://com.sap.xtp/services/Customer' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
           <complexType name='ResultCustomer_DiscoveryService_findCustomer'>
           <sequence>
           <element name='id' type='int'/>
           </sequence>
           </complexType>
           <complexType name='ResultCustomer_s2_o1'>
          
           <sequence>
           <element name='p1' nillable='true' type='string'/>
           <element name='p2' nillable='true' type='string'/>
           </sequence>
           </complexType>
           </schema>
           </types>
           <message name='ICustomerService_DiscoveryService_findCustomer'>
           <part name='customerName' type='xsd:string'/>
          
           </message>
           <message name='ICustomerService_s2_o1Response'>
           <part name='return' type='tns:ResultCustomer_s2_o1'/>
           </message>
           <message name='ICustomerService_s2_o1'>
           <part name='p1' type='xsd:string'/>
           <part name='p2' type='xsd:string'/>
           </message>
           <message name='ICustomerService_DiscoveryService_findCustomerResponse'>
          
           <part name='return' type='tns:ResultCustomer_DiscoveryService_findCustomer'/>
           </message>
           <portType name='ICustomerService'>
           <operation name='DiscoveryService_findCustomer' parameterOrder='customerName'>
           <input message='tns:ICustomerService_DiscoveryService_findCustomer'/>
           <output message='tns:ICustomerService_DiscoveryService_findCustomerResponse'/>
           </operation>
           <operation name='s2_o1' parameterOrder='p1 p2'>
           <input message='tns:ICustomerService_s2_o1'/>
          
           <output message='tns:ICustomerService_s2_o1Response'/>
           </operation>
           </portType>
           <binding name='ICustomerServiceBinding' type='tns:ICustomerService'>
           <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
           <operation name='DiscoveryService_findCustomer'>
           <soap:operation soapAction=''/>
           <input>
           <soap:body namespace='http://com.sap.xtp/services/Customer' use='literal'/>
          
           </input>
           <output>
           <soap:body namespace='http://com.sap.xtp/services/Customer' use='literal'/>
           </output>
           </operation>
           <operation name='s2_o1'>
           <soap:operation soapAction=''/>
           <input>
           <soap:body namespace='http://com.sap.xtp/services/Customer' use='literal'/>
          
           </input>
           <output>
           <soap:body namespace='http://com.sap.xtp/services/Customer' use='literal'/>
           </output>
           </operation>
           </binding>
           <service name='CustomerService'>
           <port binding='tns:ICustomerServiceBinding' name='ICustomerServicePort'>
           <soap:address location='http://TLVD60155051A:8080/quickstart/Customer'/>
          
           </port>
           </service>
          </definitions>
          
          
          



          Could you help me?
          What's wrong in my variable/part/query?What is wrong in WSDL?

          Please, help.

          Thanks in advance.





          • 2. Re: How can I assign attribute of the complex object?
            pkovgan

            Ok, it is easy to resolve.

            I just installed apache tcp monitor and sniffed for output message from my partner webservice.

            Then I used XML Spy and its XPath utility to get correct Xpath to the element of the SOAP responce.

            This was in my case: query="/return/impl0:id"

            So thanks for everybody.




            • 3. Re: How can I assign attribute of the complex object?

              Hello Together, Hello Peter,


              i'm facing fast the same problem with the invokation of a web Service wich sends back namespace non conforme Response.

              I'm stucking and i'll need help. Could you specify more informations about how you have losed your problem hier? My problem is similar and the process invokation generate an exception during processing the Response generated from the remote web Service please see: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98256

              Alex provide me some pointer but until know i can't configure axis to generate me the synthax correct SOAP-Response.

              Can you help hier please peter or any one?


              Thanks in advance

              Bertrand