
public Person() {
this.firstName = null;
this.surname = null;
this.birthday = null;
this.sex = null;
}
public String getFirstName() {
return firstName;
}
public String getSurname() {
return surname;
}
public Calendar getBirthday() {
return birthday;
}
public Sex getSex() {
return sex;
}
}
{code}
\\
There are many more annotations to use with JAX-WS.
More information is available on the [Apache Axis2 page|http://ws.apache.org/axis2/].
\\
In fact, for each annotated class, the Petals Jsr181 component creates an Axis2 service.
The messages that are received from the bus are then forwarded to the right Axis2 service the component holds.
Before forwarding the JBI message to the Axis2 service, the service engine checks that :
* The requested operation exists in the Axis2 service. If not, an error will be returned in the JBI message exchange.
* The JBI Message Exchange Pattern (MEP) is compatible with the target operation. For example, in the previous code snippet, an InOut MEP is not compatible with the 'voidvoid' operation and an error would be returned in the JBI message exchange.
\\
It is not possible to only provide the Java class.
The component needs the annotated class, the associated WSDL and a JBI descriptor.
This descriptor references WSDL elements. You mandatory need to have generated the WSDL.
h2. Service-Unit descriptor
The service-unit descriptor file (jbi.xml) looks like this:
\\
{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-5"
xmlns:helloworld="http://petals.ow2.org/helloworld"
xmlns:jsr181="http://petals.ow2.org/components/jsr181/version-1">
<jbi:services binding-component="false">
<jbi:provides
interface-name="helloworld:Helloworld"
service-name="helloworld:HelloworldService"
endpoint-name="HelloworldEndpoint">
<petalsCDK:wsdl>Service.wsdl</petalsCDK:wsdl>
<jsr181:class>org.ow2.petals.usecase.jsr181.TestService</jsr181:class>
</jbi:provides>
</jbi:services>
</jbi:jbi>
{code}
\\
{include:0 CDK SU Provide Configuration}
\\
{center}*Configuration of a Service Unit to provide a service (JSR-181)*{center}
{table-plus}
|| Parameter || Description || Default || Required ||
| class | The JSR-181 annotated class which will provide the Service. This class must be available in the Service-Unit class loader. | {center}\-{center} | {center}Yes{center} |
{table-plus}
{include:0 CDK SU Interceptor configuration|]}
h2. Data-binding
The data-binding is the process that transforms XML messages into Java objects, and vice-versa.
The Jsr181 component delegates this task to Axis2.
As an example, invoking the *sayHello* operation of the previous service, with a message payload like:
{code:lang=xml}
<sayHello>
<param0>Hey!!!</param0>
</sayHello>
{code}
\\
... would result in a response like:
{code:lang=xml}
<dlwmin:sayHelloResponse
xmlns:dlwmin="http://petals.ow2.org"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<return>You told me: Hey!!!</return>
</dlwmin:sayHelloResponse>
{code}
Obviously, we assume the operation was invoked with the right MEP (*InOut* here).
h1. Configuring the component
\\
The component can be configured through its JBI descriptor:
\\
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0" xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:jsr181="http://petals.ow2.org/components/jsr181/version-1">
<jbi:component type="service-engine"
bootstrap-class-loader-delegation="parent-first">
<jbi:identification>
<jbi:name>petals-se-jsr181</jbi:name>
<jbi:description> The JSR-181 Service Engine (based on Axis2)</jbi:description>
</jbi:identification>
<jbi:component-class-name>org.ow2.petals.se.jsr181.Jsr181Se</jbi:component-class-name>
<jbi:component-class-path><jbi:path-element/></jbi:component-class-path>
<jbi:bootstrap-class-name>org.ow2.petals.se.jsr181.Jsr181Bootstrap</jbi:bootstrap-class-name>
<jbi:bootstrap-class-path><jbi:path-element/></jbi:bootstrap-class-path>
<petalsCDK:acceptor-pool-size>5</petalsCDK:acceptor-pool-size>
<petalsCDK:processor-pool-size>10</petalsCDK:processor-pool-size>
<petalsCDK:ignored-status>DONE_AND_ERROR_IGNORED</petalsCDK:ignored-status>
<petalsCDK:notifications>false</petalsCDK:notifications>
<petalsCDK:jbi-listener-class-name>org.ow2.petals.se.jsr181.Jsr181JBIListener</petalsCDK:jbi-listener-class-name>
</jbi:component>
</jbi:jbi>
{code}
{include:0 CDK Component Configuration Table 2.1}
{include:0 CDK Parameter scope}
{include:0 CDK Component Interceptor configuration}