0

I am new to web service programming. I have created one JAX-WS SOAP web service and deployed it locally. I am writing client in java to invoke the service. Basically, this service takes two integers and returns the sum of them. I have written the following JAX-WS client in java.

public class WebserviceClient {

    public static void main(String[] args) throws Exception {

        URL url = new URL
                ("http://localhost:9999/ws/additionService?wsdl");

        QName qname = new QName("http://test/", 
                "AdditionServiceImplService");

        Service service = Service.create(url, qname);

        AdditionService additionService = service
                .getPort(AdditionService.class);

        System.out.println(additionService.add(1, 2));

The above code is working fine. But, in this code I need to create QName by passing the targetNamespace and name of the service. I want to know whether constructing QName is mandatory? Since, I am already passing the WSDL URL, no point creating QName with the WSDL targetnamespace string. Is there any alternative approach available?

Kristina
  • 23
  • 4
  • What is package name where this class is located ? – JBaba Sep 01 '15 at 18:55
  • You may find some usefull links for alternative ways of creating web service clients in the answers of [this](http://stackoverflow.com/questions/16537236/how-to-create-a-helloworld-jax-ws-example-client-service) stackoverflow question. – sanastasiadis Sep 06 '15 at 12:25

0 Answers0