Hi folks,
I am pretty new to axis, and I have just started learning about web services
from past two days.
I am having a problem in deserializing a parameter when using Apache Axis.
I am trying out a sample code, which sends a XML file as request and gets back
the same file as response. Something kind of echo. The following is the client
code for the same,
package com.my.services;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory;
import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory;
public class EchoRequest {
/**
* @param args
*/
public static void main(String[] args) {
try {
String endpoint =
"http://localhost:8080/axis/Echo.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new
java.net.URL(endpoint) );
call.setOperationName(new
QName(("Echo"),"DataHandler"));
QName qName = new QName("Echo" , "echo");
DataHandler dhSource = new DataHandler(new
FileDataSource("D:/Workspace/Sandbox/Request.xml"));
call.registerTypeMapping(dhSource.getClass(),qName,JAFDataHandlerSerializerFactory.class,JAFDataHandlerDeserializerFactory.class
);
call.addParameter("echo", qName , ParameterMode.IN);
call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT,
call.ATTACHMENT_ENCAPSULATION_FORMAT_MIME);
call.setReturnType(qName);
Object ret = call.invoke(new Object[] {dhSource});
System.out.println();
} catch (Exception e) {
System.err.println(e.toString());
e.printStackTrace();
}
}
}
The following is the jws in the tomcat server. I have no wsdd files in my
server, I just have this jws,
import java.io.Serializable;
import javax.activation.DataHandler;
public class Echo implements Serializable{
public DataHandler echoString(DataHandler echo){
return echo;
}
}
When I run my client, I am getting the following error message,
org.xml.sax.SAXException: Deserializing parameter 'echo': could not find
deserializer for type {Echo}echo
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Deserializing parameter 'echo': could
not find deserializer for type {Echo}echo
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:sel7dt2008
org.xml.sax.SAXException: Deserializing parameter 'echo': could not find
deserializer for type {Echo}echo
at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.sel.services.EchoRequest.main(EchoRequest.java:42)
I am really not sure what the reason could be. It would be great if some one
could help me solve this issue and point me to some book or web site where I
can learn about axis in beginners perspective.
Thanks for your time.
Regards,
Jade
=
Sarbanes-Oxley 404 Compliance Tool
Document, evaluate and test controls using our COSO-based software tool.
http://a8-asy.a8ww.net/a8-ads/adftrclick?redirectid=b87c53e35f02329a6fcb43edcb95031c
--
Powered by Outblaze
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]