JBoss Community

Re: Bizzare host re-write in JAX-WS client on JB7.0.2

created by Alessio Soldano in JBoss Web Services - View the full discussion

I believe your use case might be a bit different from the JBWS-3260 one as you basically have the jaxws client running inside a jaxws endpoint business method. You are probably ending up using the server side bus that's started at deploy time for dealing with the endpoint. Just before each invocation of your endpoint business methods, the engine saves a references to the thread bus and then restores it when your business method is over. Your client should no be using the AddressRewritingEndpointInfo; that is installed by the SoapTransportFactoryExt, which is only added to the server side bus instances. One option you have to properly isolate your client environment (bus) from your server one is wrapping your client code into a try-finally block to set a different thread default bus isntance (for client only):

 

 

Bus mybus = BusFactory.newInstance().createBus();

...

try {

  Bus orig = BusFactory.getThreadDefaultBus();

  BusFactory.setThreadDefaultBus(mybus);

  ... client usage ...

} finally {

  BusFactory.setThreadDefaultBus(orig);

  ... evaluate shutting down mybus or storing it somewhere if you don't want to rebuild it...

}

 

 

I'll check if there's a better solution for dealing this scenario.

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community