axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jba...@sasami.atomised.org (John Baker)
Subject Re: Dynamic Endpoints
Date Fri, 24 Jun 2005 08:20:13 GMT
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" <jbaker@sasami.atomised.org>
> To: <axis-user@ws.apache.org>
> 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" <jbaker@sasami.atomised.org>
> > > To: <axis-user@ws.apache.org>
> > > 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" <jbaker@sasami.atomised.org>
> > > > > To: <axis-user@ws.apache.org>
> > > > > 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" <jbaker@sasami.atomised.org>
> > > > > > > To: <axis-user@ws.apache.org>
> > > > > > > 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

Mime
View raw message