Hi, I have a problem with coversational and webservice binding. I have a Service which is conversational and uses the @ConversationID to get a ConversationID. I have a function getSessionID to read this conversationID. I use this function to get the ID on client-side and print it out. With POJO-binding the ConversationID stays the same no mather how often I call the getSessionID. SOULSessionServiceClient.composite
<composite xmlns=http://www.osoa.org/xmlns/sca/1.0 targetNamespace=http://SOULSessionServicexmlns:hw="http://SOULSessionService" name="SOULSessionServiceClient"> <component name="SOULSessionServiceClient"> <implementation.java class="de.cenit.SOUL.ServiceRuntime.SOULSessionService" /> </component> </composite> OUTPUT: SOULSESSIONSERVICECALLED:fc7e8541-b164-4cb7-af41-11a69a082a07 GETSTATE Called getSessionID SessionID:fc7e8541-b164-4cb7-af41-11a69a082a07 SOULSESSIONSERVICECALLED:fc7e8541-b164-4cb7-af41-11a69a082a07 Called getSessionID SessionID:fc7e8541-b164-4cb7-af41-11a69a082a07 If I use the same client with WebService-binding I get a different ConversationID for each call. <composite xmlns=http://www.osoa.org/xmlns/sca/1.0 <http://www.osoa.org/xmlns/sca/1.0> targetNamespace=http://SOULSessionService <http://SOULSessionService> xmlns:hw="http://SOULSessionService" name="SOULSessionServiceClient"> <component name="SOULSessionServiceClient"> <implementation.java class="de.cenit.SOUL.ServiceRuntime.SOULSessionServiceComponent" /> </component> <reference name="SOULSessionService" promote="SOULSessionServiceClient/helloWorldService"> <interface.java interface="de.cenit.SOUL.ServiceRuntime.SOULSessionServiceComponent" /> <binding.ws wsdlElement="http://SOULSessionService#wsdl.port(HelloWorldService/HelloWorldSoapPort)" /> </reference> </composite> OUTPUT: GETSTATE Called getSessionID SessionID:ff70883f-4441-447e-9b40-7d47052a69d9 Called getSessionID SessionID:eacfebd2-6e27-4747-aefe-c2be119efa33 Service Interface: @Remotable @Service @Conversational //@Scope("CONVERSATION") public interface ISOULSessionService extends ISOULService { //public String exec(String name); public String getName(String name); //public String exec(SOULParameters name); //public String exec(DataObject name); public String getSessionID(String name); public DataObject exec(DataObject name) throws SOULException; public DataObject storeState(DataObject pObject); public DataObject getState(DataObject pObject) ; } Service Implementation: @Scope("CONVERSATION") @Service(ISOULSessionService.class) public class SOULSessionService implements ISOULSessionService { @ConversationID public String lConversationID; public SOULSessionService() { } public String getName(String name) { System.out.println("ConverstationID:"+lConversationID); return "de.cenit.SOUL.ServiceRuntime.SOULSessionService";//this.getClass().toString(); } public DataObject exec(DataObject name) { System.out.println("SOULSESSIONSERVICECALLED:"+lConversationID); return name; } public String getSessionID(String name) { System.out.println("Called getSessionID"); return lConversationID; } } WSDL-file: <?xml version="1.0" encoding="UTF-8"?> <!-- * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. --> <wsdl:definitions targetNamespace="http://SOULSessionService" xmlns:tns="http://SOULSessionService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://de_cenit_SOUL_ServiceRuntime" xmlns:ns1="http://de_cenit_SOUL_ServiceRuntime/xsd" xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" name="SOULSessionService"> <wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://SOULSessionService" xmlns="http://www.w3.org/2001/XMLSchema"> <complexType name="Exception"> <sequence> <element minOccurs="0" name="Exception" nillable="true" type="xsd:anyType"/> </sequence> </complexType> <element name="SOULException"> <complexType> <sequence> <element minOccurs="0" name="SOULException" nillable="true" type="ns1:SOULException"/> </sequence> </complexType> </element> <element name="exec"> <complexType> <sequence> <element name="name" type="xsd:anyType" /> </sequence> </complexType> </element> <element name="execResponse"> <complexType> <sequence> <element name="execReturn" type="xsd:anyType" /> </sequence> </complexType> </element> <element name="getName"> <complexType> <sequence> <element name="getName" type="xsd:string" /> </sequence> </complexType> </element> <element name="getNameResponse"> <complexType> <sequence> <element name="getNameReturn" type="xsd:string" /> </sequence> </complexType> </element> <element name="getSessionID"> <complexType> <sequence> <element name="getName" type="xsd:string" /> </sequence> </complexType> </element> <element name="getSessionIDResponse"> <complexType> <sequence> <element name="getNameReturn" type="xsd:string" /> </sequence> </complexType> </element> <element name="getState"> <complexType> <sequence> <element name="getState" type="xsd:anyType" /> </sequence> </complexType> </element> <element name="getStateResponse"> <complexType> <sequence> <element name="execReturn" type="xsd:anyType" /> </sequence> </complexType> </element> <element name="storeState"> <complexType> <sequence> <element name="name" type="xsd:anyType" /> </sequence> </complexType> </element> <element name="storeStateResponse"> <complexType> <sequence> <element name="execReturn" type="xsd:anyType" /> </sequence> </complexType> </element> <!-- NOT NEEDED --> <complexType name="Name"> <sequence> <element name="first" type="xsd:anyType" /> <element name="last" type="xsd:string" /> </sequence> </complexType> <xsd:complexType name="LogonDataType"> <xsd:sequence> <xsd:element name="Field" type="tns:LogonDataFieldType" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="SystemID" type="xsd:string" /> </xsd:complexType> <xsd:complexType name="LogonDataFieldType"> <xsd:attribute name="key" type="xsd:string" /> <xsd:attribute name="value" type="xsd:string" /> </xsd:complexType> </schema> <schema elementFormDefault="qualified" targetNamespace="http://de_cenit_SOUL_ServiceRuntime" xmlns="http://www.w3.org/2001/XMLSchema"> <complexType name="Exception"> <sequence> <element minOccurs="0" name="Exception" nillable="true" type="xsd:anyType"/> </sequence> </complexType> <element name="SOULException"> <complexType> <sequence> <element minOccurs="0" name="SOULException" nillable="true" type="ns1:SOULException"/> </sequence> </complexType> </element> </schema> <schema xmlns:ax21="http://de_cenit_SOUL_ServiceRuntime/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://de_cenit_SOUL_ServiceRuntime/xsd" xmlns="http://www.w3.org/2001/XMLSchema"> <complexType name="SOULException"> <complexContent> <extension base="ns0:Exception"> <sequence/> </extension> </complexContent> </complexType> </schema> </wsdl:types> <wsdl:message name="execRequest"> <wsdl:part element="tns:exec" name="parameters" /> </wsdl:message> <wsdl:message name="execResponse"> <wsdl:part element="tns:execResponse" name="parameters" /> </wsdl:message> <wsdl:message name="getNameRequest"> <wsdl:part element="tns:getName" name="parameters" /> </wsdl:message> <wsdl:message name="getNameResponse"> <wsdl:part element="tns:getNameResponse" name="parameters" /> </wsdl:message> <wsdl:message name="getSessionIDRequest"> <wsdl:part element="tns:getSessionID" name="parameters" /> </wsdl:message> <wsdl:message name="getSessionIDResponse"> <wsdl:part element="tns:getSessionIDResponse" name="parameters" /> </wsdl:message> <wsdl:message name="SOULException"> <wsdl:part name="parameters" element="ns0:SOULException"/> </wsdl:message> <wsdl:message name="getStateRequest"> <wsdl:part name="parameters" element="tns:getState" /> </wsdl:message> <wsdl:message name="getStateResponse"> <wsdl:part name="paparametersrt1" element="tns:getStateResponse" /> </wsdl:message> <wsdl:message name="storeState"> <wsdl:part name="parameters" element="tns:storeState" /> </wsdl:message> <wsdl:message name="storeStateResponse"> <wsdl:part name="parameters" element="tns:storeStateResponse" /> </wsdl:message> <wsdl:portType name="HelloWorld" sca:requires="conversational"> <wsdl:operation name="exec"> <wsdl:input message="tns:execRequest" name="execRequest" /> <wsdl:output message="tns:execResponse" name="execResponse" /> <wsdl:fault message="tns:SOULException" name="SOULException"/> </wsdl:operation> <wsdl:operation name="getName"> <wsdl:input message="tns:getNameRequest" name="getNameRequest" /> <wsdl:output message="tns:getNameResponse" name="getNameResponse" /> </wsdl:operation> <wsdl:operation name="getSessionID"> <wsdl:input message="tns:getSessionIDRequest" name="getSessionIDRequest" /> <wsdl:output message="tns:getSessionIDResponse" name="getSessionIDResponse" /> </wsdl:operation> <wsdl:operation name="getState"> <wsdl:input message="tns:getStateRequest" name="getStateRequest"/> <wsdl:output message="tns:getStateResponse" name="getStateResponse" /> </wsdl:operation> <wsdl:operation name="storeState"> <wsdl:input message="tns:storeStateRequest" name="storeStateRequest"/> <wsdl:output message="tns:storeStateResponse" name="storeStateResponse" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="exec"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="execRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="execResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> <wsdl:fault name="SOULException"> <wsdlsoap:fault use="literal" name="SOULException"/> </wsdl:fault> </wsdl:operation> <wsdl:operation name="getName"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="getNameRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="getNameResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getSessionID"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="getSessionIDRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="getSessionIDResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getState"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="getStateRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="getStateResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="storeState"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="storeStateRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> <wsdl:output name="storeStateResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloWorldService"> <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort"> <wsdlsoap:address location="http://localhost:8080/SOULSessionService" /> </wsdl:port> </wsdl:service> </wsdl:definitions> TestClient: package de.cenit.tests; import static org.junit.Assert.*; import org.junit.Test; import commonj.sdo.DataObject; import commonj.sdo.helper.XMLHelper; import de.cenit.SOUL.ServiceRuntime.ISOULService; import de.cenit.SOUL.ServiceRuntime.SDOTools; import de.cenit.SOUL.ServiceRuntime.SOULServiceProvider; import de.cenit.SOUL.ServiceRuntime.ISOULSessionService; import de_cenit_SOUL_ServiceRuntime.SOULException; public class SOULSessionServiceTest { @Test public void testExec() { SOULServiceProvider lServiceProvider=new SOULServiceProvider(); SOULServiceProvider lSOULServiceProvider=new SOULServiceProvider(); ISOULSessionService SessionService =lSOULServiceProvider.getService("SOULSessionServiceClient",ISOULSessionService.class); DataObject name = SDOTools.loadSDOFromFile("LogonData","LogonData"); DataObject value =null; try { SessionService.exec((DataObject)name); System.out.println("GETSTATE"); System.out.println("SessionID:"+SessionService.getSessionID("")); SessionService.exec((DataObject)name); System.out.println("SessionID:"+SessionService.getSessionID("")); ISOULSessionService SessionService2 =lSOULServiceProvider.getService("SOULSessionServiceClient",ISOULSessionService.class); SessionService2.exec((DataObject)name); System.out.println("SessionID:"+SessionService2.getSessionID("")); } catch (SOULException e) { String lmsgString=e.getMessage(); System.out.println("MSG:"+lmsgString); String ldoString=e.getDOString(); System.out.println("SDO:"+ldoString); } } } CENIT AG Systemhaus, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.de Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, Muenchen, Saarbruecken Vorstandsmitglieder: Kurt Bengel, Christian Pusch Aufsichtsratsmitglieder: Falk Engelmann (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Dr. Dirk Lippold Bankverbindungen: Deutsche Bank (BLZ 600 700 70) Kto. 1661 040, Commerzbank (BLZ 600 400 71) Kto. 532 015 500, BW-Bank (BLZ 600 501 01) Kto. 2 403 313 Registergericht: Amtsgericht Stuttgart Handelsregister: HRB Nr. 19117 Umsatzsteuer: ID-Nr. DE 147 862 777
