2 Replies Latest reply on Apr 1, 2006 12:52 PM by Jose Manuel Gomez

    Override URL and Port For WS

    Kevin Urciolo Newbie

      I setup a client in jboss following these directions:

      http://wiki.jboss.org/wiki/Wiki.jsp?page=WSDOCClientStepByStep

      However, I need to have the ability to programmatically override the port and url specific in the wsdl. Or, how about in the jboss-client.xml or application-client.xml?

      Thanks.

        • 1. Re: Override URL and Port For WS
          Anders Hedstrom Novice

          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
            Jose Manuel Gomez Newbie

            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;
             }