...
This document briefly describes usage of the SOAP workflow framework when developing a service consumer.
Include Page | ||||
---|---|---|---|---|
|
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:
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 | ||||
---|---|---|---|---|
| ||||
<?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 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:xsdxs="http://www.w3.org/2001/XMLSchema" xmlnsversion="http://schemas.xmlsoap.org/wsdl/1.0" targetNamespace="http://soap.CDRator.com/" name="InvokerService"> <types> <xs:element <xsd:schema>name="executeMethod" type="tns:executeMethod"/> <xsd<xs:importelement namespacename="http://soap.CDRator.com/executeMethodResponse" schemaLocationtype="definition.xsdtns:executeMethodResponse"/> </xsd<xs:schema> </types> <message complexType name="executeMethod"> <part name="parameters" element="tns:executeMethod"/> </message> <xs:sequence> <message name="executeMethodResponse"> <part<xs:element name="parametersarg0" elementtype="tns:executeMethodResponserequestDTO" minOccurs="0"/> </message>xs:sequence> <portType name="InvokerService"> </xs:complexType> <operation<xs:complexType name="executeMethodrequestDTO"> <input wsam:Action="http://soap.CDRator.com/InvokerService/executeMethodRequest" message="tns:executeMethod"/><xs:sequence> <xs:element name="hookpointKey" type="xs:string" minOccurs="0"/> <output wsam<xs:Actionelement name="http://soap.CDRator.com/InvokerService/executeMethodResponsevalues" messagetype="tns:executeMethodResponsevalueDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </operation>xs:sequence> </portType>xs:complexType> <binding<xs:complexType name="InvokerServicePortBindingvalueDTO" typeabstract="tns:InvokerServicetrue"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <xs:sequence> <operation<xs:element name="executeMethodkey"> <soap:operation soapAction=" type="xs:string" minOccurs="0"/> </xs:sequence> <input> </xs:complexType> <soap<xs:bodycomplexType usename="literaldateValueDTO"/> </input><xs:complexContent> <output> <soap:body use="literal"/<xs:extension base="tns:valueDTO"> </output> <xs:sequence> </operation> </binding> <service name="InvokerService"> <port<xs:element name="InvokerServicePortvalue" bindingtype="tnsxs:InvokerServicePortBindingdateTime"> minOccurs="0"/> <soap:address location="http://localhost:8080/simyo-workflow-soap/InvokerService"/> </xs:sequence> </port>xs:extension> </service>xs:complexContent> </definitions>{code} {code:title=definitions.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> <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="executeMethodstringValueDTO"> <xs:sequence>complexContent> <xs:elementextension namebase="arg0" type="tns:requestDTOvalueDTO" minOccurs="0"/>> </xs:sequence> </xs:complexType> <xs:complexType name="requestDTO"> <xs:sequence> <xs:sequence> <xs:element name="hookpointKeyvalue" type="xs:string" minOccurs="0"/> <xs:element name="values" type="tns:valueDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:extension> </xs:sequence>complexContent> </xs:complexType> <xs:complexType name="valueDTO" abstract="true">longValueDTO"> <xs:complexContent> <xs:extension base="tns:valueDTO"> <xs:sequence> <xs:element name="keyvalue" type="xs:string" minOccurs="0long"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="dateValueDTOdoubleValueDTO"> <xs:complexContent> <xs:extension base="tns:valueDTO"> <xs:sequence> <xs:element name="value" type="xs:dateTime" minOccurs="0"double"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="complexValueDTObooleanValueDTO"> <xs:complexContent> <xs:extension base="tns:valueDTO"> <xs:sequence> <xs:element name="value" type="tnsxs:valueDTO" nillable="true" minOccurs="0" maxOccurs="unbounded"boolean"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="stringValueDTOexecuteMethodResponse"> <xs:complexContent>sequence> <xs:extension baseelement name="return" type="tns:valueDTO"responseDTO" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:sequence>complexType name="responseDTO"> <xs:sequence> <xs:element name="valueerrorCode" type="xs:string" minOccurs="0long"/> <xs:element </xs:sequence>name="errorMessage" type="xs:string" minOccurs="0"/> </xs<xs:extension>element </xs:complexContent>name="status" type="xs:long"/> </xs:complexType> <xs:complexTypeelement name="longValueDTOvalues"> type="tns:valueDTO" nillable="true" <xs:complexContent> <xs:extension base="tns:valueDTO"minOccurs="0" maxOccurs="unbounded"/> <xs</xs:sequence> </xs:complexType> <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}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:language=java}</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. |
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 | ||
---|---|---|
| ||
private static final String ROOTYOUR_HOOKPOINT_KEY = "ROOTYOUR_HOOKPOINT_KEY"; private static final String CHILD_ONECONTEXT_KEY = "CHILD_ONECONTEXT"; private static final String SUBLANGUAGE_CHILD_ONE_KEY = "SUB_CHILD_ONELANGUAGE"; private static final String SUB_CHILD_TWOOPERATOR_KEY = "SUB_CHILD_TWOOPERATOR"; private static final String DUMMYLANGUAGE_KEYEN = "DUMMYEN"; private static final String OPERATOR_DUMMY_VALUE = "DUMMY"; <...> public void doSomethinginvokeYourWorkflow() { <...> StringValueDTO dummy = new StringValueDTO(); dummy.setKey(DUMMY_KEY); dummy.setValue(DUMMY_VALUE); ComplexValueDTO subChildOne InvokerService_Service service = new ComplexValueDTOInvokerService_Service(); subChildOne.setKey(SUB_CHILD_ONE_KEY); subChildOne.getValue().add(dummyInvokerService servicePort = service.getInvokerServicePort(); ComplexValueDTORequestDTO subChildTworequest = new ComplexValueDTORequestDTO(); subChildTwo.setKey(SUB_CHILD_TWO_KEY); subChildTwo.getValue().add(dummy request.setHookpointKey(YOUR_HOOKPOINT_KEY); ComplexValueDTOStringValueDTO childOnelanguage = new ComplexValueDTOStringValueDTO(); childOnelanguage.setKey(CHILDLANGUAGE_ONE_KEY); childOnelanguage.getValue().add(subChildOne); childOne.getValue().add(subChildTwo)setValue(LANGUAGE_EN); ComplexValueDTOStringValueDTO rootoperator = new ComplexValueDTO(); context.setKey(ROOT_KEYStringValueDTO(); contextlanguage.getValuesetKey().add(childOne)OPERATOR_KEY); <...> } <...>{code} This becomes useful when you have to transfer some kind of very complex object and pass it to the workflow framework. h2. Terms and Concepts in the Rator System A customer in Rator is a complex structure consisting of an account with a number of users, billing groups and subscriptions. Basically, a user object represents a person or a company including address details, email address, personal Id etc. A User object can be used to represent ownership of an account, billing groups and subscriptions as well as to represent a billing address or a delivery address. Multiple Users objects associated with one account. An Account must have at least one billing group. The billing group represents financial information such as a monetary balance, currency, billing cycle, payment details etc. When a customer subscribes to a product, a subscription is created. The subscription has information such a start date, sales channel/sales rep, user of subscription (link to a Users object). A Subscription always has a Service which is the object where information such as phone number and device info is stored. A simple customer consists of: * One [#Account] * One [#User] * One [#Billing Group] * One [#Subscription] * One [#Service] See diagram: !Customers:Simplified Data Model^CDRator_Model_Simplified.png! h3. Account {include:Customers:Account-0} h3. Billing Group {include:Customers:BillingGroup-0} h3. Subscription {include:Customers:Subscriptions-0} h3. User {include:Customers:User-0} {table-plus}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); } |
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 | ||
---|---|---|
| ||
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);
<...>
}
<...> |
This becomes useful when you have to transfer some kind of very complex object and pass it to the workflow framework.