[Users] How to use Petals Studio to provide a REST service ?
seb.wytt
sebastien.trivella at veoliaeau.fr
Wed Mar 16 10:55:48 CET 2011
Hello,
I'm also trying to use BC6SOAP for REST interactions.
The service I try to provide inside the bus is in XML/HTTP: it takes a HTTP request with XML content in the body and returns HTTP response with XML content in the response.
While sending this request:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<submitRequests service="businessService" mode="ignoreErrorsOrFails">
<requests>
<!-- REQUEST -->
</requests>
</submitRequests>
I should get the following response:
Code:
<?xml version='1.0' encoding='ISO-8859-1'?><submitRequestsResponse id="AutoGeneratedId_1270215618477" status="success"><responses /></submitRequestsResponse>
I tried configuring the BC-SOAP to do so. Here the jbi.xml of my SU-SOAP:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
JBI descriptor for the Petals' "petals-bc-soap" component (SOAP).
Originally created for the version 4.0 of the component.
-->
<jbi:jbi version="1.0"
xmlns:interfaceNs="http://mycpy.ban.com/esb/rest/wsdl/v01"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:serviceNs="http://mycpy.ban.com/esb/rest/wsdl/v01"
xmlns:soap="http://petals.ow2.org/components/soap/version-4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Import a Service into Petals or Expose a Petals Service => use a BC. -->
<jbi:services binding-component="true">
<!-- Import a Service into Petals => provides a Service. -->
<jbi:provides
interface-name="interfaceNs:RESTservicesItf"
service-name="serviceNs:RESTservices"
endpoint-name="RESTservices-soap11http">
<!-- CDK specific elements -->
<petalsCDK:wsdl>RESTservices_01.wsdl</petalsCDK:wsdl>
<petalsCDK:mep xsi:nil="true"/>
<!-- Component specific elements -->
<soap:mode>REST</soap:mode>
<soap:rest-http-method>POST</soap:rest-http-method>
<soap:address>http://172.20.222.204/opt-ffa-connector-services/submit</soap:address>
</jbi:provides>
</jbi:services>
</jbi:jbi>
After that I deployed my SU and tried to send the XML request provided above to the jbi endpoint with the sample client.
I got the following error:
> [Petals.Container.Components.petals-sample-client]-INFO 2010-04-12 12:41:13,719 SampleClient try to send
> [Petals.Container.Components.petals-sample-client]-FINEST 2010-04-12 12:41:13,719 Message in with Id 'petals:uid:1F34CB2D36CD2FC1792488284218285830' to send
> [Petals.Container.Components.petals-sample-client]-FINEST 2010-04-12 12:41:13,720 Message property 'javax.jbi.messaging.protocol.headers' : {}
> [Petals.Container.Components.petals-sample-client]-FINEST 2010-04-12 12:41:13,721 Message Content : <?xml version="1.0" encoding="UTF-8"?><submitRequests service="businessService" mode="ignoreErrorsOrFails">
> <requests>
> <!-- REQUEST -->
> </requests>
> </submitRequests>
> [Petals.Container.Components.petals-bc-soap]-FINE 2010-04-12 12:41:13,722 Accepting a JBI message with Id : petals:uid:1F34CB2D36CD2FC1792488284218285830
> [Petals.Container.Components.petals-bc-soap]-FINEST 2010-04-12 12:41:13,722 Process an exchange as PROVIDER with id : petals:uid:1F34CB2D36CD2FC1792488284218285830
> [Petals.Container.Components.petals-bc-soap]-FINE 2010-04-12 12:41:13,722 Intercepting message processing on ACCEPT
> [Petals.Container.Components.petals-bc-soap]-FINE 2010-04-12 12:41:13,723 JBI message received on SOAP JBI listener
> [Petals.Container.Components.petals-bc-soap]-WARNING 2010-04-12 12:41:13,723 Can not define the REST service address to send message to
> [Petals.Container.Components.petals-bc-soap]-FINE 2010-04-12 12:41:13,724 Intercepting message processing on ACCEPT_RESPONSE
> [Petals.Container.Components.petals-bc-soap]-FINEST 2010-04-12 12:41:13,724 Message Fault with Id 'petals:uid:1F34CB2D36CD2FC1792488284218285830' to send
> [Petals.Container.Components.petals-bc-soap]-FINEST 2010-04-12 12:41:13,724 Message Content : <?xml version="1.0" encoding="UTF-8" standalone="no"?><soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soapenv:Server</faultcode><faultstring><![CDATA[BC-SOAP Exception => Can not define the REST service address to send message to]]></faultstring><faultactor>http://petals.ow2.org/exception</faultactor><detail><stackTrace><![CDATA[org.ow2.petals.component.framework.api.exception.SOAP11FaultServerException: BC-SOAP Exception => Can not define the REST service address to send message to
> at org.ow2.petals.component.framework.process.MessageExchangeProcessor.processInOutAsProvider(MessageExchangeProcessor.java:659)
> at org.ow2.petals.component.framework.process.MessageExchangeProcessor.processAsProvider(MessageExchangeProcessor.java:379)
> at org.ow2.petals.component.framework.process.MessageExchangeProcessor.process(MessageExchangeProcessor.java:242)
> at org.ow2.petals.component.framework.process.MessageExchangeProcessor.run(MessageExchangeProcessor.java:176)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> ]]></stackTrace></detail></soapenv:Fault>
> [Petals.Container.Components.petals-sample-client]-INFO 2010-04-12 12:41:13,734 Processing received message petals:uid:1F34CB2D36CD2FC1792488284218285830
> [Petals.Container.Components.petals-sample-client]-FINEST 2010-04-12 12:41:13,735 Message acknowledgement DONE with Id 'petals:uid:1F34CB2D36CD2FC1792488284218285830' to send
> [Petals.Container.Components.petals-bc-soap]-FINE 2010-04-12 12:41:13,736 Accepting a JBI message with Id : petals:uid:1F34CB2D36CD2FC1792488284218285830
I got the same error whatever I tried:
changing the method: get/post
changing the WSDL :
I first use no WSDL :
Code:
<petalsCDK:mep xsi:nil="true"/>
I then use the following generic WSDL:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
name="RESTservices"
targetNamespace="http://mycpy.ban.com/esb/rest/wsdl/v01"
xmlns:tns="http://mycpy.ban.com/esb/rest/wsdl/v01"
xmlns:obj="http://mycpy.ban.com/esb/rest/obj/v01"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<!-- version -->
<xsd:annotation>
<xsd:documentation>RESTservices 01.01</xsd:documentation>
</xsd:annotation>
<!-- TYPES & MESSAGES -->
<wsdl:types>
<xsd:schema targetNamespace="http://mycpy.ban.com/esb/rest/obj/v01">
<xsd:complexType name="AnyType">
<xsd:sequence>
<xsd:element name="content" type="xsd:anyType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ANY" type="obj:AnyType"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="anyReqMsg">
<wsdl:part element="obj:ANY" name="part1" />
</wsdl:message>
<wsdl:message name="anyResMsg">
<wsdl:part element="obj:ANY" name="part1" />
</wsdl:message>
<!-- INTERFACE -->
<wsdl:portType name="RESTservicesItf">
<wsdl:operation name="get">
<wsdl:input message="tns:anyReqMsg" />
<wsdl:output message="tns:anyReqMsg" />
</wsdl:operation>
<wsdl:operation name="post">
<wsdl:input message="tns:anyReqMsg" />
<wsdl:output message="tns:anyReqMsg" />
</wsdl:operation>
<wsdl:operation name="put">
<wsdl:input message="tns:anyReqMsg" />
<wsdl:output message="tns:anyReqMsg" />
</wsdl:operation>
<wsdl:operation name="delete">
<wsdl:input message="tns:anyReqMsg" />
<wsdl:output message="tns:anyReqMsg" />
</wsdl:operation>
</wsdl:portType>
<!-- BINDING -->
<wsdl:binding name="RESTservices-soap11httpBdg" type="tns:RESTservicesItf">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="get">
<soap:operation
soapAction="http://mycpy.ban.com/esb/rest/wsdl/v01/RESTservices/get" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="post">
<soap:operation
soapAction="http://mycpy.ban.com/esb/rest/wsdl/v01/RESTservices/post" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="put">
<soap:operation
soapAction="http://mycpy.ban.com/esb/rest/wsdl/v01/RESTservices/put" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="delete">
<soap:operation
soapAction="http://mycpy.ban.com/esb/rest/wsdl/v01/RESTservices/delete" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="RESTservices">
<wsdl:port name="RESTservices-soap11http" binding="tns:RESTservices-soap11httpBdg">
<soap:address location="ENDPOINT_TO_SET_UP" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Can someone please tell me how I could handle this specific XML/HTTP service?
Thank you very much,
Regards,
Seb!
-------------------- m2f --------------------
Subscribe/Unsubscribe emails notifications.
Response to this email will be posted on the Petals forum.
Please delete the existing text before responding :)
Read the topic online:
http://forum.petalslink.com/viewtopic.php?p=30770#30770
-------------------- m2f --------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://forum-list.petalslink.org/pipermail/users/attachments/20110316/35821c92/attachment.htm>
More information about the Users
mailing list