You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kirti Bodhmage <ki...@ahds.ac.uk> on 2005/08/22 15:39:00 UTC
SOAP attachment: No such operation error
Hi ,
I am trying hands on the SOAP attachment following is my server and client
code
************
Service code:
public int getMETSbyID(int EprintID)
{
//get the METS values from the XML file for the corresponding eprint and
return it
return 10;
}
public DataHandler getMETS(String fileName)
{
DataHandler dh = new DataHandler(new FileDataSource(fileName));
if (dh == null ) System.err.println("dhSource is null");
return dh;
}
Client code:
Service service = new Service();
Call call = (Call)service.createCall();
String endpoint = "http://localhost:8080/axis/SendService.jws";
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName(new QName("getMETS"));
QName qnameAttachment = new QName("DataHandler");
DataHandler dhSource = new DataHandler(new
FileDataSource("C:\\Kirti\\testdata\\eprint.txt"));
call.registerTypeMapping(dhSource.getClass(),qnameAttachment,JAFDataHandlerS
erializerFactory.class,JAFDataHandlerDeserializerFactory.class);
call.addParameter("test",org.apache.axis.Constants.XSD_STRING,ParameterMode.
IN);
call.setReturnQName(qnameAttachment);
call.setReturnType(qnameAttachment);
Object ret = (String)call.invoke(new Object [] { dhSource } );
*********
This service code is recognising call to getMETSbyID and it returns value 10
but it does not recognize call to getMETS ,
it says "No such operation 'getMETS'"
I could see getMETS method in WSDL .
What could be the problem for not been able to recognise the method in the
Service code ?