
Write your WSDL according to your needs. No requirement about the WSDL is expected.
A best practice is to explode your WSDL in two parts:
* an abstract part containing data definition (XSD) and the service interface (port type),
* a concrete part containing the binding of the port type, and the service definition.
h2. Annotating the WSDL
Annotations take place in each operation of the binding definition:
{code:xml}
<binding name="FactureServicePortBinding" type="tns:FactureService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="stocker">
<soap:operation soapAction="" />
<mapping:service-provider-operation>ged:stocker</mapping:service-provider-operation>
<mapping:input-transformation xsl="input-stocker.xsl" />
<mapping:output-transformation xsl="output-stocker.xsl">
<mapping:should-return-fault as-xpath-expr="true">false()</mapping:should-return-fault>
</mapping:output-transformation>
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
{code}
All annotations are member of the namespace "{{http://petals.ow2.org/se/mapping/annotations/1.0}}":
* {{service-provider-operation}} defines the qualified name of the 3PP service provider operation to invoke when the current operation is invoked,
* {{input-transformation}} defines the transformation to apply on incoming requests on the current operation,
* {{output-transformation}} defines the transformation to apply on response for the current operation,
h3. Defining input transformations
The input transformation is defined by the annotation '{{input-transformation}}'.
Now, only XSL transformations are available.
h4. Defining an XSL input transformation
To define an input transformation as an XSL transformation, just define the XSL style-sheet to use by the attribute '{{xsl}}' of the annotation '{{input-transformation}}'. The XSL style-sheet is provided as a file located in the root directory of the service unit.
{code:xml}
<binding name="FactureServicePortBinding" type="tns:FactureService">
...
<operation name="stocker">
...
<mapping:input-transformation xsl="input-stocker.xsl" />
...
</operation>
</binding>
{code}
A property defined at component level (through the component configuration parameter '{{properties-file}}' can be accessed into the XSL through a global XSL parameter defined by the qualified name: '{{<property-name>}}' of namespace '{{http://petals.ow2.org/se/mapping/xsl/param/1.0}}'.
{tip}For a unit test purpose, an extension of JUnit is available to test your XSL. See chapter "[Unit testing|#Unit_Testing]".{tip}
h3. Defining output transformations
The output transformation is defined by the annotation '{{output-transformation}}'.
The result of the transformation can be returned to the service consumer as a normal response or as a fault according to the result of the expression defined by the sub-annotation '{{should-return-fault}}'. If the expression returns '{{true}}', a fault will be returned to the service consumer, otherwise a normal response will be returned:
{code:xml}
<binding name="FactureServicePortBinding" type="tns:FactureService">
...
<operation name="stocker">
...
<mapping:output-transformation xsl="output-stocker.xsl">
<mapping:should-return-fault as-xpath-expr="true">false()</mapping:should-return-fault>
</mapping:output-transformation>
...
</operation>
</binding>
{code}
Now, only XSL transformations and XPath expression are available.
h4. Defining an XSL output transformation
To define an output transformation as an XSL transformation, just define the XSL style-sheet to use by the attribute '{{xsl}}' of the annotation '{{output-transformation}}'. The XSL style-sheet is provided as a file located in the root directory of the service unit.
{code:xml}
<binding name="FactureServicePortBinding" type="tns:FactureService">
...
<operation name="stocker">
...
<mapping:output-transformation xsl="output-stocker.xsl">
...
</mapping:output-transformation>
...
</operation>
</binding>
{code}
The incoming request can be accessed into the XSL through a global XSL parameter defined by the qualified name: '{{incoming-request}}' of namespace '{{http://petals.ow2.org/se/mapping/xsl/param/output/1.0}}'.
A property defined at component level (through the component configuration parameter '{{properties-file}}' can be accessed into the XSL through a global XSL parameter defined by the qualified name: '{{<property-name>}}' of namespace '{{http://petals.ow2.org/se/mapping/xsl/param/1.0}}'.
{tip}For a unit test purpose, an extension of JUnit is available to test your XSL. See chapter "[Unit testing|#Unit_Testing]".{tip}
h4. Selecting response nature through XPath
The expression to select the response nature to return (fault or normal response) can be expressed as an XPath expression using the attribute '{{as-xpath-expr}}' set to '{{true}}', and giving the XPath expression as value of the annotation '{{should-return-fault}}':
{code}
<mapping:output-transformation xsl="output-stocker.xsl">
<mapping:should-return-fault as-xpath-expr="true">false()</mapping:should-return-fault>
</mapping:output-transformation>
{code}
{tip}For a unit test purpose, an extension of JUnit is available to verify your XPath expression syntax when checking your WSDL. See chapter "[Unit testing|#Unit_Testing]".{tip}
h2. Defining the 3PP service provider
The 3PP service provider is defined in the service unit JBI descriptor as a service consumer:
{code}
<!-- The service invoked -->
<jbi:consumes interface-name="ged:GedService" service-name="ged:GedService">
<petalsCDK:timeout>15000</petalsCDK:timeout>
<petalsCDK:mep>InOut</petalsCDK:mep>
</jbi:consumes>
{code}
Supported parameters of the section '{{consumes}}' are:
* {{timeout}}, to set on the message exchange used for the service provider invocation,
* {{mep}}, is not used because we reuse the one of the incoming exchange,
* {{operation}}, is not used. As we can have a service 'Facade' providing several operations, it was needed to define the annotation '{{service-provider-operation}}'. A warning will appear in log traces if this field is set.
* {{exchange-properties}}, the properties to set on the message exchange used to invoke the service provider,