Petals-BC-SOAP

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (8)

View Page History
_More information about Jetty tunning can be found on the Jetty documentation._




h1. Service Configuration

h3. Consume mode : Expose JBI Service as as REST Service

todo {code:lang=xml}
<jbi:jbi version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
xmlns:helloworld="http://petals.ow2.org/helloworld"
xmlns:soap="http://petals.ow2.org/components/soap/version-3.1">
<!-- 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:consumes interface-name="helloworld:Helloworld" service-name="helloworld:HelloworldService"
endpoint-name="HelloworldEndpoint">

<!-- CDK specific fields -->
<petalsCDK:mep>InOut</petalsCDK:mep>
<petalsCDK:operation>getXXX</petalsCDK:operation>

<!-- SOAP specific fields -->
<soap:address>RESTServiceName</soap:address>
<soap:mode>REST</soap:mode>
<soap:rest-add-namespace-uri>http://petals.ow2.org/soapbc</soap:rest-add-namespace-uri>
<soap:rest-add-namespace-prefix>ns1</soap:rest-add-namespace-prefix>
<soap:rest-remove-prefix-on-response>*</soap:rest-remove-prefix-on-response>
</jbi:consumes>
</jbi:services>
</jbi:jbi>
{code}

h2. Samples
* The {{address}} parameter is used to create the Axis2 WebService that will be accessible from outside of the JBI environment. This is the same mechanism as for the standard WebService created without REST mode.
* The {{mode}} parameter value set to REST enable REST feature on the newly created WebService. Without this parameter, the REST mode is unactive.
* The {{rest-add-namespace-uri}} parameter is used to add a namespace to the generated JBI message.
* The {{rest-add-namespace-prefix}} parameter is used to specify the prefix to be used for the namespace specified by the rest.add-namespace-uri parameter. Default value is petalsbcsoaprest.
* The {{rest-remove-prefix-on-response}} is used to specify the prefix namespaces to be removed on message response. The values have to be specified in Coma Separated Value format like 'ns1,ns2'. The special value '*' is used to remove all the namespaces.

todo
The component will create a JBI message depending on the http-method used in the incoming request :
* GET : A JBI message is created from the URL parameters
* POST/PUT/DELETE : The incoming XML message is used to create the JBI message.

In all the cases the namespaces are added to the JBI message if they are specified in the Service Unit configuration.

The JBI operation is created from the incoming REST query. The operation is extracted from the URL. A URL like {{http://<host>:<port>/petals/services/RESTService/operation?param1=value1&param2=value2}} will produce the '{{operation}}' JBI operation.

In this sample, we are going to provide the Yahoo Weather Service ([http://developer.yahoo.com/weather/|http://developer.yahoo.com/weather/]) as JBI Service inside the JBI environment. It is possible by configuring a Service Unit in provider mode :

{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-4.0"
xmlns:soap="http://petals.ow2.org/components/soap/version-3.1"
xmlns:sample="http://petals.ow2.org/soap/sample">
<!-- 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="sample:YahooWeatherInterface"
service-name="sample:YahooWeatherService"
endpoint-name="YahooWeatherEndpoint">

<!-- CDK specific fields -->
<petalsCDK:mep xsi:nil="true"/>

<!-- WSDL file -->
<petalsCDK:wsdl>Weather.wsdl</petalsCDK:wsdl>

<!-- SOAP specific fields -->
<soap:address>
http://weather.yahooapis.com/forecastrss?p={/*[local-name()='getWeather'][1]/*[
localname()='citycode'][1]}&amp;u={/*[local-name()='getWeather'][1]/*[local-name()='unit'][1]}
</soap:address>
<!-- The previous address has been formatted for display purpose -->
<soap:mode>REST</soap:mode>
<soap:rest-http-method>GET</soap:rest-http-method>
</jbi:provides>
</jbi:services>
</jbi:jbi>
{code}

When receiving a JBI message on the activated JBI endpoint, the final address will be built from the JBI message payload.

For example if the following JBI message :

{code:lang=xml}
<weat:getWeather xmlns:weat="http://petals.ow2.org/services/weather">
<citycode>FRXX0099</citycode>
<unit>c</unit>
</weat:getWeather>

is associated with the address parameter value {{http://weather.yahooapis.com/forecastrss?p={/*[localname()='getWeather'][1]/*[local-name()='citycode'][1]}&amp;u={/*[local-name()='getWeather'][1]/*[local-name()='unit'][1]}}} will produce the URI {{http://weather.yahooapis.com/forecastrss?p=FRXX0099&u=c}}.
{code}

h2. Samples

h3. Provide mode