我试图从 bpel 进程调用一个简单的 Web 服务(基于 Metro 堆栈,部署在 Tomcat 7 上),但我遇到了问题。
当我使用soapui 或其他类似工具测试此Web 服务时,一切正常。所以网络服务没问题。我认为bpel也是正确的。
bpel 进程运行在 bpel-g 中,也部署在同一个 tomcat 服务器上。所以我的问题是,是否可以从 bpel-g 引擎(基于 cfx 堆栈构建)调用(Metro)Web 服务。
如果不可能,我是否应该在 apache cxf 上构建我的 Web 服务,它会起作用吗?
编辑:所以,正如我所说,Web 服务在 tomcat 7 服务器的 Metro 堆栈上运行。bpel-g-5.3 部署在另一个 tomcat 服务器上。当我尝试从该进程调用 Web 服务时,我得到以下堆栈跟踪:
org.activebpel.rt.AeException logError SEVERE: no protocol:
java.net.MalformedURLException: no protocol:
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.activebpel.rt.axis.bpel.AeAxisInvokeHandler.setTargetAddress (AeAxisInvokeHandler.java:334)
org.activebpel.rt.axis.bpel.AeAxisInvokeHandler.createCall (AeAxisInvokeHandler.java:177)
...
我的bpel流程:
<!-- SampleProcessFile BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Fri Mar 01 17:47:28 CET 2013 -->
<bpel:process name="SampleProcessFile"
targetNamespace="http://Sample"
suppressJoinFailure="yes"
xmlns:tns="http://Sample"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:ns="http://server/">
<!-- Import the client WSDL -->
<bpel:import namespace="http://server/" location="http://localhost:8080/WebApplication10/NewWebService?wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import location="SampleProcessFileArtifacts.wsdl" namespace="http://Sample"
importType="http://schemas.xmlsoap.org/wsdl/" />
<!-- ================================================================= -->
<!-- PARTNERLINKS -->
<!-- List of services participating in this BPEL process -->
<!-- ================================================================= -->
<bpel:partnerLinks>
<!-- The 'client' role represents the requester of this service. -->
<bpel:partnerLink name="client"
partnerLinkType="tns:SampleProcessFile"
myRole="SampleProcessFileProvider"
/>
<bpel:partnerLink name="SamplePL" partnerLinkType="tns:SamplePLT" partnerRole="InBound"></bpel:partnerLink>
</bpel:partnerLinks>
<!-- ================================================================= -->
<!-- VARIABLES -->
<!-- List of messages and XML documents used within this BPEL process -->
<!-- ================================================================= -->
<bpel:variables>
<!-- Reference to the message passed as input during initiation -->
<bpel:variable name="input"
messageType="tns:SampleProcessFileRequestMessage"/>
<!--
Reference to the message that will be returned to the requester
-->
<bpel:variable name="output"
messageType="tns:SampleProcessFileResponseMessage"/>
<bpel:variable name="SamplePLResponse" messageType="ns:helloResponse"></bpel:variable>
<bpel:variable name="SamplePLRequest" messageType="ns:hello"></bpel:variable>
</bpel:variables>
<!-- ================================================================= -->
<!-- ORCHESTRATION LOGIC -->
<!-- Set of activities coordinating the flow of messages across the -->
<!-- services integrated within this business process -->
<!-- ================================================================= -->
<bpel:sequence name="main">
<!-- Receive input from requester.
Note: This maps to operation defined in SampleProcessFile.wsdl
-->
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:SampleProcessFile"
operation="process" variable="input"
createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<bpel:assign validate="no" name="Assign">
<bpel:copy>
<bpel:from><bpel:literal><tns:hello xmlns:tns="http://server/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>name</name>
</tns:hello>
</bpel:literal></bpel:from>
<bpel:to variable="SamplePLRequest" part="parameters"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from part="payload" variable="input">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]></bpel:query>
</bpel:from>
<bpel:to part="parameters" variable="SamplePLRequest">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[name]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:invoke name="Invoke" partnerLink="SamplePL" operation="hello" portType="ns:NewWebService" inputVariable="SamplePLRequest" outputVariable="SamplePLResponse"></bpel:invoke>
<bpel:assign validate="no" name="Assign1">
<bpel:copy>
<bpel:from><bpel:literal><tns:SampleProcessFileResponse xmlns:tns="http://Sample" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:result>tns:result</tns:result>
</tns:SampleProcessFileResponse>
</bpel:literal></bpel:from>
<bpel:to variable="output" part="payload"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from part="parameters" variable="SamplePLResponse">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[return]]></bpel:query>
</bpel:from>
<bpel:to part="payload" variable="output">
<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="replyOutput"
partnerLink="client"
portType="tns:SampleProcessFile"
operation="process"
variable="output"
/>
</bpel:sequence>
</bpel:process>
最后是 Web 服务的 wsdl:
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-740-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-740-. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://server/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server/" name="NewWebService">
<types>
<xsd:schema>
<xsd:import namespace="http://server/" schemaLocation="http://localhost:8080/WebApplication10/NewWebService?xsd=1" />
</xsd:schema>
</types>
<message name="hello">
<part name="parameters" element="tns:hello" />
</message>
<message name="helloResponse">
<part name="parameters" element="tns:helloResponse" />
</message>
<portType name="NewWebService">
<operation name="hello">
<input wsam:Action="http://server/NewWebService/helloRequest" message="tns:hello" />
<output wsam:Action="http://server/NewWebService/helloResponse" message="tns:helloResponse" />
</operation>
</portType>
<binding name="NewWebServicePortBinding" type="tns:NewWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="hello">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="NewWebService">
<port name="NewWebServicePort" binding="tns:NewWebServicePortBinding">
<soap:address location="http://localhost:8080/WebApplication10/NewWebService" />
</port>
</service>
</definitions>
EDIT2:我尝试了相同的 bpel 进程,在 jboss 应用服务器上使用 riftsaw(基于 ODE 构建)和 cxf 堆栈及其工作调用相同的 Web 服务,因此进程和服务是正确的。我猜bpel-g 和metro 之间存在一些兼容性问题。