0 Replies Latest reply on Apr 26, 2008 11:20 AM by thoste

    How to write a Client for this simple wsconsume output?

    thoste

      I have difficulties to write simple Client which access an existing Web Service.
      The output of wsconsume on the WSDL can be seen below.

      How would such a client.java look like?

      Particularly I am interested in the necessary import statements.

      Which classes and *.jars do I have to include in the CLASSPATH minimally ?



      package ttest.ws.sumtest;

      import java.net.MalformedURLException;
      import java.net.URL;
      import javax.xml.namespace.QName;
      import javax.xml.ws.Service;
      import javax.xml.ws.WebEndpoint;
      import javax.xml.ws.WebServiceClient;

      /**
      * This class was generated by the JAX-WS RI.
      * JAX-WS RI 2.1.1-b03-
      * Generated source version: 2.0
      *
      */
      @WebServiceClient(name = "SumService", targetNamespace = "http://sumtest.ws.ttest/", wsdlLocation = "http://127.0.0.1:8777/SumDemo?wsdl")
      public class SumService
      extends Service
      {

      private final static URL SUMSERVICE_WSDL_LOCATION;

      static {
      URL url = null;
      try {
      url = new URL("http://127.0.0.1:8777/SumDemo?wsdl");
      } catch (MalformedURLException e) {
      e.printStackTrace();
      }
      SUMSERVICE_WSDL_LOCATION = url;
      }

      public SumService(URL wsdlLocation, QName serviceName) {
      super(wsdlLocation, serviceName);
      }

      public SumService() {
      super(SUMSERVICE_WSDL_LOCATION, new QName("http://sumtest.ws.ttest/", "SumService"));
      }

      /**
      *
      * @return
      * returns Sum
      */
      @WebEndpoint(name = "SumPort")
      public Sum getSumPort() {
      return (Sum)super.getPort(new QName("http://sumtest.ws.ttest/", "SumPort"), Sum.class);
      }

      }