Hi Weihua, I think you can do the following:
CommandService commandService = new CommandService(); ( (BindingProvider) commandService ).getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://server:8082/Command"); Does this help? Best regards Christian Christian Schneider Informationsverarbeitung Business Solutions Handel und Dispatching Tel : +49-(0)721-63-15482 EnBW Systeme Infrastruktur Support GmbH Sitz der Gesellschaft: Karlsruhe Handelsregister: Amtsgericht Mannheim HRB 108550 Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck Geschäftsführer: Jochen Adenau, Hans-Günther Meier -----Ursprüngliche Nachricht----- Von: Weihua JIANG [mailto:[email protected]] Gesendet: Mittwoch, 27. Oktober 2010 08:38 An: [email protected] Betreff: how to ignore soap:address in wsdl for client? Hi all, I want to publish a jax-ws service at some runtime-specified machine. And at client side, use the stub class generated by wsdl2java to dynamically connect to this service. So, at server side, I publish service at https://localhost:8082/Command. And at client side, I use URL serviceAddr = new URL("https", serverAddr, 8082, "/Command?wsdl"); CommandService commandService = new CommandService(serviceAddr); to get client stub object. The main problem in this solution is that the client stub returns the service address as https://localhost:8082/command since the auto-generated wsdl by server has <soap:address location="https://localhost:8082/Command"/> So, the client stub object ref the service at localhost:8082. This prevents the client runing at a different machine than server. My question is: 1. How to make server publish a service at its runtime ip address? That is, when publishing, I only specified port and fragment part, not the server ip part. Or, CXF server dynamically generate wsdl according to the server ip client connect to. 2. Or, how to reset the service ip address in client stub object? Thanks Weihua
