This document briefly describes a brief usage of the SOAP workflow framework when developing a service consumer.
First thing you need
Include Page |
---|
Getting started
|
Getting Started
The first thing to do is to check the service endpoint end-point description page and WSDL document using the provided endpoint end-point address.
Usually the address for endpoint of the end-point description page looks like this:
- http://<host>:<port>/application-name/InvokerService
and the WSDL location like this:
- http://<host>:<port>/application-name/InvokerService?wsdl
...
Accessing the end-point description page you should see display something like this:
and when trying it is attempted to access the WSDL location you should be able to see , the valid WSDL document should be displayed.
When you have the WSDL document, you can start generating the DTO classes. Many programming languages have it's their own tools for class generation from WSDL.
One of the easiest ways to do this in JAVA Java is to use JAX-WS and Maven with a plugin called jaxws-maven-plugin. The example Maven pom.xml file could look like this
When you have successfully generated the class sources, you can start developing your service client using these classes and invoking the workflows.
The WSDL and data types XSD definitions:
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="'1.0"' encoding="'UTF-8"?> <project xmlns="'?><!-- Published by JAX-WS RI at http://mavenjax-ws.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.integration.crm</groupId> <artifactId>example-client</artifactId> <version>1.0-SNAPSHOT</version> <name>Example integration project</name> <description>Example integration project</description> <scm> <developerConnection>scm:svn:https://svn.example.com/svn/dev/integration/example-client</developerConnection> </scm> <properties> <project.java.version>1.6</project.java.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>javax.xml.ws</groupId> <artifactId>jaxws-api</artifactId> <version>2.2.7</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2.6</version> </dependency> <dependency> <groupId>javax.xml.soap</groupId> <artifactId>saaj-api</artifactId> <version>1.3.4</version> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-rt</artifactId> <version>2.1.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> </dependency> <dependency> <groupId>javax.xml.ws</groupId> <artifactId>jaxws-api</artifactId> </dependency> <dependency>dev.java.net. RI's version is JAX-WS RI 2.2.7b06 svn-revision#12863. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.7b06 svn-revision#12863. --> <definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soap.CDRator.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://soap.CDRator.com/" name="InvokerService"> <types> <xsd:schema> <xsd:import namespace="http://soap.CDRator.com/" schemaLocation="definition.xsd"/> </xsd:schema> </types> <message name="executeMethod"> <part name="parameters" element="tns:executeMethod"/> </message> <message name="executeMethodResponse"> <part name="parameters" element="tns:executeMethodResponse"/> </message> <portType name="InvokerService"> <operation name="executeMethod"> <input wsam:Action="http://soap.CDRator.com/InvokerService/executeMethodRequest" message="tns:executeMethod"/> <output wsam:Action="http://soap.CDRator.com/InvokerService/executeMethodResponse" message="tns:executeMethodResponse"/> </operation> </portType> <binding name="InvokerServicePortBinding" type="tns:InvokerService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <operation name="executeMethod"> <soap:operation soapAction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="InvokerService"> <port name="InvokerServicePort" binding="tns:InvokerServicePortBinding"> <soap:address location="http://localhost:8080/simyo-workflow-soap/InvokerService"/> </port> </service> </definitions> |
Code Block | ||
---|---|---|
| ||
<?xml version='1.0' encoding='UTF-8'?> <!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.7b06 svn-revision#12863. --> <xs:schema xmlns:tns="http://soap.CDRator.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://soap.CDRator.com/"> <xs:element name="executeMethod" type="tns:executeMethod"/> <xs:element name="executeMethodResponse" type="tns:executeMethodResponse"/> <xs:complexType name="executeMethod"> <xs:sequence> <xs:element name="arg0" type="tns:requestDTO" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="requestDTO"> <xs:sequence> <xs:element name="hookpointKey" <groupId>javax.jws</groupId>type="xs:string" minOccurs="0"/> <xs:element name="values" type="tns:valueDTO" nillable="true" <artifactId>jsr181-api</artifactId>minOccurs="0" maxOccurs="unbounded"/> </dependency>xs:sequence> </xs:complexType> <dependency> <xs:complexType name="valueDTO" abstract="true"> <groupId>javax.xml.soap</groupId><xs:sequence> <xs:element name="key" <artifactId>saaj-api</artifactId>type="xs:string" minOccurs="0"/> </dependency>xs:sequence> <dependency></xs:complexType> <xs:complexType name="dateValueDTO"> <groupId>javax.xml</groupId><xs:complexContent> <xs:extension base="tns:valueDTO"> <artifactId>jax-qname</artifactId> <xs:sequence> <version>1.1</version> </dependency> </dependencies><xs:element name="value" type="xs:dateTime" minOccurs="0"/> <build> <sourceDirectory>src/main/java</sourceDirectory></xs:sequence> <testSourceDirectory>src/test/java</testSourceDirectory></xs:extension> </xs:complexContent> <resources> </xs:complexType> <xs:complexType name="complexValueDTO"> <resource> <xs:complexContent> <xs:extension base="tns:valueDTO"> <directory>src/main/resources</directory> <xs:sequence> </resource> <xs:element </resources> name="value" type="tns:valueDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"/> <testResources> </xs:sequence> <testResource> </xs:extension> </xs:complexContent> </xs:complexType> <directory>src/test/resources</directory> <xs:complexType name="stringValueDTO"> <xs:complexContent> </testResource> </testResources><xs:extension base="tns:valueDTO"> <plugins> <xs:sequence> <plugin> <xs:element name="value" type="xs:string" minOccurs="0"/> <groupId>org.apache.maven.plugins</groupId></xs:sequence> </xs:extension> <artifactId>maven-compiler-plugin</artifactId></xs:complexContent> </xs:complexType> <xs:complexType name="longValueDTO"> <configuration> <xs:complexContent> <xs:extension base="tns:valueDTO"> <source>${project.java.version}</source> <xs:sequence> <xs:element name="value" type="xs:long"/> <target>${project.java.version}</target> </xs:sequence> </configuration>xs:extension> </xs:complexContent> </plugin>xs:complexType> <xs:complexType name="doubleValueDTO"> <plugin><xs:complexContent> <xs:extension base="tns:valueDTO"> <groupId>org.jvnet.jax-ws-commons</groupId> <xs:sequence> <xs:element <artifactId>jaxws-maven-plugin</artifactId>name="value" type="xs:double"/> <version>2.1</version></xs:sequence> </xs:extension> <executions></xs:complexContent> </xs:complexType> <xs:complexType name="booleanValueDTO"> <xs:complexContent> <execution> <xs:extension base="tns:valueDTO"> <xs:sequence> <goals> <xs:element name="value" type="xs:boolean"/> </xs:sequence> <goal>wsimport<</goal>xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="executeMethodResponse"> </goals><xs:sequence> <xs:element name="return" type="tns:responseDTO" minOccurs="0"/> </execution> xs:sequence> </xs:complexType> <xs:complexType name="responseDTO"> </executions> <xs:sequence> <xs:element name="errorCode" type="xs:long"/> <configuration> <xs:element name="errorMessage" type="xs:string" minOccurs="0"/> <xs:element <packageName>com.example.service</packageName>name="status" type="xs:long"/> <xs:element name="values" type="tns:valueDTO" </configuration> nillable="true" minOccurs="0" maxOccurs="unbounded"/> </plugin> xs:sequence> </plugins>xs:complexType> </build> </project> |
Place the WSDL document in <project_dir>/src/wsdl and run the following command to generate the class source files:
Code Block |
---|
mvn generate-sources |
When you have successfully generated the class sources, you can start developing your service client using these classes and invoking the workflows.
...
</xs:schema>
|
Assuming the workflow must be invoked which expects you to send the following structure.:
Request:
Key | Value type | Mandatory | Description |
---|---|---|---|
CONTEXT | ComplexValueDTO | true | Context object, mandatory in each request. |
...
Key | Value type | Mandatory | Description |
---|---|---|---|
LANGUAGE | StringValueDTO | true | Language code. EN, FR, DK, etc. Used for displaying error messages. |
OPERATOR | StringValueDTO | true | Operator information. |
BRAND_ID | StringValueDTO | false | Id of the brand if applicable. |
Then then your client code would look something like this:
...
This approach gives a lot of flexibility as the changes to the service maybe may be applied rapidly, it 's is just a matter of adding another DTO to a value list.
Note: You can also have a tree-like structure using ComplexValueDTO objects, that means, i.e. you can have a list of ComplexValueDTO objects inside another ComplexValueDTO object. The example would look like this:
...
This becomes useful when you need have to transfer some kind of very complex object and pass it to the workflow framework.