7 Replies Latest reply on Jan 7, 2007 10:42 AM by Peter Kovgan

    Assign-copy problem, very strange!

    Peter Kovgan Newbie

      I have very "strange" problem in Assign:
      The problem is : I failed to copy second element of complex type using XPATH. Copy is possible only if I copy 1-st element, then second.

      Look at my sequence:

      <sequence>
       <!-- receive the name of a person -->
       <receive operation="CustomerCustomerCreated" partnerLink="MakeDonationcaller" portType="tns:MakeDonationConsumer" variable="_start" createInstance="yes"/>
       <assign>
       <copy>
       <from variable="_start" part="ID"/>
       <to variable="_createOrderMessage" part="root" query="/root/impl3:customerRoot/impl4:id"/>
       </copy>
       </assign>
       <invoke name="SalesOrderAccessCreate" operation="salesOrderAccessCreate" partnerLink="SalesOrder" portType="impl3:ISalesOrderService" inputVariable="_createOrderMessage" outputVariable="_customerId">
       </invoke>
       </sequence>



      I copy TO id of customerRoot. But id appeares as SECOND element in WSDL:

      <complexType name="CustomerRootWrapper">
      ?
       <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="customerRootBillToAddress" nillable="true" type="tns:CustomerRootBillToAddressWrapper"/>
      <element maxOccurs="unbounded" minOccurs="0" name="customerRootContactPersons" nillable="true" type="tns:CustomerRootContactPersonsWrapper"/>
      <element maxOccurs="unbounded" minOccurs="0" name="customerRootShipToAddress" nillable="true" type="tns:CustomerRootShipToAddressWrapper"/>
      <element name="description" nillable="true" type="string"/>
      <element name="id" nillable="true" type="string"/>
      <element name="name" nillable="true" type="string"/>
      </sequence>
      </complexType>



      If I change my copy and first copy TO description of customerRoot and THEN TO id of customerRoot - copy succeeds.

      <sequence>
       <!-- receive the name of a person -->
       <receive operation="CustomerCustomerCreated" partnerLink="MakeDonationcaller" portType="tns:MakeDonationConsumer" variable="_start" createInstance="yes"/>
       <assign>
       <copy>
       <from variable="_start" part="ID"/>
       <to variable="_createOrderMessage" part="root" query="/root/impl3:customerRoot/impl4:description"/>
       </copy>
       <copy>
       <from variable="_start" part="ID"/>
       <to variable="_createOrderMessage" part="root" query="/root/impl3:customerRoot/impl4:id"/>
       </copy>
       </assign>
       <invoke name="SalesOrderAccessCreate" operation="salesOrderAccessCreate" partnerLink="SalesOrder" portType="impl3:ISalesOrderService" inputVariable="_createOrderMessage" outputVariable="_customerId">
       </invoke>
       </sequence>



      Strange? Please help!

      Thanks!





        • 1. Re: Assign-copy problem, very strange!
          Alejandro Guizar Master

          Peter,

          BPEL 1.1 is basically unaware of the XML Schema. If it were aware, every assign would incur in heavy overhead. Even BPEL 2.0 merely provides a way to validate that the resulting XML nodes match the schema. However, this is nowhere close to the effect that you expect.

          Please be aware that this is not a bug in jBPM BPEL but the effect of a design decision in the specification. You will have to work around this limitation by rearranging your assignments, as you already did.

          Best,

          /Alejandro

          • 2. Re: Assign-copy problem, very strange!
            Peter Kovgan Newbie

            Alex,Thanks a lot for help!!
            So it is known feature, Wow!

            Then additional question

            How can I produce "fictive" copy?

            That means, if I really want to copy only into 2-d parameter, how
            can I "simulate" copy into 1-st parameter and really leave it untouched?

            Is there preferable and simple or any tricky but generic approach?

            Thanks.

            • 3. Re: Assign-copy problem, very strange!
              Peter Kovgan Newbie

              I have forgoten to put exception that I have if I try to copy only to second parameter:

              javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: javax.xml.bind.JAXBException: Failed to parse source: Requested element {http://entities.customer.xtp.sap.com/jaws}
              id is not allowed in this position in the sequence. The next element should be {http://entities.customer.xtp.sap.com/jaws}description


              • 4. Re: Assign-copy problem, very strange!
                Alejandro Guizar Master

                 

                How can I produce "fictive" copy?

                That means, if I really want to copy only into 2-d parameter, how
                can I "simulate" copy into 1-st parameter and really leave it untouched?


                Well, the real problem is, according to your schema, the description element must be present:

                <element name="description" nillable="true" type="string"/>
                <element name="id" nillable="true" type="string"/>


                nillable="true" means that the attribute xsi:nil may appear in the element, indicating that its value should be considered null. It does not mean that the element is optional. The following code gives the desired effect:

                <assign>
                 <copy>
                 <from expression="'true'" />
                 <to variable="_createOrderMessage" part="root" query="/root/impl3:customerRoot/impl4:description/@xsi:nil"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
                 </copy>
                 <copy>
                 <from variable="_start" part="ID"/>
                 <to variable="_createOrderMessage" part="root" query="/root/impl3:customerRoot/impl4:id"/>
                 </copy>
                </assign>


                • 6. Re: Assign-copy problem, very strange!
                  Peter Kovgan Newbie


                  Alex, one more question

                  my problem I can't change parameter's attribute to "optional".

                  May be you know how to do it?

                  I use jsr 181 in my WS and a few annotations, that do not allow be make parameter optional.

                  does wstools allows this?


                  Thanks.

                  With not optional parameter I should somehow figure out what a parameters that I need to past TO in assign and fill all gaps - that is quite complex task.


                  Thanks.


                  • 7. Re: Assign-copy problem, very strange!
                    Peter Kovgan Newbie

                    Alex, and still it is strange!

                    my wsdl :

                    <complexType name="CustomerRootWrapper">
                    ?
                     <sequence>
                    <element maxOccurs="unbounded" minOccurs="0" name="customerRootBillToAddress" nillable="true" type="tns:CustomerRootBillToAddressWrapper"/>
                    <element maxOccurs="unbounded" minOccurs="0" name="customerRootContactPersons" nillable="true" type="tns:CustomerRootContactPersonsWrapper"/>
                    <element maxOccurs="unbounded" minOccurs="0" name="customerRootShipToAddress" nillable="true" type="tns:CustomerRootShipToAddressWrapper"/>
                    <element name="description" nillable="true" type="string"/>
                    <element name="id" nillable="true" type="string"/>
                    <element name="name" nillable="true" type="string"/>
                    </sequence>
                    </complexType>



                    as you can see description , id, and name are all NOT optional, but only description throws an arror, name is pretty quiet. it still seems to me unlogical.