3 Replies Latest reply on Oct 25, 2007 5:23 AM by cocogg

    How to do XPath query in BPEL?

    zazzaz

      Hi all,

      suppose I have the following complex type:

      <xsd:complexType name="Credenziali">
       <xsd:sequence>
       <xsd:element name="nome" type="xsd:string"></xsd:element>
       <xsd:element name="password" type="xsd:string"></xsd:element>
       </xsd:sequence>
      </xsd:complexType>
      


      And I have the following message types
      
      <message name="ControlloAccessoOperationRequest">
       <part name="part1" type="ns:Credenziali"/>
       </message>
      
      <message name="LoginOperationRequest">
       <part name="inRequest" type="xsd:string"/>
       </message>
      
      


      How can I copy inRequest in the element "nome" of type Credenziali in ControlloAccessoOperationRequest in BPEL code?

      Thanks a lot! Bye

        • 1. Re: How to do XPath query in BPEL?
          zazzaz

          I think it's OK like this. Suppose LoginOperationRequestVar is of type LoginOperationRequest and ControlloAccessoOperationRequestVar of type ControlloAccessoOperationRequest

          
          <assign>
           <copy>
           <from variable="LoginOperationRequestVar" part="inRequest" />
           <to variable="ControlloAccessoOperationRequestVar" part="part1" query="/part1/nome" />
           </copy>
          </assign>
          
          


          • 2. Re: How to do XPath query in BPEL?
            zazzaz

            Previous answer is incomplete.

            It looks like BPEL message and variable manipulation is implemented in not a namespace-controlled way.

            Then, the previous query is correct but namespace will be missing or mixing up.

            So you have to add the namespace in the query or the namespace will disappear

            In previous code, if the element "part1" in defined in a schema referenced in BPEL headers like xmlns:sch=....
            a correct query looks like

            
            <assign>
             <copy>
             <from variable="LoginOperationRequestVar" part="inRequest" />
             <to variable="ControlloAccessoOperationRequestVar" part="part1" query="/part1/sch:nome" />
             </copy>
            </assign>
            
            
            


            • 3. Re: How to do XPath query in BPEL?
              cocogg

              Try

              <assign>
               <copy>
               <from variable="LoginOperationRequestVar" part="inRequest" />
               <to>$ControlloAccessoOperationRequestVar.part1/sch:nome</to>
               </copy>
              </assign>