web service client

public static void main(String args){
String url="http;//localhost:9080/offer/axis/personWS?wsdl";
Service service=new service();
try{
Call cal=(Call) service.createCall();
call.setTargetEndPointAddress(url);

QName qn=new QName(url,"addPerson");
call.setOperationName(qn);
call.registerTypemapping(person.class,qn,
new BeanSerializerFactory(test.class,qn),
new BeanDeserializerFactory(test.class,qn));

// creation a person object

test vo=new test();

vo.setFirstName("FirstName");
vo.setMiddleName("Middlename");

call.invoke();




}catch(ServiceException e){
e.printStracktrace();
}catch(RemoteException e){
e.printStracktrace();
}


}

2 comments:

  1. serialization exception when calling the client webService can be resolved by above code

    ReplyDelete
  2. for the server side coding verify this blog
    http://java-x.blogspot.com/2007/01/implementing-web-services-with-spring.html

    if ur using complex objects to pass through web service use the above client code

    ReplyDelete