10 Replies Latest reply on May 4, 2010 12:55 PM by normandesjr

    How could I use XPath at this situation?

    normandesjr

      Hi,

       

         Follow a part of my wsdl:

       

      <types>
          <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.coreo.com.br/CoreoControlInterceptor" version="1.0">
            <xs:element name="interceptor" type="tns:interceptor" />
            <xs:element name="interceptorResponse" type="tns:interceptorResponse" />
            <xs:complexType name="interceptor">
              <xs:sequence>
                <xs:element minOccurs="0" name="userName" type="xs:string" />
                <xs:element minOccurs="0" name="componentName" type="xs:string" />
                <xs:element maxOccurs="unbounded" minOccurs="0" name="params" type="xs:string" />
              </xs:sequence>
            </xs:complexType>
            <xs:complexType name="interceptorResponse">
              <xs:sequence>
                <xs:element minOccurs="0" name="return" type="xs:anyType" />
              </xs:sequence>
            </xs:complexType>
          </xs:schema>
        </types>
        <message name="CoreoControlInterceptor_interceptorResponse">
          <part element="tns:interceptorResponse" name="interceptorResponse" />
        </message>
        <message name="CoreoControlInterceptor_interceptor">
          <part element="tns:interceptor" name="interceptor" />
        </message>
        <portType name="CoreoControlInterceptor">
          <operation name="interceptor" parameterOrder="interceptor">
            <input message="tns:CoreoControlInterceptor_interceptor" />
            <output message="tns:CoreoControlInterceptor_interceptorResponse" />
          </operation>
        </portType>

       

      Then at my bpel, I am trying to copy a simple literal value to "componentName" at interceptor complexType. Follow my bpel:

      ...

      <variable name="CoreoComponentSMSRequest2" messageType="CoreoControlInterceptor:CoreoControlInterceptor_interceptor" />

      ...

      <assign>
         <copy>
           <from>'CoreoComponentSMS'</from>
            <to variable="CoreoComponentSMSRequest2" part="interceptor">
               <query>???????</query>
            </to>
          </copy>

      </assign>

      ..

       

      I tried a lot of things, all unsuccessfully. Could you please help me?

       

      Regards,

       

      Normandes Junior

        • 1. Re: How could I use XPath at this situation?
          objectiser

          Hi

           

          I think the problem is that you need to initialise the structure of the 'CoreoComponentSMSRequest2' variable. This can be done by assigning a literal with a simple template of the XML to the variable, and then follow it with your current assignment using the query /interceptor/componentName.

           

          So something like:

           

          <assign>
             <copy>
               <from>

                    <interceptor xmlns="...." ><username/><componentName/></interceptor>

               </from>
                <to variable="CoreoComponentSMSRequest2" part="interceptor"/>
              </copy>

          </assign>

          <assign>
             <copy>
               <from>'CoreoComponentSMS'</from>
                <to variable="CoreoComponentSMSRequest2" part="interceptor">
                   <query>/interceptor/componentName</query>
                </to>
              </copy>

          </assign>

           

          Regards

          Gary

          • 2. Re: How could I use XPath at this situation?
            normandesjr

            Not work yet. I tried to do this way:

             

               <assign>
                  <copy>
                    <from>
                       <interceptor xmlns="http://www.coreo.com.br/CoreoControlInterceptor"><userName/><componentName/></interceptor>
                    </from>
                    <to variable="CoreoComponentSMSRequest2" part="interceptor"/>
                  </copy>
                  <copy>
                    <from>'ComponentSMS'</from>
                    <to variable="CoreoComponentSMSRequest2" part="interceptor">
                      <query>/interceptor/componentName</query>
                    </to>
                  </copy>
                </assign>

             

            A fault occurs:

            08:47:18,514 INFO  [ASSIGN] Assignment Fault: {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=24,faultExplanation=No results for expression: {OXPath10Expression /interceptor/componentName}

             

            Do you have an idea? I will try other expressions, but I am not sure if I will be able to solve.

             

            Thanks for you help.

             

            Normandes Junior

            • 3. Re: How could I use XPath at this situation?
              normandesjr

              It works but not how I expected. I have to change the partner link to RPC, so the WSDL change to this:

               

              <types>
                <xs:schema targetNamespace="http://jaxb.dev.java.net/array" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                 <xs:complexType final="#all" name="stringArray">
                  <xs:sequence>
                   <xs:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="xs:string"/>
                  </xs:sequence>
                 </xs:complexType>
                </xs:schema>
              </types>
              <message name="CoreoControlInterceptor_interceptorResponse">
                <part name="return" type="xsd:anyType"/>
              </message>
              <message name="CoreoControlInterceptor_interceptor">
                <part name="userName" type="xsd:string"/>
                <part name="componentName" type="xsd:string"/>
                <part name="params" type="ns1:stringArray"/>
              </message>
              <portType name="CoreoControlInterceptor">
                <operation name="interceptor" parameterOrder="userName componentName params">
                 <input message="tns:CoreoControlInterceptor_interceptor"/>
                 <output message="tns:CoreoControlInterceptor_interceptorResponse"/>
                </operation>
              </portType>
              <binding name="CoreoControlInterceptorBinding" type="tns:CoreoControlInterceptor">
                <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="interceptor">
                 <soap:operation soapAction="" style="rpc"/>
                 <input>
                  <soap:body namespace="http://www.coreo.com.br/CoreoControlInterceptor" use="literal"/>
                 </input>
                 <output>
                  <soap:body namespace="http://www.coreo.com.br/CoreoControlInterceptor" use="literal"/>
                 </output>
                </operation>
              </binding>

               

              Then at the BPEL, I use this way:

                 <assign>
                    <copy>
                      <from><literal>
                         <userName>user</userName>
                      </literal></from>
                      <to variable="CoreoComponentSMSRequest2" part="userName"/>
                    </copy>
                    <copy>
                      <from><literal>
                         <compnentName>component</componentName>
                      </literal></from>
                      <to variable="CoreoComponentSMSRequest2" part="componentName"/>
                    </copy>
                    <copy>
                      <from><literal>
                         <params/>
                      </literal></from>
                      <to variable="CoreoComponentSMSRequest2" part="params"/>
                    </copy>
                  </assign>

               

              There is some limitation using "document" as binding type?

               

              But this didn't work for all tags. As, params is array, it didn't work.

               

              Normandes Junior

              • 4. Re: How could I use XPath at this situation?
                normandesjr

                Now works parts. I did:

                 

                   <assign>
                      <copy>
                        <from><literal><CoreoControlInterceptor:interceptor><componentName xmlns=""/><userName xmlns=""/><params xmlns=""/></CoreoControlInterceptor:interceptor></literal></from>
                        <to variable="CoreoComponentSMSRequest2" part="interceptor"/>
                      </copy>
                      <copy>
                        <from>'ComponentSMS'</from>
                        <to>$CoreoComponentSMSRequest2.interceptor/componentName</to>
                      </copy>
                      <copy>
                        <from>'normandes'</from>
                        <to>$CoreoComponentSMSRequest2.interceptor/userName</to>
                      </copy>
                      <copy>
                        <from>'from=1234'</from>
                        <to>$CoreoComponentSMSRequest2.interceptor/params</to>
                      </copy>
                    </assign>

                 

                for the wsdl:

                 

                <types>
                  <xs:schema targetNamespace="http://www.coreo.com.br/CoreoControlInterceptor" version="1.0" xmlns:tns="http://www.coreo.com.br/CoreoControlInterceptor" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                   <xs:element name="interceptor" type="tns:interceptor"/>
                   <xs:element name="interceptorResponse" type="tns:interceptorResponse"/>
                   <xs:complexType name="interceptor">
                    <xs:sequence>
                     <xs:element minOccurs="0" name="userName" type="xs:string"/>
                     <xs:element minOccurs="0" name="componentName" type="xs:string"/>
                     <xs:element maxOccurs="unbounded" minOccurs="0" name="params" type="xs:string"/>
                    </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="interceptorResponse">
                    <xs:sequence>
                     <xs:element minOccurs="0" name="return" type="xs:anyType"/>
                    </xs:sequence>
                   </xs:complexType>
                  </xs:schema>
                </types>
                <message name="CoreoControlInterceptor_interceptorResponse">
                  <part element="tns:interceptorResponse" name="interceptorResponse"/>
                </message>
                <message name="CoreoControlInterceptor_interceptor">
                  <part element="tns:interceptor" name="interceptor"/>
                </message>

                 

                But what I am trying to do is pass more than one 'params'. Do you have an idea for this?

                 

                Thanks,

                 

                Normandes Junior.

                • 5. Re: How could I use XPath at this situation?
                  normandesjr

                  Now works with document. I have to initialized as you said.

                     <assign>
                        <copy>
                          <from><literal><CoreoControlInterceptor:interceptor><componentName xmlns=""/><userName xmlns=""/><params xmlns=""/><params xmlns=""/><params xmlns=""/></CoreoControlInterceptor:interceptor></literal></from>
                          <to variable="CoreoComponentSMSRequest2" part="interceptor"/>
                        </copy>
                        <copy>
                          <from>'ComponentSMS'</from>
                          <to>$CoreoComponentSMSRequest2.interceptor/componentName</to>
                        </copy>
                        <copy>
                          <from>'normandes'</from>
                          <to>$CoreoComponentSMSRequest2.interceptor/userName</to>
                        </copy>
                        <copy>
                          <from>'from=1111'</from>
                          <to>$CoreoComponentSMSRequest2.interceptor/params[1]</to>
                        </copy>
                        <copy>
                          <from>'from=2222'</from>
                          <to>$CoreoComponentSMSRequest2.interceptor/params[2]</to>
                        </copy>
                      </assign>

                   

                  Then to use more than on variable "params", I should initialize one by one.

                   

                  Normandes Junior.

                  • 6. Re: How could I use XPath at this situation?
                    objectiser

                    Glad its working.

                     

                    Unfortunately I don't think there is a way to do list (or multiple element) manipulating in BPEL/xpath. If you find a way to do it, I would also be interested.

                     

                    Regards

                    Gary

                    • 7. Re: How could I use XPath at this situation?
                      jcunanan

                      Hello I seem to be having the XPATH problem:

                       

                      15:25:57,930 INFO  [ASSIGN] Assignment Fault: {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=75,faultExplanation=No results for expression: {OXPath10Expression $zipcodePLRequest.getCityNameByZip/arg0}

                       

                      I tried doing exactly as you have done.  Been stuck on this problem for a while now.

                       

                      Here is the wsdl of the service i'm trying to hit and the copy segment out of my BPEL that is failing.

                       

                      WSDL:

                       

                      <?xml version="1.0" encoding="utf-8" ?>
                      <definitions name='ZipCodeWSService' targetNamespace='http://ws.zipcode.prototype.soa.next.nites.gdit.com/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://ws.zipcode.prototype.soa.next.nites.gdit.com/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
                      <types>
                        <xs:schema targetNamespace='http://ws.zipcode.prototype.soa.next.nites.gdit.com/' version='1.0' xmlns:tns='http://ws.zipcode.prototype.soa.next.nites.gdit.com/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
                         <xs:element name='getCityNameByZip' type='tns:getCityNameByZip'/>
                         <xs:element name='getCityNameByZipResponse' type='tns:getCityNameByZipResponse'/>
                         <xs:complexType name='getCityNameByZip'>
                          <xs:sequence>
                           <xs:element name='arg0' type='xs:string'/>
                          </xs:sequence>
                         </xs:complexType>
                         <xs:complexType name='getCityNameByZipResponse'>
                          <xs:sequence>
                           <xs:element name='return' type='xs:string'/>
                          </xs:sequence>
                         </xs:complexType>
                        </xs:schema>
                      </types>
                      <message name='ZipCodeWS_getCityNameByZip'>
                        <part element='tns:getCityNameByZip' name='getCityNameByZip'></part>
                      </message>
                      <message name='ZipCodeWS_getCityNameByZipResponse'>
                        <part element='tns:getCityNameByZipResponse' name='getCityNameByZipResponse'></part>
                      </message>
                      <portType name='ZipCodeWS'>
                        <operation name='getCityNameByZip' parameterOrder='getCityNameByZip'>
                         <input message='tns:ZipCodeWS_getCityNameByZip'></input>
                         <output message='tns:ZipCodeWS_getCityNameByZipResponse'></output>
                        </operation>
                      </portType>
                      <binding name='ZipCodeWSBinding' type='tns:ZipCodeWS'>
                        <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
                        <operation name='getCityNameByZip'>
                         <soap:operation soapAction=''/>
                         <input>
                          <soap:body use='literal'/>
                         </input>
                         <output>
                          <soap:body use='literal'/>
                         </output>
                        </operation>
                      </binding>
                      <service name='ZipCodeWSService'>
                        <port binding='tns:ZipCodeWSBinding' name='ZipCodeWSPort'>
                         <soap:address location='http://localhost:8080/ZipCodeWS/'/>
                        </port>
                      </service>
                      </definitions>

                       

                       

                      BPEL:  (the commentted out section not working either)

                       

                      <bpel:copy>
                                      <bpel:from>
                                          <bpel:literal>
                                              <tns:getCityNameByZip xmlns:tns="http://ws.zipcode.prototype.soa.next.nites.gdit.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                                                    <arg0></arg0>
                                              </tns:getCityNameByZip>
                                          </bpel:literal>
                                      </bpel:from>
                                      <bpel:to variable="zipcodePLRequest" part="getCityNameByZip"></bpel:to>
                                  </bpel:copy>
                                  <bpel:copy>
                                      <bpel:from part="TestPart" variable="myVar"></bpel:from>
                                      <bpel:to>$zipcodePLRequest.getCityNameByZip/arg0</bpel:to>
                                      <!--  bpel:to part="getCityNameByZip" variable="zipcodePLRequest">
                                          <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[arg0]]></bpel:query>
                                      </bpel:to-->
                                  </bpel:copy>

                      • 8. Re: How could I use XPath at this situation?
                        normandesjr

                        Try to do this way:

                         

                        <bpel:from>
                            <bpel:literal>
                                <tns:getCityNameByZip xmlns:tns="http://ws.zipcode.prototype.soa.next.nites.gdit.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                                   <arg0 xmlns=""></arg0>
                                 </tns:getCityNameByZip>
                            </bpel:literal>
                        </bpel:from>

                         

                        Realize that I add xmlns="" at arg0 parameter. If didn't work, let me know.

                         

                        Normandes Junior

                        • 9. Re: How could I use XPath at this situation?
                          jcunanan

                          Normandes Junior!!  This worked. Very strange to me why excluding that attribute would not work.  Explanation?

                           

                          I was using jboss tools with eclipse and not seeing any red so this was driving me a little crazy you know.  I knew it was only like a one line fix!

                           

                          Thanks again Normandes Junior!

                          • 10. Re: How could I use XPath at this situation?
                            normandesjr

                            Glad for solve.

                             

                            I don't have sure why this attribute is necessary. I think that could be some limitation of Apache ODE.