Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This

...

document

...

briefly describes

...

usage

...

of

...

the

...

SOAP

...

workflow

...

framework

...

when

...

developing

...

a

...

service

...

consumer.

...

Include Page
Workflows SOAP API
Workflows SOAP API

Getting Started

The first thing to do is to check the service end-point description page and WSDL document using the provided end-point address.

Usually the address 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

...

should

...

display

...

something

...

like

...

this:

Image Added

and when it is attempted to access the WSDL location, the valid WSDL document should be displayed.

When you have the WSDL document, you can start generating the DTO classes. Many programming languages have their own tools for class generation from WSDL.

One of the easiest ways to do this in Java is to use JAX-WS and Maven with a plugin called jaxws-maven-plugin. 

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
languagehtml/xml
titleWSDL
<?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. --><!-- 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}
{code:title=definitions>
}
Code Block
titledefinitions.xsd
<?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" type="xs:string" minOccurs="0"/>
        <xs:element name="values" type="tns:valueDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
    <xs:complexType name="valueDTO" abstract="true">
      <xs:sequence>
        <xs:element name="key" type="xs:string" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
    <xs:complexType name="dateValueDTO">
      <xs:complexContent>
        <xs:extension base="tns:valueDTO">
          <xs:sequence>
            <xs:element name="value" type="xs:dateTime" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="complexValueDTO">
      <xs:complexContent>
        <xs:extension base="tns:valueDTO">
          <xs:sequence>
            <xs:element name="value" type="tns:valueDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="stringValueDTO">
      <xs:complexContent>
        <xs:extension base="tns:valueDTO">
          <xs:sequence>
            <xs:element name="value" type="xs:string" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="longValueDTO">
      <xs:complexContent>
        <xs:extension base="tns:valueDTO">
          <xs:sequence>
            <xs:element name="value" type="xs:long"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="doubleValueDTO">
      <xs:complexContent>
        <xs:extension base="tns:valueDTO">
          <xs:sequence>
            <xs:element name="value" type="xs:double"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="booleanValueDTO">
      <xs:complexContent>
        <xs:extension base="tns:valueDTO">
          <xs:sequence>
            <xs:element name="value" type="xs:boolean"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="executeMethodResponse">
      <xs:sequence>
        <xs:element name="return" type="tns:responseDTO" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
    <xs:complexType name="responseDTO">
      <xs:sequence>
        <xs:element name="errorCode" type="xs:long"/>
        <xs:element name="errorMessage" type="xs:string" minOccurs="0"/>
        <xs:element name="status" type="xs:long"/>
        <xs:element name="values" type="tns:valueDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:schema>
{code}






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. |
*CONTEXT*:
|| 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 your client code would look something like this:
{code:language=java}

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.

CONTEXT:

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 your client code would look something like this:

Code Block
languagejava
private static final String YOUR_HOOKPOINT_KEY = "YOUR_HOOKPOINT_KEY";
private static final String CONTEXT_KEY = "CONTEXT";
private static final String LANGUAGE_KEY = "LANGUAGE";
private static final String OPERATOR_KEY = "OPERATOR";

private static final String LANGUAGE_EN = "EN";
private static final String OPERATOR_DUMMY = "DUMMY";

<...>

public void invokeYourWorkflow() {
    InvokerService_Service service = new InvokerService_Service();
    InvokerService servicePort = service.getInvokerServicePort();

    RequestDTO request = new RequestDTO();

    request.setHookpointKey(YOUR_HOOKPOINT_KEY);

    StringValueDTO language = new StringValueDTO();
    language.setKey(LANGUAGE_KEY);
    language.setValue(LANGUAGE_EN);

    StringValueDTO operator = new StringValueDTO();
    language.setKey(OPERATOR_KEY);
    language.setValue(OPERATOR_DUMMY);

    ComplexValueDTO context = new ComplexValueDTO();
    context.setKey(CONTEXT_KEY);
    context.getValue().add(language);
    context.getValue().add(operator);

    request.getValues().add(context);

    ResponseDTO response = servicePort.executeMethod(request);
}{code}

This

...

approach

...

gives

...

a

...

lot

...

of

...

flexibility

...

as

...

the

...

changes

...

to

...

the

...

service

...

may

...

be

...

applied

...

rapidly,

...

it

...

is

...

just

...

a

...

matter

...

of

...

adding

...

another

...

DTO

...

to

...

a

...

value

...

list.

...

Note:

...

You

...

can

...

also

...

have

...

a

...

tree-like

...

structure

...

using

...

ComplexValueDTO

...

objects,

...

i.e.

...

you

...

can

...

have

...

a

...

list

...

of

...

ComplexValueDTO

...

objects

...

inside

...

another

...

ComplexValueDTO

...

object.

...

The

...

example

...

would

...

look

...

like

...

this:

...

:=}
Code Block
language
java
private static final String ROOT_KEY = "ROOT";

private static final String CHILD_ONE_KEY = "CHILD_ONE";

private static final String SUB_CHILD_ONE_KEY = "SUB_CHILD_ONE";
private static final String SUB_CHILD_TWO_KEY = "SUB_CHILD_TWO";

private static final String DUMMY_KEY = "DUMMY";
private static final String DUMMY_VALUE = "DUMMY"

<...>

public void doSomething() {
    <...>

    StringValueDTO dummy = new StringValueDTO();
    dummy.setKey(DUMMY_KEY);
    dummy.setValue(DUMMY_VALUE);

    ComplexValueDTO subChildOne = new ComplexValueDTO();
    subChildOne.setKey(SUB_CHILD_ONE_KEY);
    subChildOne.getValue().add(dummy);

    ComplexValueDTO subChildTwo = new ComplexValueDTO();
    subChildTwo.setKey(SUB_CHILD_TWO_KEY);
    subChildTwo.getValue().add(dummy);

    ComplexValueDTO childOne = new ComplexValueDTO();
    childOne.setKey(CHILD_ONE_KEY);
    childOne.getValue().add(subChildOne);
    childOne.getValue().add(subChildTwo);

    ComplexValueDTO root = new ComplexValueDTO();
    context.setKey(ROOT_KEY);
    context.getValue().add(childOne);

    <...>
}

<...>{code}

This

...

becomes

...

useful

...

when

...

you

...

have

...

to

...

transfer

...

some

...

kind

...

of

...

very

...

complex

...

object

...

and

...

pass

...

it

...

to

...

the

...

workflow

...

framework.

...