Well, not entirely, John! Do you want the client to set the endpoint of the target machine by calling an endpoint-setting method on X?
Jeff ----- Original Message ----- From: "John Baker" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, June 24, 2005 6:21 AM Subject: Re: Dynamic Endpoints > I think the answer to my question is: > > <soap:service location="http://blah.com" /> > > So I can define this in the wsdd, but I wish to set it at runtime. I am > doing the following: > > - Using wsdl2java to create Java stubs, with a deploy.wsdd, > - Altering the deploy.wsdd to deploy the Stub, > - Deploying to Axis server (we'll call this X), > - Calling X and hoping it will then make another WS call.. > > I.e.. > > My client <--> X <--> Target machine. > > This is fine if I want to set the location declaration in the deploy.wsdd, > but what I would like to do is set it at runtime. So the web application on > X will start, walk a set of services and set a location (not statically). > > Does this clarify things? > > > John > > > On Fri, Jun 24, 2005 at 10:43:28AM +0100, John Baker wrote: > > Ok. > > > > Can I start by asking, given this: > > > > <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/" > > xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> > > <service name="Example" provider="java:RPC"> > > <parameter name="className" value="com.blah.Example"/> > > <parameter name="allowedMethods" value="login logout getDate"/> > > <parameter name="wsdlServicePort" value="Example"/> > > </service> > > </deployment> > > > > Can you tell me how to add the XML declaration to set the endpoint? > > > > > > John > > > > > > On Thu, Jun 23, 2005 at 05:02:06PM -0400, Jeff wrote: > > > Sorry, John, my little brain need more input! Please given a comprehensive > > > explanation of exactly how you want you software to behave. > > > > > > > > > > > > ----- Original Message ----- > > > From: "John Baker" <[EMAIL PROTECTED]> > > > To: <[email protected]> > > > Sent: Friday, June 24, 2005 4:58 AM > > > Subject: Re: Dynamic Endpoints > > > > > > > > > > I am specifically talking about setting wsdd parameters/service-locators > > > > programatically. I.e I have a wsdd which defines a service, and I want to > > > > alter the service-locator through some other random part of a web app :) > > > > > > > > On Thu, Jun 23, 2005 at 04:43:35PM -0400, Jeff wrote: > > > > > It depends on how dynamic you want things to be. If you are talking > > > about > > > > > server-side wsdd then you could just as well declare parameters in > > > web.xml > > > > > and retrieve values using the standard servlet API. > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > From: "John Baker" <[EMAIL PROTECTED]> > > > > > To: <[email protected]> > > > > > Sent: Friday, June 24, 2005 4:38 AM > > > > > Subject: Re: Dynamic Endpoints > > > > > > > > > > > > > > > > Well you can specify a soap:locator in the wsdd file. That's loaded > > > into > > > > > the > > > > > > internal Port instances. But how does one look them up > > > programatically? > > > > > > > > > > > > On Thu, Jun 23, 2005 at 04:25:25PM -0400, Jeff wrote: > > > > > > > Not too sure about 'stuff' either :-) > > > > > > > > > > > > > > Each service has an endpoint which is, presumably, better than a > > > name. > > > > > Where > > > > > > > do you anticipate getting the names/endpoints from? > > > > > > > > > > > > > > > > > > > > > I just re-read your original posting, John. > > > > > > > > > > > > > > Suppose there are three computers, A, B and C. Suppose too that A > > > runs > > > > > the > > > > > > > simple client that calls into the service on B and that the service > > > on B > > > > > > > uses client-side code (stub) to call into the service on C. > > > > > > > > > > > > > > Are you expecting client A to call service B with setLocationURI() > > > to > > > > > set > > > > > > > the endpoint and then subsequently client A calls into service B > > > which > > > > > > > results in service B using the pre-set endpoint to call into service > > > C? > > > > > > > > > > > > > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > > From: "John Baker" <[EMAIL PROTECTED]> > > > > > > > To: <[email protected]> > > > > > > > Sent: Friday, June 24, 2005 4:20 AM > > > > > > > Subject: Re: Dynamic Endpoints > > > > > > > > > > > > > > > > > > > > > > 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" <[EMAIL PROTECTED]> > > > > > > > > > To: <[email protected]> > > > > > > > > > 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" <[EMAIL PROTECTED]> > > > > > > > > > > > To: <[email protected]> > > > > > > > > > > > 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" <[EMAIL PROTECTED]> > > > > > > > > > > > > > To: <[email protected]> > > > > > > > > > > > > > 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 > > > > > > > > > > > > > <wsdl:service > > > > > > > > > > > > > > > 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" <[EMAIL PROTECTED]> > > > > > > > > > > > > > > > To: <[email protected]> > > > > > > > > > > > > > > > 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
