Discovered how to do this in Axis: pluggable
providers.

Axis's pluggable provider architecture permits you to
specify that a service should use your provider rather
than the Axis provider.  The only doc I found on how
to do this was in the code.

Here's what I did:

Basically you'll need to create two classes: one that
is your new provider, and one that provides an
instance of the new provider (the "provider
provider").  You'll also have to tell Axis, thru the
service provider mechanism of your jar file, how to
find the new 'provider provider'.

First make a new provider: mine's java and is
responsible for RPC services, so I extended
org.apache.axis.providers.java.RPCProvider and
over-rode invokeMethod, checkMethodName and
processMessage, and generateWSDL methods.  (I've
started w/ RPCProvider just to get my provider working
- I may end up extending a superclass if I don't need
the features in RPCProvider.)

Now for the provider provider: I extended
org.apache.axis.deployment.wsdd.WSDDProvider, and
over-rode the getName method to return "NYW" and
newProviderInstance method to return a new instance of
my provider.

Finally you have to tell Axis where to find your
provider, using the service provider mechanism of a
jar file (see
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider
).  Create a text file named
"org.apache.axis.deployment.wsdd.Provider", and inside
the file put the fully-qualified name of your
provider.  Then create a jar file w/ your classes, and
the text file in the META-INF/services directory (I
used the metainf tag in an Ant jar task to put the
text file in the right place).

You can specify your provider for a service by setting
the provider attribute to java: plus the name your
provider provider returns from the getName method - in
my case, <service name="MyService"
provider="java:NYW">.

If you want to see how Axis does this, grab the source
and examine loadPluggableProviders() in
org.apache.axis.deployment.wsdd.WSDDProvider.

-Jim

--- jim hopp <[EMAIL PROTECTED]> wrote:

> I'm trying to figure out how to implement a service
> (actually, a bunch of services) and I'd like to hear
> (informed) opinions from the list on two questions.
> 
> I'm attempting to expose the reporting portion of an
> XML-based ERP system via web services.  The ERP
> system
> has a mechanism that permits users to build reports.
> 
> I'd like to expose every report as a web service. 
> Some of the reports take parameters, others don't.
> 
> (Since my system is XML-based I've already created a
> message service that takes XML in and returns XML. 
> I
> don't want to use that as the basis for the reports
> because it requires knowing XML and knowing the
> system's schema.) 
> 
> I'd rather each report was exposed as an operation,
> so
> a developer (or tool) could look at the WSDL and
> invoke the operations they wished, passing the
> necessary parms and understanding what was returned.
>  
> 
> So question #1: What's the best way to generate the
> WSDL?  I know I can create a file w/ the WSDL and
> reference it via the wsdlFile attribute, but I'd
> like
> to create it dynamically when someone asks for it
> since the user reports can be changed.  Can I do it
> by
> implementing a QSHandler for the ?wsdl query?
> 
> I also don't want to create Java classes for all of
> the complexTypes (Invoice, Customer, Vendor,
> Employee,
> etc) because there are many of them and they also
> can
> change.  What I'd like to do is build the report
> request directly from the SOAPElements in the
> request,
> run the report, and then generate the SOAPElements
> in
> the response.
> 
> This is what org.apache.axis.providers.RPCProvider
> does (by invoking the method referenced in the
> <service> tag).  Is the best approach to simply
> implement my own Provider, basing it on RPCProvider?
> 
> Or is there a better approach?  Being a lazy
> programmer, I want to write as little code as
> possible
> and leverage as much of Axis as possible.
> 
> Thanks for any thoughts.
> 


Reply via email to