JBoss Axis deployment question
junkmailer Aug 10, 2004 2:46 PMHi everybody:
I am new to web services. I am trying to learn to create web service using Jboss 3.2.4 on Winddows XP box.
I am trying to deploy the example3 from Axis User Guide's examples. This essentially exposes a simple Java class as a web service. I have everything compiling.
What I am not sure about is where does everything go. I copied the Myservice.class into the \deploy\jboss-net.sar\jboss-net.war\WEB-INF\classes directory. I am presuming that is where it needs to go.
Also I altered the all\deploy\jboss-net.sar\jmx-net.wsr\META-INF\web-service.xml to expose my class. So my final web-service.xml looks like this
<!-- Descriptor for the JMX Adaptor Web Service --> <deployment name="JMX.net" targetNameSpace="http://net.jboss.org/jmx" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:jmx="http://net.jboss.org/jmx" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <documentation>An example JMX-based Web Service</documentation> <!-- this service hits a connector web service that re-exposes the complete MBeanServer API --> <service name="RemoteAdaptor" provider="Handler"> <parameter name="handlerClass" value="org.jboss.net.jmx.server.MBeanProvider"/> <parameter name="ObjectName" value="jboss.net:service=Adaptor"/> <parameter name="allowedMethods" value="invoke isRegistered"/> <parameter name="allowedReadAttributes" value="DefaultDomain"/> </service> <!-- My addition --> <service name="MyService" provider="java:RPC"> <parameter name="className" value="samples.userguide.example3.MyService"/> <parameter name="allowedMethods" value="*"/> </service> <typeMapping qname="jmx:ObjectNameType" type="java:javax.management.ObjectName" serializer="org.jboss.net.jmx.adaptor.ObjectNameSerializerFactory" deserializer="org.jboss.net.jmx.adaptor.ObjectNameDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <typeMapping qname="jmx:AttributeType" type="java:javax.management.Attribute" serializer="org.jboss.net.jmx.adaptor.AttributeSerializerFactory" deserializer="org.jboss.net.jmx.adaptor.AttributeDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </deployment>
Is that all there is deploy a web service to JBoss?
Now I have a client that tries to call this web-service. But I am not having any luck. So I don't know where the problem is.
My client code is as follows
package samples.userguide.example3; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; import org.apache.axis.utils.Options; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; public class Client { public static void main(String [] args) { try { Options options = new Options(args); String endpointURL = options.getURL(); String textToSend; args = options.getRemainingArgs(); if ((args == null) || (args.length < 1)) { textToSend = "<nothing>"; } else { textToSend = args[0]; } Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpointURL) ); call.setOperationName( new QName("http://localhost:8080", "serviceMethod") ); call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING ); String ret = (String) call.invoke( new Object[] { textToSend } ); System.out.println("You typed : " + ret); } catch (Exception e) { System.err.println(e.toString()); } } }
When I run this code I keep getting an error as follows
(404)/axis/servlet/AxisServlet
Since I was not having much luck, I tried to run tcpmon and route my request thru that. And here is the request that gets sent out
POST /axis/servlet/AxisServlet HTTP/1.0 Content-Type: text/xml; charset=utf-8 Accept: application/soap+xml, application/dime, multipart/related, text/* User-Agent: Axis/1.1 Host: 127.0.0.1 Cache-Control: no-cache Pragma: no-cache SOAPAction: "" Content-Length: 466 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:serviceMethod soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://localhost:8080"> <arg1 xsi:type="xsd:string"><nothing></arg1> </ns1:serviceMethod> </soapenv:Body> </soapenv:Envelope>
Could somebody give me some pointers on what I need to do to get this working?
Thank you.