Hi all,
I have a problem with sessions in POJOs and couldn't find an answer in
the forums or in the list archive. I hope someone here can help me.
Therefore I created a minimal example for my problem.
I publish the following POJO as Web Service:
---MyService.java-----------------------------------------------------
public class MyService {
public String echo(String s) {
return "You said: " + s;
}
}
----------------------------------------------------------------------
My main application that creates the configuration context and starts
the server:
---------App.java-----------------------------------------------------
package my.wsimpl;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.transport.http.SimpleHTTPServer;
public class App {
public static void main(String[] args) throws AxisFault,
UnknownHostException {
String pathToRepository = "D:/WS/Axis2WS/MinAddPrj/lib/axis2";
ConfigurationContext context = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(pathToRepository, null);
context.getAxisConfiguration().
engageModule(Constants.MODULE_ADDRESSING);
// get the host name
String hostname = InetAddress.getLocalHost().getCanonicalHostName();
context.getAxisConfiguration().addParameter("hostname", hostname);
// create the service, set the scope and engage module
AxisService myService = AxisService.createService(
MyService.class.getName(),
context.getAxisConfiguration());
myService.setScope(Constants.SCOPE_SOAP_SESSION);
myService.engageModule(context.getAxisConfiguration().
getModule(Constants.MODULE_ADDRESSING));
context.getAxisConfiguration().addService(myService);
// start the server
new SimpleHTTPServer(context, 8080).start();
}
}
----------------------------------------------------------------------
If I make a request on the service I receive a correct response, so the
service is running and working. My problem now is that no session id was
included in the response. This is all I get:
---------Response-----------------------------------------------------
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:echoResponse xmlns:ns="http://wsimpl.my">
<return>You said: Hello world</return>
</ns:echoResponse>
</soapenv:Body>
</soapenv:Envelope>
----------------------------------------------------------------------
Because I want to have stateful services (with login) I thought that
Axis would create a session id and send it in the response if I engage
the addressing module and configure the scope of the service.
What's wrong with my approach?
Reinhold
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]