FileDocCategorySizeDatePackage
EmployeeClient.javaAPI DocApache Axis 1.42373Sat Apr 22 18:56:52 BST 2006samples.faults

EmployeeClient

public class EmployeeClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        Options opts = new Options(args);
        String uri = "http://faults.samples";
        String serviceName = "EmployeeInfoService";
        ServiceFactory serviceFactory = ServiceFactory.newInstance();
        Service service = serviceFactory.createService(new QName(uri, serviceName));
        
        TypeMappingRegistry registry = service.getTypeMappingRegistry();
        TypeMapping map = registry.getDefaultTypeMapping();
        
        QName employeeQName = new QName("http://faults.samples", "Employee");
        map.register(Employee.class, employeeQName, new BeanSerializerFactory(Employee.class, employeeQName), new BeanDeserializerFactory(Employee.class, employeeQName));

        QName faultQName = new QName("http://faults.samples", "NoSuchEmployeeFault");
        map.register(NoSuchEmployeeFault.class, faultQName, new BeanSerializerFactory(NoSuchEmployeeFault.class, faultQName), new BeanDeserializerFactory(NoSuchEmployeeFault.class, faultQName));
        
        Call call = service.createCall();
        call.setTargetEndpointAddress(new URL(opts.getURL()).toString());
        call.setProperty(Call.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
        call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
        call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://faults.samples");
        call.setOperationName( new QName(uri, "getEmployee") );

        String[] args2 = opts.getRemainingArgs();
        System.out.println("Trying :" + args2[0]);
        Employee emp = (Employee) call.invoke(new Object[]{ args2[0] });
        System.out.println("Got :" + emp.getEmployeeID());