[SoapRMI] Using XSOAP to talk to other SOAP servers
Aleksander Slominski
aslom_at_cs.indiana.edu
Sun, 24 Nov 2002 15:27:41 -0500
Mark Swanson wrote:
> I see there is an example of how to do this with the google service. However,
> what if I do not have the interface? What if all I have is the WSDL? Is there
> an easy way to generate the interface from the wsdl?
hi Mark,
you will need some WSDL2Java tool as it is not included in XSOAP.
i think AXIS has such too that can work also from inside ANT.
> Also, I would like to use the same interfaces I use with other SOAP toolkits.
> These interfaces do not extend Remote. I do not see the requirement for XSOAP
> to force its interfaces to extend Remote. Was this done to 'look' similar to
> RMI only?
that is correct - intention is to have look&feel similar to RMI.
> If yes, would you consider making this optional?
this is already optional. you can write client accessing any SOAP
service using XSOAP (see for example HelloClient) the only
things you need is interface and optionally mappings if you want
override request/response names and parameter names
(example how to do this is in Google sample):
SomeServiceInterface ref = (SomeServiceInterface ) secureServices.createStartpoint(
location, // service location like http://host:port/portName
new Class[]{SomeServiceInterface .class}, // remote service interface
"urn:hello:sample", // endpoint name
soaprmi.soap.SoapStyle.IBMSOAP,
"" // SOAPAction
);
and you can call any method from SomeServiceInterface on ref.
if you want to create service accessible by other SOAP toolkits and
your service object does not extend RemoteObject or implement Remote
than use this:
soaprmi.server.Services services = soaprmi.soaprpc.SoapServices.newInstance(port);
services.setMapping(soaprmi.soap.Soap.getDefault().getMapping());
soaprmi.port.Port port = services.createPort(
portName, // give some name for service so it is visible http://host:port/portName
ifaces, //interface that you want your object to expose
obj // your object
);
soaprmi.Remote ref = services.createStartpoint(port);
where ref is actual remote reference to object that is now available as SOAP service
(this reference can be used to in RMI calls to pass by reference instead of by value)
hope it explains it.
thanks,
alek
--
The ancestor of every action is a thought. - Ralph Waldo Emerson