我已经使用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 =&gt;消息“concat” concatResponse =&gt;消息“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>
这是我从rails洗出来的回复:
<?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>
答案 0 :(得分:0)
据我所知,像BPEL Engines这样的工具不能处理RPC编码的SOAP消息。它们只适用于Document / Literal Wrapped样式。
尝试使用WSDL的Document Wrapped样式而不是RPC,它在wash_out中默认使用。 文档包装样式意味着您只需要一个复杂的对象参数用于请求和响应。我将成为所有参数的包装器。 配置&#34;文件&#34; WSDL样式在soap_service声明中使用此代码:
soap_service namespace: 'urn:WashOut', wsdl_style: "document"
您还可以使用初始化程序为整个应用程序配置它。 有关wash_out配置选项的详细信息,请访问:
https://github.com/inossidabile/wash_out#configuration
更新: 有一个错误支持&#34;文档&#34; WSDL样式和我做了一个Pull Request来修复它:https://github.com/inossidabile/wash_out/pull/186 你可以使用我的fork,直到它已经合并。
更新:遗憾的是,我的公关不足以使文档样式起作用。我们决定为我们的项目坚持使用RPC编码(非文字)样式,而不是立即投入解决这个问题。 问题是文档样式不是这个gem的作者的主要兴趣。因此提供了文档样式,但在与标准的兼容性方面存在许多问题。