/** * Old SOAP client uses old SOAP service */ public void useOldSOAPService() throws Exception { URL wsdlURL = getClass().getResource("/CustomerService.wsdl"); com.example.customerservice.CustomerServiceService service = new com.example.customerservice.CustomerServiceService(wsdlURL); com.example.customerservice.CustomerService customerService = service.getCustomerServicePort(); System.out.println("Using old SOAP CustomerService with old client"); customer.v1.Customer customer = createOldCustomer("Barry Old SOAP"); customerService.updateCustomer(customer); customer = customerService.getCustomerByName("Barry Old SOAP"); printOldCustomerDetails(customer); }
/** * Old SOAP client uses new SOAP service with the * redirection to the new endpoint and transformation * on the server side */ public void useNewSOAPServiceWithOldClientAndRedirection() throws Exception { URL wsdlURL = getClass().getResource("/CustomerService.wsdl"); com.example.customerservice.CustomerServiceService service = new com.example.customerservice.CustomerServiceService(wsdlURL); com.example.customerservice.CustomerService customerService = service.getCustomerServiceRedirectPort(); System.out.println("Using new SOAP CustomerService with old client and the redirection"); customer.v1.Customer customer = createOldCustomer("Barry Old to New SOAP With Redirection"); customerService.updateCustomer(customer); customer = customerService.getCustomerByName("Barry Old to New SOAP With Redirection"); printOldCustomerDetails(customer); }
/** * Old SOAP client uses new SOAP service */ public void useNewSOAPServiceWithOldClient() throws Exception { URL wsdlURL = getClass().getResource("/CustomerServiceNew.wsdl"); com.example.customerservice.CustomerServiceService service = new com.example.customerservice.CustomerServiceService(wsdlURL); com.example.customerservice.CustomerService customerService = service.getCustomerServicePort(); // The outgoing new Customer data needs to be transformed for // the old service to understand it and the response from the old service // needs to be transformed for this new client to understand it. Client client = ClientProxy.getClient(customerService); addTransformInterceptors(client.getInInterceptors(), client.getOutInterceptors(), false); System.out.println("Using new SOAP CustomerService with old client"); customer.v1.Customer customer = createOldCustomer("Barry Old to New SOAP"); customerService.updateCustomer(customer); customer = customerService.getCustomerByName("Barry Old to New SOAP"); printOldCustomerDetails(customer); }