1 2 Previous Next 26 Replies Latest reply on Feb 24, 2010 1:10 PM by normandesjr

    PartnerLink with complex type problem

    normandesjr

      Hi,

       

         I am trying to invoke a PartnerLink that has a complex type:

                  <xs:complexType name="sendSMS">
                      <xs:sequence>
                          <xs:element minOccurs="0" name="from" type="xs:string" />
                          <xs:element minOccurs="0" name="to" type="xs:string" />
                          <xs:element minOccurs="0" name="message" type="xs:string" />
                      </xs:sequence>
                  </xs:complexType>

       

         I am with a big problem, because I couldn't set all parameter before invoke the partnerLink. I am doing something like this:

             <bpel:assign validate="no" name="assignInvoke">
                  <copy>
                      <from><literal><intf2:sendSMS><from xmlns="">99999999</from></intf2:sendSMS></literal></from>
                      <to part="sendSMS" variable="inVar"/>
                   </copy>
                   <copy>
                      <from>'888888888'</from>
                      <to part="sendSMS" variable="inVar" query="/intf2:sendSMS/to"/>
                   </copy>
                   <copy>
                      <from><literal>'Some message'</literal></from>
                      <to part="sendSMS" variable="inVar" query="/intf2:sendSMS/message"/>
                   </copy>
              </bpel:assign>

       

         The variable type "inVar" is the complexType sendSMS.

       

         When the message arrives at my PartnerLink, only the last part is initialized. In this case, only message part has the value "Some Variable".

       

         There are some limitation or bug, or I am doing something wrong?

       

         Regards,

       

      Normandes Junior

      Brazil

        • 1. Re: PartnerLink with complex type problem
          objectiser

          Hi

           

          This sounds like a strange problem - I assume you mean that the 'message' part of the inVar variable is initialised to 'Some message' value - but that the other parts 'from' and 'to' are not present at all?

           

          Could you try initialising all of the message parts in the first 'copy' statement, so:

           

                      <copy>
                          <from><literal><intf2:sendSMS><from xmlns="">99999999</from><to xmlns="">99999999</to><message xmlns="">99999999</message></intf2:sendSMS></literal></from>
                          <to part="sendSMS" variable="inVar"/>
                       </copy>

           

           

          If that does not sort out the problem, can you raise a bug and provide a test case.

           

          Regards

          Gary

          • 2. Re: PartnerLink with complex type problem
            normandesjr

            Hi,

             

            "I assume you mean that the 'message' part of the inVar variable is initialised to 'Some message' value - but that the other parts 'from' and 'to' are not present at all?"

             

            Yes, you're right. Only the last one is initialized.

             

            Thanks, trying initialize all of the message parts in the first 'copy' statement works! (But I think it could work the way I did, don't you think?)

             

            But I have also another problem. I am trying to pass some soapHeader information to partnerLink. My code is like this:

             

                   <bpel:assign validate="no" name="assignInvoke">
                        <copy>
                            <from>
                                <literal>
                                    <intf2:sendSMS>
                                        <from xmlns="">9999999</from>
                                        <to xmlns="">1111111</to>
                                        <message xmlns="">textooo</message>
                                    </intf2:sendSMS>
                                </literal>
                            </from>
                            <to part="sendSMS" variable="inVar"/>
                         </copy>
                         <copy>
                            <from>
                                <literal>
                                        <intf2:userName>user</intf2:userName>
                                 </literal>
                             </from>
                            <to part="userName" variable="inVar"/>
                        </copy>
                    </bpel:assign>

             

               Where the part 'userName' in variable 'inVar' is a soapHeader input at wsdl. At my partnerLink I couldn't retrieve the header value.

             

               Could you help me with this problem?

             

               Regards,

             

            Normandes Junior.

            • 3. Re: PartnerLink with complex type problem
              objectiser
              Hi
              Thanks, trying initialize all of the message parts in the first 'copy' statement works! (But I think it could work the way I did, don't you think?)

               

               

              It would seem reasonable - not sure if this is a limitation with ODE, or the way all BPEL engines work. Might be worth asking the question on the Apache ODE user forum.

               

                 Where the part 'userName' in variable 'inVar' is a soapHeader input at wsdl. At my partnerLink I couldn't retrieve the header value.

               

                 Could you help me with this problem?

               

              In RiftSaw-2.0-CR1, passing header properties mapped using WSDL did not work - however this has now been fixed and is available in the latest snapshot: http://hudson.jboss.org/hudson/job/RiftSaw/

               

              This snapshot also includes a quickstart example that you could check out, to compare to the approach you are using.

               

              Alternatively, CR1 includes a sample/quickstarts/hello_world_header_ode that shows an ODE specific way of accessing SOAP header fields.

               

              Regards

              Gary

              • 4. Re: PartnerLink with complex type problem
                normandesjr

                Hi,

                 

                   I downloaded the snapshot version of Riftsaw and I couldn't add soap header to invoke the partner link.

                 

                   The examples at snapshot version talk about receive header values at bpel, but what I really need is invoke a partner link and add header values to them.

                 

                   I am trying to do something like this:

                 

                   <bpel:assign validate="no" name="assignInvoke">
                            <copy>
                                <from>
                                    <literal>
                                        <intf2:sendSMS>
                                            <from xmlns="">9999999</from>
                                            <to xmlns="">1111111</to>
                                            <message xmlns="">textooo</message>
                                        </intf2:sendSMS>
                                    </literal>
                                </from>
                                <to part="sendSMS" variable="inVar"/>
                             </copy>
                             <copy>
                                <from>
                                    <literal>
                                        <env:Header>
                                            <intf2:userName>user</intf2:userName>
                                        </env:Header>
                                     </literal>
                                 </from>
                                <to part="userName" variable="inVar"/>
                            </copy>

                        </bpel:assign>

                 

                   As you can see, the second copy is adding header value to partnerLink variable.

                 

                   Any other tips?

                 

                   Regards,

                 

                Normandes Junior.

                • 5. Re: PartnerLink with complex type problem
                  objectiser

                  Hi

                   

                  I don't think it is possible to set a header property using this approach - because you are trying to copy a SOAP header element into the message content.

                   

                  The hello_world_header_wsdl example shows how header properties can be mapped into the SOAP message header within the WSDL. This means that in the BPEL, you only need to deal with standard message parts.

                   

                  For example,

                   

                  HelloWorld.bpel does the following copy statement:

                   

                              <copy>
                                <from variable="myVar" part="conversationId"/>
                                <to variable="conversationId" />
                              </copy>

                   

                  This copies the 'conversationId' message part from the message held in the 'myVar' variable into another local variable called 'conversationId'.

                   

                  If we look at the wsdl, we can see how the 'conversationId' message part is mapped onto the SOAP header part:

                   

                      <wsdl:message name="HelloMessage">
                          <wsdl:part name="TestPart" type="xsd:string"/>
                          <wsdl:part name="conversationId" element="types:conversationId" />
                      </wsdl:message>

                   

                  The message type simply defines the additional 'conversationId' message part, as if it is part of the message content. However,

                   

                          <wsdl:operation name="hello">
                              <soap:operation soapAction="" style="rpc"/>
                              <wsdl:input>
                                  <soap:body
                                          namespace="http://www.jboss.org/bpel/examples/wsdl"
                                          use="literal" parts="TestPart" />
                                   <soap:header message="tns:HelloMessage"
                                           part="conversationId" use="literal"/>
                             </wsdl:input>
                              <wsdl:output>
                                  <soap:body
                                          namespace="http://www.jboss.org/bpel/examples/wsdl"
                                          use="literal" parts="TestPart" />
                                   <soap:header message="tns:HelloMessage"
                                           part="conversationId" use="literal"/>
                              </wsdl:output>
                          </wsdl:operation>

                   

                   

                  you will notice the <soap:header .... part="conversationId" ... /> elements - this tells the underlying transport to map the 'conversationId' part of the message type into the SOAP message header, instead of the body.

                   

                  This example is receiving a header property - but the same would work for setting the header property, just change the assign statement to be:


                              <copy>
                                 <from ..... whereever ..... />
                                 <to variable="myVar" part="conversationId"/>
                               </copy>

                   

                  Regards

                  Gary

                  • 6. Re: PartnerLink with complex type problem
                    normandesjr

                    Hi,

                     

                       I tried to do that, actually the part "userName" is header  at my partnerLink. I try do something like you told me:

                     

                               <copy>
                                    <from><literal><intf2:userName>user</intf2:userName></literal></from>
                                    <to part="userName" variable="inVar"/>
                               </copy>

                     

                       And didn't work yet.

                     

                       I think that is not possible invoke a partnerLink with header variable. The examples show how to retrieve header variable that was pass to bpel. What I need is invoke with a header variable.

                     

                       Have you tested invoke a partner link with a header variable?

                     

                       Regards,

                     

                    Junior.

                    • 7. Re: PartnerLink with complex type problem
                      objectiser

                      The easiest way to demonstrate this is by editing the HelloWorld.bpel in the quickstarts/hello_world_header_wsdl, by adding this additional copy element in the assign:

                       

                                <copy>
                                    <from>concat($conversationId,'6789')</from>
                                    <to variable="myVar" part="conversationId"/>
                                </copy>

                       

                      If you then deploy the example (ant deploy), and then run the test (ant sendhello), you will see that the value of the conversation id that was present in the request (12345), has now been returned as (123456789):

                       

                      sendhello:
                           [echo] Send test message to: Quickstart_bpel_hello_world_header_wsdl
                           [java] WARN - 2010-02-12 17:06:53,599 - <org.apache.commons.httpclient.HttpMethodBase> Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
                           [java] <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header><ns:conversationId xmlns:ns='http://www.jboss.org/cid'>123456789</ns:conversationId></env:Header><env:Body><odens:helloResponse xmlns:odens='http://www.jboss.org/bpel/examples/wsdl'><TestPart>Hello World conversationId=12345</TestPart></odens:helloResponse></env:Body></env:Envelope>
                           [java]

                       


                      Let me know if this does not work for you.

                       

                      Regards

                      Gary

                      • 8. Re: PartnerLink with complex type problem
                        normandesjr

                        Hi,

                         

                           This works for me. But this is not my problem. I would like to call another webservice (third part web service) using invoke. Follow the bpel code:

                                <bpel:assign validate="no" name="assignInvoke">
                                    <copy>
                                        <from>
                                            <literal>
                                                <intf2:sendSMS>
                                                    <from xmlns="">9999999</from>
                                                    <to xmlns="">1111111</to>
                                                    <message xmlns="">textooo</message>
                                                </intf2:sendSMS>
                                            </literal>
                                        </from>
                                        <to part="sendSMS" variable="inVar"/>
                                     </copy>
                                     <copy>
                                        <from>
                                            <literal><intf2:userName>user</intf2:userName></literal>
                                         </from>
                                        <to part="userName" variable="inVar"/>
                                    </copy>
                                </bpel:assign>
                               
                                <invoke name="InvokeComponentSMS"
                                     partnerLink="componentSMSPartnerLink"
                                    portType="intf2:ComponentSMSCTBC"
                                    operation="sendSMS"
                                    inputVariable="inVar"
                                    outputVariable="outVar"/>

                         

                            Look that the inVar variable is used to a different partnerLink, not the Bpel partnerLink. I have a WebService at other server that I would like call it (using <invoke> tag) and add soap header parameter.

                         

                            Do you get my problem now?

                         

                            Thank you for you helping.

                         

                            Regards,

                         

                        Normandes Junior.

                        • 9. Re: PartnerLink with complex type problem
                          objectiser

                          Ok yes, sorry I now understand your situation. We don't have an example covering this, but I'll try it out and get back to you.

                           

                          Regards

                          Gary

                          • 10. Re: PartnerLink with complex type problem
                            objectiser

                            Looks like this is a bug. If you could raise an issue in Jira, we will try to get it fixed as soon as possible.

                             

                            Regards

                            Gary

                            • 11. Re: PartnerLink with complex type problem
                              objectiser

                              Sorry, I take that back - it is not a bug, I had just made a mistake in my example.

                               

                              I have attached the working example to demonstrate how to invoke using a header property. The instructions to run this are:

                               

                              1) When the server has been started, deploy the hello_world_header_wsdl example - this will act as the receiver of the header property (conversationId).

                               

                              2) Unpack the attached example in the samples/quickstart folder - go to the simple_invoke2 folder, and run "ant deploy".

                               

                              3) In the simple_invoke2 folder, then run "ant sendhello"

                               

                              You should see the conversation id, passed in the message in the simple_invoke2/HelloWorld.bpel invoke activity, being returned back to the ant script (value is 54321).

                               

                              Regards

                              Gary

                              • 12. Re: PartnerLink with complex type problem
                                normandesjr

                                Thanks Gary,

                                 

                                   Your example works for me. But my example not yet. I realized that your third partner link is with "RPC" as soap binding, and mine is "DOCUMENT". Do you think that this could be a problem?

                                 

                                   My third partner link is not a bpel process, is just a Web Service deployed with a war file using annotation @WebService.

                                 

                                   Regards,

                                 

                                Normandes Junior.

                                • 13. Re: PartnerLink with complex type problem
                                  normandesjr

                                  Even change my third part partner link to rpc didn't work.

                                   

                                  Could I send to you the projects for you take a look?

                                   

                                  Regards,

                                   

                                  Normandes Junior.

                                  • 14. Re: PartnerLink with complex type problem
                                    objectiser

                                    Hi

                                     

                                    Yes it would be good if you could send your example.

                                     

                                    Regards

                                    Gary

                                    1 2 Previous Next