1 Reply Latest reply on Nov 18, 2013 1:01 PM by rcernich

    External service reference in a BPEL service

    ghostavo

      I have a BPEL service that was adapted from one of the quickstarts that invokes an external service.

       

      However, when I try to execute this BPEL service, according to the switchyard debug log he can't find the referenced service, which I assume means I'm refering to it incorrectly.

       

      The specific log message:

      ERROR [org.switchyard.component.bpel.riftsaw.RiftsawServiceLocator] (ODEServer-1) No service found for '{urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT}SendMail'
      
      
      
      
      

       

      The deploy.xml file:

      <deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
          xmlns:examples="http://www.jboss.org/bpel/examples"
              xmlns:domain="urn:switchyard-quickstart:bpel-say-hello:0.1.0"
          xmlns:tns="urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT">
      
          <process name="examples:SayHello">
              <active>true</active>
              <process-events generate="all"/>
              <provide partnerLink="client">
                  <service name="domain:SayHelloService" port="ignored"/>
              </provide>
      
              <invoke  partnerLink="SendMailPL" usePeer2Peer="false">
                      <service name="tns:SendMail" port="ignored"/>
                  </invoke>
          </process>
      </deploy>
      
      
      
      
      

       

      The bpel file:

      <bpel:process name="SayHello" targetNamespace="http://www.jboss.org/bpel/examples" suppressJoinFailure="yes" xmlns:tns="http://www.jboss.org/bpel/examples" xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:aac="urn:pt.it.av.atnog.Apollo:GreenHouseServices:1.0" xmlns:aad="urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT" >
      
       <bpel:import location="SayHelloArtifacts.wsdl" namespace="http://www.jboss.org/bpel/examples"  importType="http://schemas.xmlsoap.org/wsdl/" />
       <bpel:import location="SendMail.wsdl" namespace="urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT" importType="http://schemas.xmlsoap.org/wsdl/" />
      
      <bpel:partnerLinks>
        <bpel:partnerLink name="client" partnerLinkType="tns:SayHello" myRole="SayHelloProvider" />
        <bpel:partnerLink name="SendMailPL" partnerLinkType="aad:SendEmailPartnerLT" partnerRole="SendMail" />
      </bpel:partnerLinks>
      <bpel:variables>
        <bpel:variable name="ReceiveSayHelloVar" messageType="tns:SayHelloRequestMessage"/>
        <bpel:variable name="ReplySayHelloVar" messageType="tns:SayHelloResponseMessage"/>
      
        <bpel:variable name="SendMailInput" messageType="aad:email"/>
        <bpel:variable name="SendMailOutput" messageType="aad:reply"/>
      </bpel:variables>
      
      <bpel:sequence name="main">
        <bpel:receive name="ReceiveSayHello" partnerLink="client" portType="tns:SayHello" operation="sayHello" variable="ReceiveSayHelloVar" createInstance="yes"/>
        <bpel:assign validate="no" name="AssignName">
         <bpel:copy>
          <bpel:from>
           <bpel:literal>
            <tns:HelloWorldResponse xmlns:tns="http://www.jboss.org/bpel/examples" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
             <tns:result/>
            </tns:HelloWorldResponse>
           </bpel:literal>
          </bpel:from>
          <bpel:to variable="ReplySayHelloVar" part="parameters"/>
         </bpel:copy>
         <bpel:copy>
          <bpel:from>
           <![CDATA[concat('Hello ', $ReceiveSayHelloVar.parameters/tns:input)]]>
          </bpel:from>
          <bpel:to part="parameters" variable="ReplySayHelloVar">
           <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
            <![CDATA[tns:result]]>
           </bpel:query>
          </bpel:to>
         </bpel:copy>
        </bpel:assign>
        <bpel:reply name="ReplySayHello"  partnerLink="client" portType="tns:SayHello" operation="sayHello"  variable="ReplySayHelloVar" />
      
        <bpel:assign validate="no" name="AssignMail">
         <bpel:copy>
          <bpel:from>
           <bpel:literal>
            <email xmlns="urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT" >
              <to xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="xsd:string">gmpp@av.it.pt</to>
              <topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="xsd:string">topic</topic>
              <content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="xsd:string">content</content>
            </email>
           </bpel:literal>
          </bpel:from>
          <bpel:to variable="SendMailInput" part="parameters" />
         </bpel:copy>
        </bpel:assign>
        <bpel:invoke partnerLink="SendMailPL" portType="SendMailPortType" operation="sendMail" inputVariable="SendMailInput" outputVariable="SendMailOutput"/>
      </bpel:sequence>
      </bpel:process>
      
      
      
      
      
      
      

       

      The switchyard.xml file:

      <?xml version="1.0" encoding="UTF-8"?>
      <switchyard xmlns="urn:switchyard-config:switchyard:1.0"
                   xmlns:swyd="urn:switchyard-config:switchyard:1.0"
                   xmlns:trfm="urn:switchyard-config:transform:1.0"
                   xmlns:bean="urn:switchyard-component-bean:config:1.0"
                   xmlns:bpel="http://docs.oasis-open.org/ns/opencsa/sca/200912"
                   xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
                   xmlns:sh="http://www.jboss.org/bpel/examples"
                   targetNamespace="urn:switchyard-quickstart:bpel-say-hello:0.1.0"
                   name="sayhello">
       <sca:composite name="sayhello" targetNamespace="urn:switchyard-quickstart:bpel-say-hello:0.1.0">
        <sca:service name="SayHelloService" promote="SayHelloService">
         <binding.soap xmlns="urn:switchyard-component-soap:config:1.0">
          <wsdl>SayHelloArtifacts.wsdl</wsdl>
          <socketAddr>:18001</socketAddr>
         </binding.soap>
        </sca:service>
        <sca:reference name="SendMail" multiplicity="1..1" promote="SendMailBean/SendMail">
         <binding.soap xmlns="urn:switchyard-component-soap:config:1.0">
          <wsdl>SendMail.wsdl</wsdl>
         </binding.soap>
        </sca:reference>
        <sca:component name="SayHelloService">
         <bpel:implementation.bpel xmlns:sh="http://www.jboss.org/bpel/examples" process="sh:SayHello" />
         <sca:service name="SayHelloService">
          <sca:interface.wsdl interface="SayHelloArtifacts.wsdl#wsdl.porttype(SayHello)"/>
         </sca:service>
         <sca:reference name="SendMail">
          <sca:interface.wsdl interface="SendMail.wsdl#wsdl.porttype(SendMailPortType)"/>
         </sca:reference>
        </sca:component>
       </sca:composite>
      </switchyard>
      
      
      
      
      

       

      and the WSDL files for the BPEL service and the invoked service respectively:

      <?xml version="1.0"?>
      <definitions name="SayHello"
              targetNamespace="http://www.jboss.org/bpel/examples"
              xmlns:tns="http://www.jboss.org/bpel/examples"
              xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
              xmlns="http://schemas.xmlsoap.org/wsdl/"
              xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
      
          <types>
              <schema attributeFormDefault="unqualified" elementFormDefault="qualified"
                      targetNamespace="http://www.jboss.org/bpel/examples" 
                      xmlns="http://www.w3.org/2001/XMLSchema">
      
              <element name="sayHello">
                  <complexType>
                      <sequence>
                          <element name="input" type="string" />
                       </sequence>
                  </complexType>
              </element>
           
              <element name="sayHelloResponse">
                  <complexType>
                      <sequence>
                          <element name="results" type="string"/>
                       </sequence>
                  </complexType>
              </element>
               </schema>
          </types>
      
          <message name="SayHelloRequestMessage">
              <part name="parameters" element="tns:sayHello"/>
          </message>
          <message name="SayHelloResponseMessage">
              <part name="parameters" element="tns:sayHelloResponse"/>
          </message>
      
          <portType name="SayHello">
              <operation name="sayHello">
                  <input  message="tns:SayHelloRequestMessage" />
                  <output message="tns:SayHelloResponseMessage"/>
              </operation>
          </portType>
      
          <plnk:partnerLinkType name="SayHello">
              <plnk:role name="SayHelloProvider" portType="tns:SayHello"/>
          </plnk:partnerLinkType>
      
          <binding name="SayHelloBinding" type="tns:SayHello">
           <soap:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http" />
           <operation name="sayHello">
            <soap:operation
             soapAction="http://www.jboss.org/bpel/examples/sayHello" />
            <input>
             <soap:body use="literal" />
            </input>
            <output>
             <soap:body use="literal" />
            </output>
           </operation>
          </binding>
          <service name="SayHelloService">
           <port name="SayHelloPort" binding="tns:SayHelloBinding">
            <soap:address location="http://localhost:8080/SayHelloProcess" />
           </port>
          </service>
      </definitions>
      
      
      
      
      
      
      

       

      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT">
        <types>
      <schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:pt.it.av.atnog.apollo:mail:1.0.0-SNAPSHOT">
         <element name="email">
            <complexType>
               <sequence>
            <choice maxOccurs="unbounded" minOccurs="1">
             <element name="to" type="xsd:string"/>
            </choice>
            <element name="topic" type="xsd:string"/>
            <element name="content" type="xsd:string"/>
           </sequence>
            </complexType>
           </element>
           
           <element name="reply" type="xsd:boolean"/>
        </schema>
        </types>
        <message name="email">
          <part element="tns:email" name="parameters">
          </part>
        </message>
        <message name="reply">
          <part element="tns:reply" name="parameters">
          </part>
        </message>
        <portType name="SendMailPortType">
          <operation name="sendMail">
            <input message="tns:email" name="email">
          </input>
            <output message="tns:reply" name="reply">
          </output>
          </operation>
        </portType>
        <binding name="SendMailSoapBinding" type="tns:SendMailPortType">
          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
          <operation name="sendMail">
            <soap:operation soapAction="sendMail" style="document"/>
            <input name="email">
              <soap:body use="encoded"/>
            </input>
            <output name="reply">
              <soap:body use="literal"/>
            </output>
          </operation>
        </binding>
        <service name="SendMail">
          <port binding="tns:SendMailSoapBinding" name="SendMailPort">
            <soap:address location="http://yard.aws.atnog.av.it.pt/SendMail/SendMail"/>
          </port>
        </service>
          <plnk:partnerLinkType name="SendEmailPartnerLT">
            <plnk:role name="SendMail" portType="tns:SendMailPortType"/>
         </plnk:partnerLinkType>
      </definitions>
      
      
      
      
      

       

      Attached are the BPEL service files, there are commented sections and an extra file for another service I want to invoke, but that I didn't want to use while I couldn't invoke this one

        • 1. Re: External service reference in a BPEL service
          rcernich

          Hey Gustavo,

           

          I think the issue is with the namespace used in the invoke section of your deploy.xml.  I think you want domain:SendMail, not tns:SendMail.  This will cause SwitchYard to route the request through the SendMail reference configured in your switchyard.xml.

           

          Hope that helps,

          Rob