我尝试从bpel进程调用一个简单的Web服务(基于Metro堆栈,部署在Tomcat 7上),我遇到了问题。
当我使用soapui或其他类似工具测试此Web服务时,一切正常。所以Web服务还可以。我认为这个小礼物也是正确的。
bpel进程在bpel-g中运行,它也部署在同一个tomcat服务器上。所以我的问题是,如果可以从bpel-g引擎(构建uppon cfx堆栈)调用(Metro)Web服务。
如果它不可能,我应该建立我的web服务uppon apache cxf,它会起作用吗?
编辑: 所以,正如我所说,Web服务在tomcat 7服务器上的metro堆栈上运行。 bpel-g-5.3部署在另一台tomcat服务器上。当我尝试从进程中调用Web服务时,我得到以下stacktrace:
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之间存在一些兼容性问题。