Java 用BPEL调用简单WSDL服务

Java 用BPEL调用简单WSDL服务,java,wsdl,bpel,Java,Wsdl,Bpel,我试图在Sonic Workbench中创建一个简单的BPEL流程,它将调用我创建的WSDL Web服务。 运行进程后,我收到以下错误消息: Cannot send message to anonymous endpoint for "{http://informationservice.project.com/}InformationService" in partnerLink information 我不知道这个错误消息意味着什么,谷歌搜索也帮不上忙 谢谢 编辑: 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>
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>

我不知道Sonic,但从错误消息中我猜PartnerLink合作伙伴角色与合作伙伴EPR没有关联。在BPEL中,合作伙伴链接具有myRole部分(这是合作伙伴希望我实现并提供给合作伙伴使用的接口)和partnerRole,后者链接到合作伙伴实现的端口类型,并提供BPEL流程想要调用的操作。所有这些都是在BPEL和WSDL中定义的。对于端点的具体绑定,BPEL引擎使用部署描述符来定义EPR(具体端点,如URL,或间接端点(如标识持有EPR的端口))到合作伙伴角色的映射。我假设在您的案例中缺少此映射

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

您是否可以共享调用的代码,以及wsdlI是否根据您的代码片段更新了我的答案。如果没有帮助,请同时发布部署描述符的内容。
<?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>