I've used the Wash out gem to create some web services in ruby. So far so good. With savon gem it's no problem to get a response. But I create a BPEL process and want to invoke the web service (it's just BPEL)! The request is no problem, so know I'm in the ruby soap_service and don't know how to response back to the BPEL process!?
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
The BPEL process is still waiting for a response and didn't get it! I hope anyone can help me :-) ...
and here is my WSDL file:
<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>
Here is the ERROR I get when the BPEL Process invokes the web service:
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
This is my invoke action in my BPEL process:
<bpel:invoke name="Invoke" partnerLink="contextserver" operation="concat" portType="ns1:contextserver_port" inputVariable="concatRequest" outputVariable="concatResponse"></bpel:invoke>
concatRequest => Message "concat" concatResponse => Message "concat_response"
UPDATE: Here is the BPEL file:
<!-- 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>
This is the response I get back from rails wash 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>
As far as I know, tools like BPEL Engines don't work with RPC encoded SOAP messages. They work only with Document/Literal Wrapped style ones.
Try to use Document Wrapped style of WSDL instead of RPC, which is used by default in wash_out. Document Wrapped style means that you are to use only one complex object parameter for request and for response. I will be a wrapper for all your parameters. To configure "document" WSDL style use this code in soap_service declaration:
You can also configure it for the whole application with initializer. Details of wash_out configuration options are here:
https://github.com/inossidabile/wash_out#configuration
Update: There is a bug in support of "document" WSDL style and I made a Pull Request which fixes it: https://github.com/inossidabile/wash_out/pull/186 You can use my fork, until it will have merged.
Update: unfortunately, my PR is not enough to make document style to work. We decided to stick with RPC Encoded (not literal) style for our project and not invest into fixing this problem now. The problem is that document style is not the main interest for the author of this gem. So document style was contributed, but have many problems with compatibility with standards.