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 Rajagopal <ra...@govindaraj.com> on 2004/02/20 14:09:44 UTC
No serializer found for class
Hi,
I am new to web services and axis. I am trying to host a web service in
axis using RPC pattern and document binding. When I run the test client
I get a "serializer not found" exception. I tried specifying a
beanMapping and typeMapping but still got the same error. I have copied
the java files and the WSDD. Could someone help?
Thanks,
Rajagopal
My JAXM servlet
===============
package com.dnb.edms.servlet;
import javax.xml.messaging.JAXMServlet;
import javax.xml.messaging.ReqRespListener;
import javax.xml.soap.SOAPMessage;
public class MyService
extends JAXMServlet
implements ReqRespListener {
public SOAPMessage onMessage(SOAPMessage oMessage) {
return oMessage;
}
}
WSDD
====
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="MyService" provider="java:RPC" style="document"
use="literal">
<parameter name="className" value="MyService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
WSDL generated by Axis
======================
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://localhost:8080/testaxis/services/MyService"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/testaxis/services/MyService"
xmlns:intf="http://localhost:8080/testaxis/services/MyService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types/>
<wsdl:message name="onMessageRequest">
<wsdl:part name="oMessage" type="xsd:anyType"/>
</wsdl:message>
<wsdl:message name="onMessageResponse">
<wsdl:part name="onMessageReturn" type="xsd:anyType"/>
</wsdl:message>
<wsdl:portType name="MyService">
<wsdl:operation name="onMessage" parameterOrder="oMessage">
<wsdl:input message="impl:onMessageRequest"
name="onMessageRequest"/>
<wsdl:output message="impl:onMessageResponse"
name="onMessageResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyServiceSoapBinding" type="impl:MyService">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="onMessage">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="onMessageRequest">
<wsdlsoap:body
namespace="http://localhost:8080/testaxis/services/MyService"
use="literal"/>
</wsdl:input>
<wsdl:output name="onMessageResponse">
<wsdlsoap:body
namespace="http://localhost:8080/testaxis/services/MyService"
use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyServiceService">
<wsdl:port binding="impl:MyServiceSoapBinding" name="MyService">
<wsdlsoap:address
location="http://localhost:8080/testaxis/services/MyService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
My Test Client
==============
package com.dnb.edms.test;
import java.net.URL;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import org.apache.axis.client.Service;
import com.dnb.edms.client.MyServiceSoapBindingStub;
class TestService {
public static void main(String args[]) throws Exception {
MyServiceSoapBindingStub oStub = new MyServiceSoapBindingStub(new
URL("http://localhost:8080/testaxis/services/MyService"), new
Service());
//MyServiceSoapBindingStub oStub = new MyServiceSoapBindingStub();
MessageFactory oMsgFactory = MessageFactory.newInstance();
// Create a message from the message factory.
SOAPMessage oRequest = oMsgFactory.createMessage();
// Get the SOAP part.
SOAPPart sp = oRequest.getSOAPPart();
// Retrieve the oSOAPEnv from the soap part to start building
// the SOAP message.
SOAPEnvelope oSOAPEnv = sp.getEnvelope();
// Create a soap header from the oSOAPEnv.
SOAPHeader hdr = oSOAPEnv.getHeader();
// Create a soap body from the oSOAPEnv.
SOAPBody oSOAPBody = oSOAPEnv.getBody();
// Add a soap body element to the soap body
SOAPBodyElement customerDetails =
oSOAPBody.addBodyElement(oSOAPEnv.createName("customer"));
SOAPElement oCust =
customerDetails.addChildElement(oSOAPEnv.createName("Name"));
oCust.addTextNode("RG");
System.out.println("Request:");
oRequest.writeTo(System.out);
SOAPMessage oReply = (SOAPMessage) oStub.onMessage(oRequest);
System.out.println("Response:");
oReply.writeTo(System.out);
}
}
The stack trace of the error I get
==================================
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.userException
faultString: java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
faultActor: null
faultDetail:
stackTrace: java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
at
org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1235)
at
org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:756)
at org.apache.axis.message.RPCParam.serialize(RPCParam.java:224)
at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:305)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:142)
at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:401)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:273)
at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:488)
at org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:379)
at org.apache.axis.Message.getContentType(Message.java:400)
at
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:345)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:127)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:182)
at org.apache.axis.client.Call.invokeEngine(Call.java:2113)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at
com.dnb.edms.client.MyServiceSoapBindingStub.onMessage(MyServiceSoapBindingStub.java:85)
at com.dnb.edms.test.TestService.main(TestService.java:62)
java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
at org.apache.axis.AxisFault.makeFault(AxisFault.java:120)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:275)
at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:488)
at org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:379)
at org.apache.axis.Message.getContentType(Message.java:400)
at
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:345)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:127)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:182)
at org.apache.axis.client.Call.invokeEngine(Call.java:2113)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at
com.dnb.edms.client.MyServiceSoapBindingStub.onMessage(MyServiceSoapBindingStub.java:85)
at com.dnb.edms.test.TestService.main(TestService.java:62)
Caused by: java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
at
org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1235)
at
org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:756)
at org.apache.axis.message.RPCParam.serialize(RPCParam.java:224)
at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:305)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:142)
at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:401)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:273)
... 16 more
Exception in thread "main"
Re: No serializer found for class
Posted by Tony Blair <hr...@yahoo.com>.
Hi there,
Adding bean mapping and the type mapping in your wsdd will create the ser/Deser on the server side. You also need to define ser/deser on the client side for each complex type in your Call.invoke() method. Let me know if you have more questions on this.
Regards,
Tony.
Rajagopal <ra...@govindaraj.com> wrote:
Hi,
I am new to web services and axis. I am trying to host a web service in
axis using RPC pattern and document binding. When I run the test client
I get a "serializer not found" exception. I tried specifying a
beanMapping and typeMapping but still got the same error. I have copied
the java files and the WSDD. Could someone help?
Thanks,
Rajagopal
My JAXM servlet
===============
package com.dnb.edms.servlet;
import javax.xml.messaging.JAXMServlet;
import javax.xml.messaging.ReqRespListener;
import javax.xml.soap.SOAPMessage;
public class MyService
extends JAXMServlet
implements ReqRespListener {
public SOAPMessage onMessage(SOAPMessage oMessage) {
return oMessage;
}
}
WSDD
====
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
use="literal">
WSDL generated by Axis
======================
targetNamespace="http://localhost:8080/testaxis/services/MyService"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost:8080/testaxis/services/MyService"
xmlns:intf="http://localhost:8080/testaxis/services/MyService"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
name="onMessageRequest"/>
name="onMessageResponse"/>
transport="http://schemas.xmlsoap.org/soap/http"/>
namespace="http://localhost:8080/testaxis/services/MyService"
use="literal"/>
namespace="http://localhost:8080/testaxis/services/MyService"
use="literal"/>
location="http://localhost:8080/testaxis/services/MyService"/>
My Test Client
==============
package com.dnb.edms.test;
import java.net.URL;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import org.apache.axis.client.Service;
import com.dnb.edms.client.MyServiceSoapBindingStub;
class TestService {
public static void main(String args[]) throws Exception {
MyServiceSoapBindingStub oStub = new MyServiceSoapBindingStub(new
URL("http://localhost:8080/testaxis/services/MyService"), new
Service());
//MyServiceSoapBindingStub oStub = new MyServiceSoapBindingStub();
MessageFactory oMsgFactory = MessageFactory.newInstance();
// Create a message from the message factory.
SOAPMessage oRequest = oMsgFactory.createMessage();
// Get the SOAP part.
SOAPPart sp = oRequest.getSOAPPart();
// Retrieve the oSOAPEnv from the soap part to start building
// the SOAP message.
SOAPEnvelope oSOAPEnv = sp.getEnvelope();
// Create a soap header from the oSOAPEnv.
SOAPHeader hdr = oSOAPEnv.getHeader();
// Create a soap body from the oSOAPEnv.
SOAPBody oSOAPBody = oSOAPEnv.getBody();
// Add a soap body element to the soap body
SOAPBodyElement customerDetails =
oSOAPBody.addBodyElement(oSOAPEnv.createName("customer"));
SOAPElement oCust =
customerDetails.addChildElement(oSOAPEnv.createName("Name"));
oCust.addTextNode("RG");
System.out.println("Request:");
oRequest.writeTo(System.out);
SOAPMessage oReply = (SOAPMessage) oStub.onMessage(oRequest);
System.out.println("Response:");
oReply.writeTo(System.out);
}
}
The stack trace of the error I get
==================================
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.userException
faultString: java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
faultActor: null
faultDetail:
stackTrace: java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
at
org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1235)
at
org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:756)
at org.apache.axis.message.RPCParam.serialize(RPCParam.java:224)
at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:305)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:142)
at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:401)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:273)
at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:488)
at org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:379)
at org.apache.axis.Message.getContentType(Message.java:400)
at
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:345)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:127)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:182)
at org.apache.axis.client.Call.invokeEngine(Call.java:2113)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at
com.dnb.edms.client.MyServiceSoapBindingStub.onMessage(MyServiceSoapBindingStub.java:85)
at com.dnb.edms.test.TestService.main(TestService.java:62)
java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
at org.apache.axis.AxisFault.makeFault(AxisFault.java:120)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:275)
at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:488)
at org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:379)
at org.apache.axis.Message.getContentType(Message.java:400)
at
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:345)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:127)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:182)
at org.apache.axis.client.Call.invokeEngine(Call.java:2113)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at
com.dnb.edms.client.MyServiceSoapBindingStub.onMessage(MyServiceSoapBindingStub.java:85)
at com.dnb.edms.test.TestService.main(TestService.java:62)
Caused by: java.io.IOException: No serializer found for class
org.apache.axis.Message in registry
org.apache.axis.encoding.TypeMappingImpl@1aa9f99
at
org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1235)
at
org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:756)
at org.apache.axis.message.RPCParam.serialize(RPCParam.java:224)
at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:305)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:142)
at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:401)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:273)
... 16 more
Exception in thread "main"
---------------------------------
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.