indiWiz.com

Subhash's Tech Log

Archive for the ‘jax-ws’ tag

WebService Client in JAX-WS (Java 6 and above)

without comments

Given a WSDL URL, you may generate the Java client classes using the JDK provided tool wsimport. The basic usage:

$ wsimport <wsdl_url>

The common command-line parameters supported by this tool:

-p specifies the target package
-d folder where generated class files are placed

Written by Subhash Chandran

December 30th, 2008 at 6:10 pm

Posted in Java

Tagged with , ,

Quick WebService in Java 6

without comments

To write a quick JAX-WS webservice in Java 6:

package test;

import javax.xml.ws.Endpoint;

@javax.jws.WebService
public class MyWebService{

  @javax.jws.WebMethod
  public String getQuote(String name){
    return "1234.56";
  }

  public static void main(String[] arg){
    Endpoint end = Endpoint.create(new MyWebService());
    end.publish("http://localhost:1000/MyWebService");
  }
}

To compile and run:

$ apt -d bin/ MyWebService.java
$ java -cp bin test.MyWebService

Written by Subhash Chandran

November 18th, 2008 at 9:16 am

Posted in Java

Tagged with , ,