Difference between revisions of "Adding State"

From GCube System
Jump to: navigation, search
(Multi port-type service)
(Multi port-type service)
Line 8: Line 8:
  
 
For both, we need to perform the same [[Single_Port-Type#Sketching_port-type_interfaces|steps]] done for the Stateless port-type:
 
For both, we need to perform the same [[Single_Port-Type#Sketching_port-type_interfaces|steps]] done for the Stateless port-type:
* the profile file has to be changed in order to declare the two new port-types
+
* add the port-types to the profile file
* a WSDL interface definition file has to be provided for each port-type
+
* define the WSDL interface for each port-type
* the Java implementation of the two port-types has to be provided
+
* provide the Java implementation of the two port-types
  
 
plus other specific steps that allow to manage stateful services.
 
plus other specific steps that allow to manage stateful services.
 +
 +
--[[User:Manuele.simi|Manuele.simi]] 23:56, 25 March 2008 (EET)
  
 
== WSDL interface for the factory service ==
 
== WSDL interface for the factory service ==

Revision as of 23:56, 25 March 2008

Adding State

In the first part of this tutorial we have created a stateless service for simplicity. However, the most common patterns used when developing gCube services are the ones that allow to create stateful service. In this part of the tutorial we see how to add a state to the SampleService.

Multi port-type service

To add a state we need firstly to add two new port-types to the SampleService:

  • one is dedicated to create a new stateful resource, the so-called Factory service port-type
  • the other one is dedicated to access and manage the state, the so-called Service instance port-type

For both, we need to perform the same steps done for the Stateless port-type:

  • add the port-types to the profile file
  • define the WSDL interface for each port-type
  • provide the Java implementation of the two port-types

plus other specific steps that allow to manage stateful services.

--Manuele.simi 23:56, 25 March 2008 (EET)

WSDL interface for the factory service

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="Factory"
    targetNamespace="http://acme.org/sample"
    xmlns:tns="http://acme.org/sample"
  	xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:corefaults="http://gcube-system.org/namespaces/common/core/faults"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" >
    
    <import namespace="http://gcube-system.org/namespaces/common/core/faults" location="../gcube/common/core/faults/GCUBEFaults.wsdl"/>
   
 	<types>
	<xsd:schema targetNamespace="http://acme.org/sample">
		
		 <xsd:import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="../ws/addressing/WS-Addressing.xsd" />
	
  		<xsd:element name="logon" type="xsd:string" />		
		<xsd:element name="logonResponse" type="wsa:EndpointReferenceType"/>
	</xsd:schema>
	</types>

	<message name="logonInputMessage">
		<part name="request" element="tns:logon"/>
	</message>
	<message name="logonOutputMessage">
		<part name="response" element="tns:logonResponse"/>
	</message>

	<portType name="FactoryPortType">
	
		<operation name="logon">
			<input message="tns:logonInputMessage"/>
			<output message="tns:logonOutputMessage"/>
			<fault name="fault" message="corefaults:GCUBEFaultMessage"></fault>
			<fault name="fault" message="corefaults:GCUBEUnrecoverableFaultMessage"></fault>
			<fault name="fault" message="corefaults:GCUBERetrySameFaultMessage"></fault>
			<fault name="fault" message="corefaults:GCUBERetryEquivalentFaultMessage"></fault>
		</operation>
	
	</portType>

</definitions>

Implementation

Configuring JNDIs & Descriptors

Building & Deploying

A Test Client