This discussion is archived
1 Reply Latest reply: Aug 19, 2012 11:34 AM by 904010 RSS

Getting javax.xml.rpc.ServiceException while calling from client

904010 Newbie
Currently Being Moderated
I created a simple dynamic web project (MyWebServiceProject) in eclipse and TraderBean class as follows,
  package examples.ejb.ejb20.basic.statelessSession;

    public class TraderBean {
    public TraderBean() {
    public String buy(int nt, String ss) {
    return "Stock " + ss + " bought for " + nt;
Created a web service for this class and when I tested the created wsdl using "Test with web services explorer" , it was successfull.

buyReturn (string): Stock inr bought for 66

Now I wanted to test calling this from a web service client. For this I created a Web service client and given the created wsdl (http://localhost:7001/MyWebServiceProject/services/TraderBean?wsdl)

Note: I created the client in the same project and it overwritten the TraderBean file as follows,
     * This file was auto-generated from WSDL
     * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
    package examples.ejb.ejb20.basic.statelessSession;
    public interface TraderBean extends java.rmi.Remote {
        public java.lang.String buy(int nt, java.lang.String ss) throws java.rmi.RemoteException;
I am wondering if this is a problem for my exception?

Also it created other files like,,,

Then I created HelloClient as follows,
    package examples.ejb.ejb20.basic.statelessSession;
    import javax.xml.namespace.QName;
    public class HelloClient {
        String url = "http://localhost:7001/MyWebServiceProject/services/TraderBean?wsdl";
               QName qname = new QName("http://statelessSession.basic.ejb20.ejb.examples", "TraderBeanService");
        public static void main(String[] args) {
            try {
                HelloClient client = new HelloClient();
            } catch(Exception e) {
        public void doTest(String[] args) {
            try {
                  TraderBeanServiceLocator service = new TraderBeanServiceLocator();
                  TraderBean port = (TraderBean) service.getPort(TraderBeanServiceLocator.class);
                System.out.println("Invoking the sayHello operation on the port.");
                String response =, "INR");
            } catch(Exception e) {
When I run it as java application I am getting,

javax.xml.rpc.ServiceException: There is no stub implementation for the interface: examples.ejb.ejb20.basic.statelessSession.TraderBeanServiceLocator

I tried changing calling getPort to,

TraderBean port = (TraderBean) service.getPort(TraderBean.class);

Now I got,

java.lang.InstantiationException: examples.ejb.ejb20.basic.statelessSession.TraderBean

Any help is appreciated ! Thanks


  • Correct Answers - 10 points
  • Helpful Answers - 5 points