I've been trying to develop my own serializer & deserializer for some java classes such as the java.net.URL class in order to pass URL's to a service method, but the server sends back a fault: Fault Code = SOAP-ENV:Server.Exception: Fault String = org/apache/soap/util/xml/Deserializer
I've attempted to write serializers/deserializers for a simple class also (class contains only Strings) instead of using the BeanSerializer and I still get the above exception. This is a critical issue... Below is the code: Deployment Descriptor -------------------------------------------------------------------------------------------------------------- <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:SimpleURLService"> <isd:provider type="java" scope="Session" methods="serviceMethod"> <isd:java class="examples.omnitide.SimpleURLService.SimpleURLService" static="false"/> </isd:provider> <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener> <isd:mappings> <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" qname="xsd:URL" javaType="java.net.URL" xml2JavaClassName="examples.omnitide.SimpleURLService.URLDeserializer"/> </isd:mappings> </isd:service> Client that calls soap service -------------------------------------------------------------------------------------------------------------- // Map the types SOAPMappingRegistry smr = new SOAPMappingRegistry(); URLSerializer ser = new URLSerializer(); URLDeserializer des = new URLDeserializer(); smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("urn:SimpleURLService", "URL"), URL.class, ser, des); // Build the call Call call = new Call(); call.setSOAPMappingRegistry(smr); call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); call.setTargetObjectURI("urn:SimpleURLService"); call.setMethodName("serviceMethod"); Vector params = new Vector(); params.addElement(new Parameter("request", URL.class, url, null)); call.setParams(params); Serializer -------------------------------------------------------------------------------------------------------------- import java.net.URL; public class URLSerializer implements Serializer { public void marshall(String inScopeEncStyle, Class javaType, Object src, Object context, Writer sink, NSStack nsStack, XMLJavaMappingRegistry xjmr, SOAPContext ctx) throws IllegalArgumentException, IOException { nsStack.pushScope(); SoapEncUtils.generateStructureHeader(inScopeEncStyle, javaType, context, sink, nsStack, xjmr); sink.write(StringUtils.lineSeparator); URL src2 = (URL) src; Parameter param; param = new Parameter("URL", String.class, src2.toString(), null); xjmr.marshall(inScopeEncStyle, Parameter.class, param, null, sink, nsStack, ctx); sink.write(StringUtils.lineSeparator); sink.write("</" + context + ">"); nsStack.popScope(); } } Deserializer -------------------------------------------------------------------------------------------------------------- public class URLDeserializer implements Deserializer { public Bean unmarshall(String inScopeEncStyle, QName elementType, Node src, XMLJavaMappingRegistry xjmr, SOAPContext ctx) throws IllegalArgumentException { Element root = (Element)src; Element tempEl = DOMUtils.getFirstChildElement(root); URL url = null; while (tempEl != null) { Bean paramBean = xjmr.unmarshall(inScopeEncStyle, RPCConstants.Q_ELEM_PARAMETER, tempEl, ctx); Parameter param = (Parameter)paramBean.value; String tagName = tempEl.getTagName(); if (tagName.equals("URL")) { try { url = new URL( (String)param.getValue() ); } catch (Exception e) { throw new IllegalArgumentException("Problem instantianting bean: " + e.getMessage()); } } tempEl = DOMUtils.getNextSiblingElement(tempEl); } return new Bean(URL.class, url); } }