Alas, I'm having all sorts of problems out of the starting block. To
start, my sample application works fine. My service is:
package com.arete.Webservices;
public class Sample {
public String echoString(String what) {
return what;
}
}
I compile that and distribute it as a WAR file, the only warning I get
from JBoss (which I assume I can ignore) is:
11:51:00,269 ERROR [EngineConfigurationFactoryServlet] Unable to find
config file. Creating new servlet engine config
file: /WEB-INF/server-config.wsdd
Anyway - I whip up a WSDL file, looking like this:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Sample" provider="java:RPC">
<parameter name="className"
value="com.arete.Webservices.Sample"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
So far so good. I use the Adminclient to punch that out to axis. Works
great. I can get the WSDL from the server
(http://localhost:8080/axis/services/Sample?wsdl) and I can invoke the
class (http://localhost:8080/axis/services/Sample?method=echoString).
My sample SOAP client connects and runs the method fine. Code snippet
from teh SOAP client:
String endpoint = "http://localhost:9080/axis/services/Sample";
Service service = new Service();
Call call = (Call) service.createCall();
System.out.println("Pinging 'Sample' webservice method
'echoResponse'...");
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("echoString"));
System.out.println("invoking...");
String ret = (String) call.invoke( new Object[] { new
String("Hello!") } );
System.out.println("Sent 'Hello!', got '" + ret + "'");
But, this is very simple encoding. I'll need to pass more than just
primitives around, so I change my WSDL 'service' line to:
<service name="Sample" style="document" provider="java:RPC">
Punch that back out with adminclient, and now when I try to call the
service from the above client, I get an exception:
org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to
deserialize.
at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
The SOAP envelope being sent to the server looks like this (according to
tcpmon)
<?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>
<echoString
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<arg0 xsi:type="soapenc:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">Hello!</arg0>
</echoString>
</soapenv:Body>
</soapenv:Envelope>
I'm totally stumped where to start looking here - I'm new to SOAP, so
I'm sure I'm missing something very basic, but this has my project
completely dead in the water.
Help please!
--
Dave Belfer-Shevett <[EMAIL PROTECTED]>
The Homeport Collective