I am new to web services, having failed to get an axis working example running from a book (Developing Java Web services). I have tried my own. At least now I get errors, but I really can't understand what the problem is. I would really appreciate some help.
The error is telling me that the method I am trying to call "getSchema()" dose not exist (faultString: No such operation 'getSchema') more details below.
I really would appreciate any help.
Thanks in advance...
I am using axis1_1RC2 in tomcat 4.1.18 on windows XP.
my service class is:
***************************
package com.wordmap.apiservice;
import com.wordmap.navigation.WordmapFacade;
public class WordMapAPIService {
String schema;
public String getSchema() throws Exception {
ApiXMLHelper axh;
try {
axh = new ApiXMLHelper();
schema = axh.getShemasXMLasString();
} catch( Exception te){
te.printStackTrace();
}
return schema;
}
}
Its wsdd is:
<deployment name="mtest" xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance">
<service name="wmrpcservice" provider="java:RPC">
<parameter name="className" value="com.wordmap.apiservice.WordMapAPIService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
I deployed it using:
java org.apache.axis.client.AdminClient -lhttp://localhost:8181/axis/services/AdminService deploy.wsdd
My client class is:
***************************
package com.wordmap.client;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;
import java.net.URL;
public class WordMapPublishedDataClient {
public String getSchema() throws Exception {
String endpoint = "http://localhost:8181/axis/services/wmrpcservice";
Service service = new Service();
// Create the SOAP request message
Call call = (Call) service.createCall();
// Set the provider location
call.setTargetEndpointAddress( endpoint );
// Set the service name and methods
call.setOperationName( new QName("wmrpcservice", "getSchema") );
//Object responseObj = call.invoke( new Object[] {new Integer(productID)} );
Object responseObj = call.invoke( new Object[] { null });
// Retrieve the values from the response object
String respString = (String) responseObj;
return respString;
}
public static void main(String args[]) {
try {
WordMapPublishedDataClient wmpdc = new WordMapPublishedDataClient();
String val = wmpdc.getSchema();
System.out.println("Schema Name: " + val);
}
catch( Exception e ) {
if ( e instanceof AxisFault ) {
System.err.println( ((AxisFault)e).dumpToString() );
} else
e.printStackTrace();
}
}
public WordMapPublishedDataClient() {
}
}
I ran it using:
java com.wordmap.client.WordMapPublishedDataClient
This is the error:
AxisFault
faultCode: Server.userException
faultSubcode:
faultString: No such operation 'getSchema'
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: AxisFault
faultCode: Server.userException
faultSubcode:
faultString: No such operation &apos;getSchema&apos;
faultActor:
faultNode:
faultDetail:
No such operation 'getSchema'
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
.java:251)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
java:168)
at org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseri
alizationContextImpl.java:1001)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXPar
ser.java:585)
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespa
ceBinder.java:898)
at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBind
er.java:644)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(
XMLDocumentFragmentScannerImpl.java:1008)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:329)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:525)
at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:581)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1175)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:394)
at org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
tionContextImpl.java:242)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)
at org.apache.axis.client.Call.invokeEngine(Call.java:2545)
at org.apache.axis.client.Call.invoke(Call.java:2515)
at org.apache.axis.client.Call.invoke(Call.java:2210)
at org.apache.axis.client.Call.invoke(Call.java:2133)
at org.apache.axis.client.Call.invoke(Call.java:1656)
at com.wordmap.client.WordMapPublishedDataClient.getSchema(WordMapPublis
hedDataClient.java:54)
at com.wordmap.client.WordMapPublishedDataClient.main(WordMapPublishedDa
taClient.java:78)