Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 16292 invoked from network); 24 Jun 2005 08:19:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Jun 2005 08:19:48 -0000 Received: (qmail 74411 invoked by uid 500); 24 Jun 2005 08:19:38 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 74402 invoked by uid 500); 24 Jun 2005 08:19:38 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 74388 invoked by uid 99); 24 Jun 2005 08:19:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2005 01:19:38 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [194.153.168.129] (HELO sasami.atomised.org) (194.153.168.129) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2005 01:19:38 -0700 Received: by sasami.atomised.org (Postfix, from userid 1003) id CD590B71C0; Fri, 24 Jun 2005 09:20:13 +0100 (BST) Date: Fri, 24 Jun 2005 09:20:13 +0100 To: axis-user@ws.apache.org Subject: Re: Dynamic Endpoints Message-ID: <20050624082013.GA4116@sasami.atomised.org> References: <20050623115750.GC11461@sasami.atomised.org> <048901c577d6$6b573070$0c00000a@thesiger> <20050624071948.GA17473@sasami.atomised.org> <04d101c5782e$8df54f60$0c00000a@thesiger> <20050624080628.GA18823@sasami.atomised.org> <04d601c5782f$71766df0$0c00000a@thesiger> <20050624080938.GB18823@sasami.atomised.org> <04e001c5782f$f0da94e0$0c00000a@thesiger> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <04e001c5782f$f0da94e0$0c00000a@thesiger> User-Agent: Mutt/1.5.9i From: jbaker@sasami.atomised.org (John Baker) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Well I assume each Service has a name, so looking it up by name would be nice. I assume that the deploy.wsdd is parsed and 'stuff' is created internally... On Thu, Jun 23, 2005 at 04:12:54PM -0400, Jeff wrote: > Dunno about clean. Dunno about looking up instances of a service. What > criteria are you using for choosing between the different service instances? > > > ----- Original Message ----- > From: "John Baker" > To: > Sent: Friday, June 24, 2005 4:09 AM > Subject: Re: Dynamic Endpoints > > > > Yep. I appreciate I could use a static method, but this doesn't seem very > > 'clean'... And I'm quite intrigued to how one looks up instances of a > > service (or rather, the factory that creates them) through Axis.. > > > > > > John > > > > On Thu, Jun 23, 2005 at 04:09:20PM -0400, Jeff wrote: > > > Do you mean two or three different instances of the same service? > > > > > > > > > ----- Original Message ----- > > > From: "John Baker" > > > To: > > > Sent: Friday, June 24, 2005 4:06 AM > > > Subject: Re: Dynamic Endpoints > > > > > > > > > > > > > > That's one way. But I may wish to deploy the same class on two or > three > > > > different services and set some parameters differently, hence I'm > > > wondering > > > > how to look it up by service/port ..? > > > > > > > > On Thu, Jun 23, 2005 at 04:02:59PM -0400, Jeff wrote: > > > > > I cannot see the problem! Just create a static method for your stub > and > > > use > > > > > it to initialize the endpoint. > > > > > > > > > > > > > > > Jeff > > > > > > > > > > ----- Original Message ----- > > > > > From: "John Baker" > > > > > To: > > > > > Sent: Friday, June 24, 2005 3:19 AM > > > > > Subject: Re: Dynamic Endpoints > > > > > > > > > > > > > > > > Quite, but this isn't precisely what I meant. I'm generating a > > > deploy.wsdd > > > > > > file and deploying the Stub itself. So when Axis creates instances > of > > > the > > > > > > Stub, the cachedEndpoint variable (inherited from Stub.java) is > null. > > > I'd > > > > > > like to set this programatically from another part of the web > > > application > > > > > > (Axis is integrated into my own webapp). > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > John > > > > > > > > > > > > On Thu, Jun 23, 2005 at 05:32:05AM -0400, Jeff wrote: > > > > > > > For a service called MyService, i.e. your WSDL file contains > > > > > > > > > > > name="MyService">, source code generated by WSDL2Java will > contain > > > > > classes > > > > > > > with these (or similar) names (amongst others): > > > > > > > > > > > > > > MyServiceLocator > > > > > > > MyServiceSoap > > > > > > > MyServiceSoapStub > > > > > > > > > > > > > > You can then invoke myMethod() against the service using code > like: > > > > > > > > > > > > > > String strEndpointAddress = ... > > > > > > > MyServiceLocator locator = new MyServiceLocator(); > > > > > > > locator.setMyServiceSoapEndpointAddress(strEndpointAddress); > > > > > > > MyServiceSoapStub stub = > > > > > > > (MyServiceSoapStub)locator.getPort(MyServiceSoap.class); > > > > > > > stub.myMethod(); > > > > > > > > > > > > > > > > > > > > > > > > > > > > Jeff > > > > > > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > > From: "John Baker" > > > > > > > To: > > > > > > > Sent: Thursday, June 23, 2005 7:57 AM > > > > > > > Subject: Dynamic Endpoints > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > I'm trying to simplify the configuration of a pre-packaged > Axis > > > server > > > > > > > which > > > > > > > > already has a bunch of services deployed. I'd like users to be > > > easily > > > > > be > > > > > > > > able to set the endpoint on services that were generated from > > > wsdl, so > > > > > I'm > > > > > > > > using the Java stub as my deployed service. You can think of > this > > > > > model as > > > > > > > a > > > > > > > > proxy, in a rather simple sense; it does nothing more than > call > > > the > > > > > same > > > > > > > > service on another server. > > > > > > > > > > > > > > > > I appreciate that it's possible to set an endpoint for a > service > > > > > through a > > > > > > > > deploy.wsdd file. However I would like to do this dynamically > and > > > am > > > > > > > > wondering how I would do this? I think I need to set the > parameter > > > > > > > > dynamically so everytime an instance of a service is created, > an > > > > > endpoint > > > > > > > is > > > > > > > > set. > > > > > > > > > > > > > > > > I've got something like this: > > > > > > > > > > > > > > > > org.apache.axis.client.Service service = > > > > > > > > > org.apache.axis.client.ServiceFactory.getService("MyService"); > > > > > > > > Iterator pi = service.getPorts(); > > > > > > > > javax.wsdl.Port port; > > > > > > > > while (pi.hasNext()) > > > > > > > > { > > > > > > > > port = (javax.wsdl.Port)pi.next(); > > > > > > > > port.addExtensibilityElement(new > > > > > > > SOAPAddressImpl("http://localhost:9090/hello")); > > > > > > > > } > > > > > > > > > > > > > > > > But I suspect it would have to be a little more advanced than > my > > > > > simple > > > > > > > > example :) > > > > > > > > > > > > > > > > I'd also need to write my own SOAPImpl: > > > > > > > > > > > > > > > > protected class SOAPAddressImpl implements > > > > > > > javax.wsdl.extensions.soap.SOAPAddress > > > > > > > > { > > > > > > > > private QName elementType; > > > > > > > > private Boolean required; > > > > > > > > private String uri; > > > > > > > > > > > > > > > > public SOAPAddressImpl(String uri) > > > > > > > > { this.uri = uri; } > > > > > > > > > > > > > > > > public void setElementTpe(QName elementType) > > > > > > > > { this.elementType = elementType; } > > > > > > > > > > > > > > > > public QName getElementType() > > > > > > > > { return (elementType); } > > > > > > > > > > > > > > > > public void setRequired(Boolean required) > > > > > > > > { this.required = required; } > > > > > > > > > > > > > > > > public Boolean getRequired() > > > > > > > > { return (required); } > > > > > > > > > > > > > > > > public void setLocationURI(String uri) > > > > > > > > { this.uri = uri; } > > > > > > > > > > > > > > > > public String getLocationURI() > > > > > > > > { return (uri); } > > > > > > > > } > > > > > > > > > > > > > > > > But I'm not sure what the elementType of required flag would > > > require? > > > > > > > Having > > > > > > > > read the Axis source, I don't think they are used by the > > > > > client.Service > > > > > > > class anyway. > > > > > > > > > > > > > > > > Any thoughts/pointers? > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > > > > > > > John Baker