I have a stateful WebService and a stateless one, which returns a EndPointReference to a new Instance of the stateful webservice. Like the example in this blog https://weblogs.java.net/blog/kohsuke/archive/2006/10/stateful_web_se.html
@Stateful
@WebService
@Addressing
class BankAccount {
protected final int id;
private int balance;
public BankAccount(int id) { this.id = id; }
@WebMethod
public void deposit(int amount) { balance+=amount; }
// either via a public static field
public static StatefulWebServiceManager<BankAccount> manager;
}
..
@WebService
class Bank { // this is ordinary stateless service
@WebMethod
public synchronized W3CEndpointReference login(int accountId) {
BankAccount acc = new BankAccount(accountId);
return BankAccount.manager.export(acc);
}
}
But when I run the client and call the stateless service method "login" I get following Exception:
javax.xml.ws.WebServiceException: No address is available for {http://server.stateful
/}BankAccountPort
What I am doing wrong?