bNd
bNd

Reputation: 7640

How to pass parameter while calling CXF webservice by url

I have created one CXF webservice sample:

@WebService
public interface InterfaceWebService {

    boolean doLogin(@WebParam(name="username")String username,@WebParam(name="password")String password);

}

Server code:

public class WebServer {

    protected WebServer() throws Exception {
        // START SNIPPET: publish
        System.out.println("Starting Server");
        WebServiceImpl implementor = new WebServiceImpl();
        String address = "http://192.168.0.76:9000/sample";
        Endpoint.publish(address, implementor);
        // END SNIPPET: publish
    }

    public static void main(String args[]) throws Exception {
        new WebServer();
        System.out.println("Server ready...");

        Thread.sleep(5 * 60 * 5000);
        System.out.println("Server exiting");
        System.exit(0);
    }
}

WebServiceImpl class

@WebService(endpointInterface = "com.nextenders.services.InterfaceWebService",
serviceName = "sample")

public class WebServiceImpl  implements InterfaceWebService{    


    @Override
    public boolean doLogin(String username, String password) {
          //Here some business logic call
        return true;
    }


}

Now I am trying to call this webservice through below url: http://192.168.0.76:9000/sample/services/doLogin?username=abc&password=abc

But I am getting wsdl xml structure. but I required only particular method result!!. am I doing any wrong here? how can I pass parameter in CXF webservice?

Upvotes: 1

Views: 3045

Answers (1)

bNd
bNd

Reputation: 7640

The problem is solved. I forgot to put service name and try to access direct method.

http://192.168.0.76:9000/sample/services/login_service/doLogin?username=abc&password=abc

Upvotes: 2

Related Questions