Mark –
The RPCProvider and JavaProvider classes would
be good places to start learning how Axis decodes SOAP elements into a
parameterized method call. Look at how the code creates RPCElements and RPCParams
from introspecting the SOAPBodyElements.
A note of caution thought, the
implementations rely heavily on access to a concrete class definition for the
final service agent. Over the summer, I coded some fixes to this behavior for a
client who desired to define services purely using metadata.
/Chris
http://cvs.apache.org/~haddadc
-----Original Message-----
From: Mark
[mailto:[EMAIL PROTECTED]
Sent: Monday, January
19, 2004 1:41 AM
To: [EMAIL PROTECTED]
Subject: Using a different pattern
to provide services
Hi
I have implemented quite a few web services using Axis in the past and I think
I have a reasonable understanding of how that side of things works. But I now
would like to do something a little more complex, on the server side.
What I want to know is, if it is possible for me to write a handler that can
still decode (ie, convert from XML to Java) the named parameters from a soap
call - without writing a specific Java method? What I would like to do is to
create an object from the (decoded) SOAP parameters, and to pass that to a
class of my choosing.
For example, I would like to be able to implement a simple "add"
service using two classes (a data interface which holds the arguments to the
method, and a concrete implementation), as follows:
public interface AddProperties {
BigDecimal getA();
BigDecimal getB();
}
public class AddCommand {
public Object execute(Object properties)
{
AddProperties addProperties = (AddProperties) properties;
return addProperties.getA().add(addProperties.getB());
}
}
I understand that I could just deploy a "BigDecimal add(BigDecimal a,
BigDecimal b)" but this approach doesn't match my needs. What I want to
know is, how I can intercept the SOAP processing, populate an object, and then
pass that object to another object - instead of just calling a method in a
class with the list of parameters?
So, like I say, I've written plenty of basic SOAP services before, but I have
no idea where to start looking in order to implement the above. For example, is
there a way that I can get the parameters of the SOAP method call converted by
Axis into the Java equivalents? How can I create and deploy the same set of
handlers or handler chains, on a large number of methods?
I also need to be able to include some pre- and post-processing of the message.
I guess that I should use a handler chain to do this, but once again I'm not
sure where to start. Do I declare the handler chain in the WSDD? Or in code? Do
I have to declare it for every deployed service?
Thanks in advance for any help.
Cheers
Mark