Difference between revisions of "Single Port-Type"
Manuele.simi (Talk | contribs) (→Sketching Port-type Interfaces: WSDL structure) |
Manuele.simi (Talk | contribs) (→Sketching Port-type Interfaces: WSDL structure) |
||
Line 81: | Line 81: | ||
<pre> | <pre> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
− | <definitions xmlns:tns="...." xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Stateless" targetNamespace="....."> | + | <definitions xmlns:tns="...." xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
+ | name="Stateless" targetNamespace="....."> | ||
<types> | <types> | ||
<xsd:schema targetNamespace="....."> | <xsd:schema targetNamespace="....."> | ||
Line 99: | Line 100: | ||
</pre> | </pre> | ||
− | + | == Sketching Port-type Interfaces: filling the holes == | |
− | + | ||
== Delving into the implementation == | == Delving into the implementation == |
Revision as of 23:38, 21 March 2008
Contents
- 1 From configuration to testing with a single Port-Type
- 1.1 Structuring the service code
- 1.2 Profiling for the infrastructure
- 1.3 JNDI configuration
- 1.4 Sketching Port-type Interfaces: WSDL structure
- 1.5 Sketching Port-type Interfaces: filling the holes
- 1.6 Delving into the implementation
- 1.7 Building & Deploying
- 1.8 gCore Logging & Restart
- 1.9 A Test Client
- 1.10 Refining the implementation
From configuration to testing with a single Port-Type
Even if not compulsory, we strongly suggest to adopt the Eclipse 3.3 as development platform. In such an IDE, open a new workspace with a Java 1.5 compiler and create a new Java project by specifying a source folder (named from now on, SERVICE folder). Then, fill a user-library with all JARs in gCore lib and name it CONTAINERLIB.
Structuring the service code
Prepare the source folder structure as follows:
- create a etc folder where to place your configuration files
- create a org/acme/sample folder where to place your source code
- create a schema folder where to place the remote interface files
- copy the share/gcube_tools/build.xml file into your SERVICE folder
Profiling for the infrastructure
Create a new XML file named Profile.xml and place it in the SERVICE/etc folder. This file profiles the service in such a way that the instance of a service can be discovered by others and eventually dynamically deployed in a gCube infrastructure.
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ID></ID> <Type>Service</Type> <Profile> <Description>A very simple gCube Service</Description> <Class>Samples</Class> <Name>SampleService</Name> <Packages> <Main> <Description>Describes port-types</Description> <Name>Main</Name> <Dependencies> <Dependency> <Service> <Class>Samples</Class> <Name>SampleService</Name> </Service> <Package>Stubs</Package> <Version>1.0</Version> <Scope level="GHN"/> <Optional>false</Optional> </Dependency> </Dependencies> <GARArchive>org.acme.sample.gar</GARArchive> <PortType> <Name>acme/sample/stateless</Name> <WSDL/> </PortType> </Main> <Software> <Description>Describes port-type stubs</Description> <Name>Stubs</Name> <Files><File>org.acme.sample.stubs.jar</File></Files> </Software> </Packages> </Profile> </Resource>
The file identifies our service by assigning it a ServiceClass and a ServiceName. It also describes the service decomposition: it is composed by two packages, the service itself and its stubs and that the first one has a GHN-scoped dependency against the second one. Finally, it indicates that the service has a single Port-Type named acme/sample/stateless.
JNDI configuration
Create a new XML file named deploy-jndi-config.xml and and place it in the SERVICE/etc folder. It will include either the global service configuration and the all the Port-Type ones. The file has a two-fold role:
- tells to the gCube framework about the service
- makes available to the service at runtime the information included there
<jndiConfig xmlns="http://wsrf.globus.org/jndi/config"> <service name="acme/sample"> <environment name="profile" value="@config.dir@/profile.xml" type="java.lang.String" override="false" /> </service> </jndiConfig>
At this stage, the file only include a service section reporting the name of the service ("acme/sample") and the name of the profile created. The @config.dir@ is a placeholder replaced at the deployment time with the real path of the SERVICE/etc folder.
Sketching Port-type Interfaces: WSDL structure
The following is the basic skeleton of any WSDL interface:
<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns:tns="...." xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Stateless" targetNamespace="....."> <types> <xsd:schema targetNamespace="....."> <!-- REQUEST AND RESPONS TYPE DEFINITIONS --> </xsd:schema> </types> <!-- MESSAGES --> <portType name="....."> <!-- OPERATION --> </portType> </definitions>