[MOBY-l] registering an axis web service
Benjamin Good
bmg at sfu.ca
Thu Jun 17 09:09:41 UTC 2004
>
>1. Concerning the service setting. How do you deploy your service in AXIS,
>could I get the code to deploy it on my local test?
>
>
For the simplest possible service that I have got to work.., the clode
for the class is:
public class AxisEcho {
// echo the request as a byte array - this will result in axis using
the base64 encoding type required by moby
public static byte[] echoByteArray(String xml_input) {
byte[] input_byte = xml_input.getBytes();
return input_byte;
}
}
Compile this and put the class file in the axis/WEB-INF/classes
directory. Then deploy it by writing a .wsdd file like this
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="AxisEcho" provider="java:RPC" style="rpc" use="encoded">
<parameter name="className" value="AxisEcho"/>
<parameter name="allowedMethods" value="echoByteArray"/>
</service>
</deployment>
and deploy
java org.apache.axis.client.AdminClient my_deploy.wsdd
next restart tomcat.
next register the service. I've just been using the perl code to do
this although I know you can do it with Martin's java command line
client as well.
Here is the relevant code:
sub register_service {
#$C is the moby-central instance
my $C = shift;
my $reg = $C->registerService(
serviceName => $sname,
authURI => $authURI,
contactEmail => $email,
description => "Another axis service for testing",
URL => $url,
input => [ ['', ["Object" => []]], ],
output => [ ['', ["Object" => []]], ],
category => "moby",
serviceType => "Retrieval",
);
die "Bad return value from registerService" unless $reg;
if ($reg->success == 1){
print "Registration successful\n\n";
}
else {
print "Registration failed: ", $reg->message, "\n";
}
}
There are more examples of perl registration code at
http://biomoby.org/moby-live/Perl/scripts/testMOBYClientCentral_v05.pl
>2. Concerning the http://localhost:8080/axis/services/biomoby.services
><http://localhost:8080/axis/services/biomoby.services>
>
>My understanding is , your class name is EchoXML, and RPC method is
>echoXMLString, which return a xml file following MOBY response policy (not
>in detail here). Is that right ?
>
>
Thats the idea. Sorry for leaving an unreachable URL up there - I guess
maybe that helped push Mark to put up the test central :)
>3. In your June 9 email,
>
>
>>>Registration
>>>succeeds, but I can't get anything back from the service.
>>>
>>>
>Do you mean you when you query the service list, you can not find your
>registration? I succeed in register and query my registration using Sanger's
>MobyCmdLineClient.java. Could try it to see if it helps
>
I was actually using the wrong name.. You can register anything, there
is no error-checking for bad urls or method names at the time of
registration. So, if you put up an incorrect name you can see it, but
will get a service returned no response message when you try to access it.
>>>wsdl generated by MobyCentral doesn't match the WSDL generated locally
>>>
>>>
>
>
>
>You list the WSDL file which I think got by
>
>http://localhost:8080/axis/services/YOURDEFINE?wsdl
><http://localhost:8080/axis/services/YOURDEFINE?wsdl>
>
>right? So Is that what your meaned "generated by MobyCentral" or "the WSDL
>generated locally" ?
>
>
This is what I mean by generated locally. If you check the wsdl coming
back from requests to moby central you will see a much stripped down
version of the wsdl supplied by axis.
One of my goals for the next few weeks or so is to produce a complete
working example of an axis moby service that can be deployed in tomcat
immediately as a war file. Hopefully that will help get other newbie
java developers such as myself who are also new to web services and moby
up and running faster.
I still have not convinced the sysadmin to open my tomcat port so can't
share my services just yet :(
Hope that helps a bit, see also the mail from Viji.
-Ben
More information about the moby-l
mailing list