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 ) ; }
Old SOAP client uses new SOAP service