使用BPEL调用简单的WSDL服务

时间:2012-01-09 13:06:34

标签: java wsdl bpel

我正在尝试在Sonic Workbench中创建一个简单的BPEL流程,它将调用我创建的WSDL Web服务。 运行该过程后,我收到此错误消息:

Cannot send message to anonymous endpoint for "{http://informationservice.project.com/}InformationService" in partnerLink information

我不知道这个错误消息是什么意思,谷歌搜索没有帮助。

由于

编辑: BPEL代码:

<?xml version="1.0" encoding="UTF-8"?>
<process expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0" name="testB" queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0" targetNamespace="urn:bpel:testB" xml:ID="1"
  xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
  xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
  xmlns:plk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
  xmlns:psbx="urn:parasoft:bpel:extension" xmlns:tns="urn:bpel:testB"
  xmlns:tns0="http://informationservice.project.com/"
  xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <import importType="http://schemas.xmlsoap.org/wsdl/"
    location="information.wsdl" namespace="http://informationservice.project.com/"/>
  <import importType="http://schemas.xmlsoap.org/wsdl/"
    location="testB.wsdl" namespace="urn:bpel:testB"/>
  <partnerLinks>
    <partnerLink initializePartnerRole="no" name="information"
      partnerLinkType="tns0:InformationService" partnerRole="InformationService"/>
    <partnerLink myRole="testB" name="testB" partnerLinkType="tns:testB"/>
  </partnerLinks>
  <variables>
    <variable messageType="tns0:getAirportsForCity" name="input"/>
    <variable messageType="tns:testBRequest" name="testBRequest"/>
    <variable messageType="tns:testBResponse" name="testBResponse"/>
    <variable messageType="tns0:getAirportsForCityResponse" name="output"/>
  </variables>
  <sequence xml:ID="2">
    <receive createInstance="yes" name="testB" operation="testB"
        partnerLink="testB" portType="tns:testBPortType"
        variable="testBRequest" xml:ID="3"/>
    <assign xml:ID="7">
      <copy xmlns:psbx="urn:parasoft:bpel:extension">
            <from>
                <literal>
                    <ns1:getAirportsForCity xmlns="" xmlns:ns1="http://informationservice.project.com/">
                        <city/>
                    </ns1:getAirportsForCity>
                </literal>
            </from>
            <to part="parameters" variable="input"/>
        </copy>
        <copy xmlns:psbx="urn:parasoft:bpel:extension">
            <from part="parameters" variable="testBRequest">
                <query>/child::node()[local-name()='testB']/child::node()[local-name()='city']</query>
            </from>
            <to part="parameters" variable="input">
                <query>/child::node()[local-name()='getAirportsForCity']/child::node()[local-name()='city']</query>
            </to>
        </copy>
      </assign>
      <invoke inputVariable="input" operation="getAirportsForCity"
          outputVariable="output" partnerLink="information"
          portType="tns0:InformationService" xml:ID="6"/>
      <assign xml:ID="4">
        <copy>
            <from>
                <literal>
                    <ns1:testBResponse xmlns=""
                        xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:ns1="urn:bpel:testB">
                        <airport/>
                    </ns1:testBResponse>
                </literal>
            </from>
            <to part="parameters" variable="testBResponse"/>
        </copy>
        <copy xmlns:psbx="urn:parasoft:bpel:extension">
            <from part="parameters" variable="output">
                <query>/child::node()[local-name()='getAirportsForCityResponse']/child::node()[local-name()='return']</query>
            </from>
            <to part="parameters" variable="testBResponse">
                <query>/child::node()[local-name()='testBResponse']/child::node()[local-name()='airport']</query>
            </to>
        </copy>
      </assign>
      <reply name="testB" operation="testB" partnerLink="testB"
        portType="tns:testBPortType" variable="testBResponse" xml:ID="5"/>
  </sequence>
</process>

当我将initializePartnerRole更改为yes时,我遇到了不同的错误:

No endpoint specified to initialize partner role for partnerLink information

information.wsdl代码:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="InformationService"
  targetNamespace="http://informationservice.project.com/" xmlns=""
  xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
  xmlns:ns2="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://informationservice.project.com/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ns2:partnerLinkType name="InformationService">
    <ns2:role name="InformationService" portType="tns:InformationService"/>
</ns2:partnerLinkType>
<wsdl:types>
    <xs:schema
        targetNamespace="http://informationservice.project.com/"
        version="1.0"
        xmlns:tns="http://informationservice.project.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="getAirportsForCity">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="city" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="getAirportsForCityResponse">
            <xs:complexType>
                <xs:sequence>
                    <xs:element maxOccurs="unbounded" minOccurs="0"
                        name="return" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="getCities" type="tns:getCities"/>
        <xs:element name="getCitiesResponse" type="tns:getCitiesResponse"/>
        <xs:complexType name="getCities">
            <xs:sequence/>
        </xs:complexType>
        <xs:complexType name="getCitiesResponse">
            <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0"
                    name="return" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:schema>
</wsdl:types>
<wsdl:message name="getCities">
    <wsdl:part element="tns:getCities" name="parameters"/>
</wsdl:message>
<wsdl:message name="getCitiesResponse">
    <wsdl:part element="tns:getCitiesResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getAirportsForCityResponse">
    <wsdl:part element="tns:getAirportsForCityResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getAirportsForCity">
    <wsdl:part element="tns:getAirportsForCity" name="parameters"/>
</wsdl:message>
<wsdl:portType name="InformationService">
    <wsdl:operation name="getCities">
        <wsdl:input message="tns:getCities" name="getCities"/>
        <wsdl:output message="tns:getCitiesResponse" name="getCitiesResponse"/>
    </wsdl:operation>
    <wsdl:operation name="getAirportsForCity">
        <wsdl:input message="tns:getAirportsForCity" name="getAirportsForCity"/>
        <wsdl:output message="tns:getAirportsForCityResponse" name="getAirportsForCityResponse"/>
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="InformationServiceSoapBinding" type="tns:InformationService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getCities">
        <soap:operation soapAction="" style="document"/>
        <wsdl:input name="getCities">
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="getCitiesResponse">
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getAirportsForCity">
        <soap:operation soapAction="" style="document"/>
        <wsdl:input name="getAirportsForCity">
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="getAirportsForCityResponse">
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="InformationService">
    <wsdl:port binding="tns:InformationServiceSoapBinding" name="InformationServiceEndpoint">
        <soap:address location="http://localhost:9002/information"/>
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>

1 个答案:

答案 0 :(得分:1)

我不知道Sonic,但是从错误消息中我猜测partnerlinks合作伙伴角色与合作伙伴EPR无关。在BPEL中,合作伙伴链接有一个myRole部分(合作伙伴希望我实现并提供供合作伙伴使用的接口)和partnerRole,它链接到合作伙伴实现的portType并提供操作BPEL流程想要调用。所有这些东西都在BPEL和WSDL中定义。对于端点的具体绑定,BPEL引擎使用部署描述符来定义EPR(具体端点,例如URL或间接端点(例如,识别保存EPR的端口)到伙伴角色的映射。我假设您的情况下缺少此映射。

修改 在您的代码段中,partnerlink的initializePartnerRole属性设置为no,这意味着BPEL处理器在首次使用之前不得初始化合作伙伴角色的EPR。这可能会导致您的问题。您可以将其设置为yes以强制引擎初始化EPR或省略属性以将决策留给引擎。有关更多详细信息,请参阅BPEL 2.0规范中的6.2节。