我已经使用Wash out gem在 ruby 中创建了一些 Web 服务。到目前为止,一切都很好。使用savon gem获得响应是没有问题的。但是我创建了一个 BPEL 流程并想要调用 Web 服务(它只是 BPEL)!请求没有问题,所以知道我在 ruby soap_service 中并且不知道如何响应回 BPEL 流程!?
soap_action "concat",
:args => { :concatRequest => { :a => :string, :b => :string } },
:return => { :concatResponse => { :result => :string } }
def concat
# something I want to do in ruby
puts "*******************************************************************"
puts "************************ CONCAT *******************************"
puts "*******************************************************************"
result = params[:concatRequest][:a] + params[:concatRequest][:b]
puts "RESULT: " + result
puts "*******************************************************************"
# and then send response to BPEL process
puts render :soap => ( { :concatResponse => {:result => result} } )
end
BPEL 流程仍在等待响应,没有得到响应!我希望任何人都可以帮助我:-) ...
这是我的 WSDL 文件:
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:WashOut" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="contextserver" targetNamespace="urn:WashOut">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:WashOut">
<xsd:complexType name="concatRequest">
<xsd:sequence>
<xsd:element name="a" type="xsd:string"/>
<xsd:element name="b" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="concatResponse">
<xsd:sequence>
<xsd:element name="result" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</schema>
</types>
<portType name="contextserver_port">
<operation name="concat">
<input message="tns:concat"/>
<output message="tns:concat_response"/>
</operation>
<operation name="special">
<input message="tns:special"/>
<output message="tns:special_response"/>
</operation>
</portType>
<binding name="contextserver_binding" type="tns:contextserver_port">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="concat">
<soap:operation soapAction="concat"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</output>
</operation>
<operation name="special">
<soap:operation soapAction="special"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</output>
</operation>
</binding>
<service name="service">
<port name="contextserver_port" binding="tns:contextserver_binding">
<soap:address location="http://localhost:3000/contextserver/action"/>
</port>
</service>
<message name="concat">
<part name="concatRequest" type="tns:concatRequest"/>
</message>
<message name="concat_response">
<part name="concatResponse" type="tns:concatResponse"/>
</message>
<message name="special">
<part name="b" type="xsd:string"/>
</message>
<message name="special_response">
<part name="value" type="xsd:string"/>
</message>
</definitions>
这是我在 BPEL 流程调用 Web 服务时得到的错误:
ERROR [INVOKE] Failure during invoke: Unable to process response: SOAP body does not contain expected part wrapper: service {urn:WashOut}service port contextserver_port wrapper {urn:WashOut}concatResponse
INFO [BpelRuntimeContextImpl] ActivityRecovery: Registering activity 13, failure reason: Unable to process response: SOAP body does not contain expected part wrapper: service {urn:WashOut}service port contextserver_port wrapper {urn:WashOut}concatResponse on channel 24
这是我的 BPEL 流程中的调用操作:
<bpel:invoke name="Invoke" partnerLink="contextserver" operation="concat" portType="ns1:contextserver_port" inputVariable="concatRequest" outputVariable="concatResponse"></bpel:invoke>
concatRequest => 消息“concat” concatResponse => 消息“concat_response”
更新:这是 BPEL 文件:
<!-- TestProcess BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Tue Jul 14 17:53:39 CEST 2015 -->
<bpel:process name="TestProcess"
targetNamespace="http://localhost:8080/test"
suppressJoinFailure="yes"
xmlns:tns="http://localhost:8080/test"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:ns1="urn:WashOut">
<!-- Import the client WSDL -->
<bpel:import namespace="urn:WashOut" location="concat.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import namespace="urn:WashOut" location="file:/Users/jordan/development/workflow/app/services/concat.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import location="TestProcessArtifacts.wsdl" namespace="http://localhost:8080/test" 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:TestProcess"
myRole="TestProcessProvider"
/>
<bpel:partnerLink name="contextserver" partnerLinkType="tns:ContextserverPLT" partnerRole="Concat"></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:TestProcessRequestMessage"/>
<!--
Reference to the message that will be returned to the requester
-->
<bpel:variable name="output"
messageType="tns:TestProcessResponseMessage"/>
<bpel:variable name="concatRequest" messageType="ns1:concat">
</bpel:variable>
<bpel:variable name="concatResponse" messageType="ns1:concat_response">
</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 TestProcess.wsdl
-->
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:TestProcess"
operation="process" variable="input"
createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<bpel:assign validate="no" name="Assign">
<bpel:copy ignoreMissingFromData="no" keepSrcElementName="no">
<bpel:from>
<bpel:literal xml:space="preserve"><tns:concatRequest xmlns:tns="urn:WashOut" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:a>go</tns:a>
<tns:b>go</tns:b>
</tns:concatRequest>
</bpel:literal>
</bpel:from>
<bpel:to part="concatRequest" variable="concatRequest"></bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:invoke name="Invoke" partnerLink="contextserver" operation="concat" portType="ns1:contextserver_port" inputVariable="concatRequest" outputVariable="concatResponse"></bpel:invoke>
<bpel:assign validate="no" name="Assign1">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve"><tns:concatResponse xmlns:tns="urn:WashOut" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:result>WORKS</tns:result>
</tns:concatResponse>
</bpel:literal>
</bpel:from>
<bpel:to part="payload" variable="output"></bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="replyOutput" partnerLink="client" portType="tns:TestProcess" operation="process" variable="output" />
</bpel:sequence>
</bpel:process>
这是我从 railswash out 得到的回复:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:WashOut">
<soap:Body>
<tns:concat_response>
<concatResponse xsi:type="tns:concatResponse">
<result xsi:type="xsd:string">gogo</result>
</concatResponse>
</tns:concat_response>
</soap:Body>
</soap:Envelope>