This content has been marked as final.
Show 2 replies
-
1. Re: Override URL and Port For WS
anders.hedstrom Mar 30, 2006 1:50 AM (in response to greenbean)I guess you could try something like this:
Your service interface class implements javax.xml.rpc.Service interface, this interface gives you a couple of methods you could use:java.rmi.Remote getPort(java.lang.Class serviceEndpointInterface) java.rmi.Remote getPort(javax.xml.namespace.QName portName, java.lang.Class serviceEndpointInterface)
Your SEI class implements javax.xml.rpc.Stub interface and here you can use the method _setProperty((Stub)myport)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,"my_endpoint");
-
2. Re: Override URL and Port For WS
irisel Apr 1, 2006 12:52 PM (in response to greenbean)I am using JWSDP. It generates a Impl and Stub class.
Some people do a explicit cast when using the _Impl class, to get the reference to the Stub, to set the properties we need. I chose to extend the Impl class in this way:public com.irisel.oms.ws.client.OMBrowserEndpoint getOMBrowserEndpointPort(String url) { String[] roles = new String[] {}; HandlerChainImpl handlerChain = new HandlerChainImpl(getHandlerRegistry().getHandlerChain(new QName("http://com.irisel.oms.ws", "OMBrowserEndpointPort"))); handlerChain.setRoles(roles); com.irisel.oms.ws.client.OMBrowserEndpoint_Stub stub = new com.irisel.oms.ws.client.OMBrowserEndpoint_Stub(handlerChain); try { stub._initialize(super.internalTypeRegistry); stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url); } catch (JAXRPCException e) { throw e; } catch (Exception e) { throw new JAXRPCException(e.getMessage(), e); } return stub; } public com.irisel.oms.ws.client.OMBrowserEndpoint getOMBrowserEndpointPort(String url,String user,String pwd) { OMBrowserEndpoint_Stub stub = (OMBrowserEndpoint_Stub) this.getOMBrowserEndpointPort(url); stub._setProperty(Stub.USERNAME_PROPERTY,user); stub._setProperty(Stub.PASSWORD_PROPERTY,pwd); return stub; }