Hai,
U can have multiple mappings on a single SOAPMappingRegistry object. As u are
re-creating the SOAPMappingRegistry instance for ur custom class, the earlier
string mapping will be over-written. So, don't re-instantiate ur
SOAPMappingRegistry object for ur "ObjResultadoBasico" mapping. Use the same
registry object u have created for string mapping. And finally use,
call.setSOAPMappingRegistry(smr) once.
Here is ur code with expected changes
public static void init() throws IOException
{
url = new URL(InicializaCliente.BONOServidorURL);
call = new Call();
// Match for String
//-----------------
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("http://schemas.xmlsoap.org.sopa/encoding/","string"),
String.class,null,sd);
//do this finally once
//call.setSOAPMappingRegistry(smr);
beanSer = new BeanSerializer();
//Don't re-instantiate SOAPMappingRegistry use smr only
//smrObjBasico = new SOAPMappingRegistry();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName(InicializaCliente.BONOUrn, "ObjResultadoBasico"),
ObjResultadoBasico.class, beanSer, beanSer);
call.setSOAPMappingRegistry(smr);
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI(InicializaCliente.BONOUrn);
salidaObjBasico= new ObjResultadoBasico();
}
thanks
Durga Srinivasu
On Tue, 02 Jan 2007 celia05es wrote :
>
>Sorry to answer so late but I hadn't seen your answer....
>
>Well, I have tried what you have suggested but I still get the error!!
>
>
>No Deserializer found to deserialize a
>'http://schemas.xmlsoap.org/soap/encoding/:string' using encoding
>style 'http://schemas.xmlsoap.org/soap/encoding/'.
>
>Here is what I have:
>
>public static void init() throws IOException
> {
> url = new URL(InicializaCliente.BONOServidorURL);
> call = new Call();
>
> // Match for String
> //-----------------
> SOAPMappingRegistry smr = new SOAPMappingRegistry();
> StringDeserializer sd = new StringDeserializer();
> smr.mapTypes(Constants.NS_URI_SOAP_ENC,
> new QName("http://schemas.xmlsoap.org.sopa/encoding/","string"),
> String.class,null,sd);
> call.setSOAPMappingRegistry(smr);
>
>
> beanSer = new BeanSerializer();
> smrObjBasico = new SOAPMappingRegistry();
> smrObjBasico.mapTypes(Constants.NS_URI_SOAP_ENC,
> new QName(InicializaCliente.BONOUrn, "ObjResultadoBasico"),
> ObjResultadoBasico.class, beanSer, beanSer);
> call.setSOAPMappingRegistry(smrObjBasico);
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> call.setTargetObjectURI(InicializaCliente.BONOUrn);
> salidaObjBasico= new ObjResultadoBasico();
> }
>
>What am I doing wrong?
>
>
>
>
>Durga Srinivasu wrote:
> >
> > Hai,
> >
> > Don't remove your Output bean mapping, u keep that mapping as it is and
> > add the following mapping for string.
> >
> > smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
> > QName("http://schemas.xmlsoap.org/soap/encoding/",
> > "string"), String.class, null, sd);
> >
> > In my old post, inplace of "String.class" there is null, that is wrong, we
> > should use "String.class".
> >
> > Sorry for the wrong post.
> >
> > thanks
> > Durga Srinivasu
> >
> > On Fri, 29 Dec 2006 Durga Srinivasu wrote :
> >>Hi,
> >>
> >>I hope ur are using Apache SOAP Kit to invoke ur web service, which is
>deployed on AXIS 1.4.
> >>
> >>I hope the following de-serializer changes to ur AICliente.soapInit()
>method could solve ur problem.
> >>
> >>SOAPMappingRegistry smr = new SOAPMappingRegistry();
> >>StringDeserializer sd = new StringDeserializer();
> >>smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
> >>QName("http://schemas.xmlsoap.org/soap/encoding/",
> >>"string"), null, null, sd);
> >>call.setSOAPMappingRegistry(smr);
> >>
> >>thanks
> >>Durga Srinivasu
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>On Fri, 29 Dec 2006 celia05es wrote :
> >> >
> >> >Hello again,
> >> >I have looked and looked again but could not find anything in the
> >> database
> >> >that could help me. I am completely stuck.
> >> >COuld someone give me a hand please?
> >> >
> >> >
> >> >
> >> >
> >> >celia05es wrote:
> >> > >
> >> > > Hello,
> >> > >
> >> > > I am quite new to Axis and I am getting mad trying to find out what
> >> the
> >> > > problem is. I have been trying so many things! I am desperate!
> >> > > Could you suggest a solution?
> >> > > I don't know what you need to help me so I give you the wsdd and the
> >> > > cliente side procedure where I call AXIS. I suppose the problem is
> >> there
> >> > > but I cannot find it.
> >> > >
> >> > >
> >> > > THank you
> >> > > ==================================
> >> > > I am using Axis 1-4 and Tomcat 5.1.9.
> >> > >
> >> > > I am getting the following exception:
> >> > >
> >> > > No Deserializer found to deserialize a
> >> > > 'http://schemas.xmlsoap.org/soap/encoding/:string' using
> >> > > encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
> >> > >
> >> > > My application is very, very simple since I wanted to have AXIS
> >> working
> >> > > before starting something else.
> >> > >
> >> > > ON SERVER SIDE:
> >> > >
> >> > > AI.wsdd:
> >> > > <?xml version="1.0" encoding="UTF-8" ?>
> >> > > - <wsdl:definitions
> >> > > targetNamespace="http://135.88.100.235:8081/services/services/AI"
> >> > > xmlns:apachesoap="http://xml.apache.org/xml-soap"
> >> > > xmlns:impl="http://135.88.100.235:8081/services/services/AI"
> >> > > xmlns:intf="http://135.88.100.235:8081/services/services/AI"
> >> > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> >> > > xmlns:tns1="urn:AI" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >> > > xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
> >> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> >> > > - <!--
> >> > > WSDL created by Apache Axis version: 1.4
> >> > > Built on Apr 22, 2006 (06:55:48 PDT)
> >> > >
> >> > > -->
> >> > > - <wsdl:types>
> >> > > - <schema targetNamespace="urn:AI"
> >> > > xmlns="http://www.w3.org/2001/XMLSchema">
> >> > > <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
> >> > > - <complexType name="Output">
> >> > > - <sequence>
> >> > > <element name="PError" type="xsd:int" />
> >> > > <element name="SError" nillable="true" type="soapenc:string" />
> >> > > </sequence>
> >> > > </complexType>
> >> > > </schema>
> >> > > </wsdl:types>
> >> > > - <wsdl:message name="AImodif_p1Request">
> >> > > <wsdl:part name="p1_old" type="soapenc:string" />
> >> > > <wsdl:part name="p1_new" type="soapenc:string" />
> >> > > </wsdl:message>
> >> > > - <wsdl:message name="AImodif_p1Response">
> >> > > <wsdl:part name="AImodif_p1Return" type="tns1:Output" />
> >> > > </wsdl:message>
> >> > > - <wsdl:portType name="AIServicio">
> >> > > - <wsdl:operation name="AImodif_p1" parameterOrder="p1_old p1_new">
> >> > > <wsdl:input message="impl:AImodif_p1Request"
> >> name="AImodif_p1Request" />
> >> > > <wsdl:output message="impl:AImodif_p1Response"
> >> name="AImodif_p1Response"
> >> > > />
> >> > > </wsdl:operation>
> >> > > </wsdl:portType>
> >> > > - <wsdl:binding name="AISoapBinding" type="impl:AIServicio">
> >> > > <wsdlsoap:binding style="rpc"
> >> > > transport="http://schemas.xmlsoap.org/soap/http" />
> >> > > - <wsdl:operation name="AImodif_p1">
> >> > > <wsdlsoap:operation soapAction="" />
> >> > > - <wsdl:input name="AImodif_p1Request">
> >> > > <wsdlsoap:body
> >> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> >> > > namespace="http://AI" use="encoded" />
> >> > > </wsdl:input>
> >> > > - <wsdl:output name="AImodif_p1Response">
> >> > > <wsdlsoap:body
> >> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> >> > > namespace="http://135.88.100.235:8081/services/services/AI"
> >> use="encoded"
> >> > > />
> >> > > </wsdl:output>
> >> > > </wsdl:operation>
> >> > > </wsdl:binding>
> >> > > - <wsdl:service name="AIServicioService">
> >> > > - <wsdl:port binding="impl:AISoapBinding" name="AI">
> >> > > <wsdlsoap:address
> >> > > location="http://135.88.100.235:8081/services/services/AI" />
> >> > > </wsdl:port>
> >> > > </wsdl:service>
> >> > > </wsdl:definitions>
> >> > >
> >> > >
> >> > > AIServicio.java
> >> > > That contains a procedure AIModif_p1 (String p1_old, String
> >> p1_new).
> >> > > This procedure returns an Output object that contains the error code
> >> and
> >> > > the error message.
> >> > >
> >> > > CLIENTE SIDE
> >> > > AICliente.java
> >> > > import.....
> >> > > public class AICliente extends HttpServlet
> >> > > {
> >> > >
> >> > > public AICliente() {}
> >> > >
> >> > > private static URL url = null;
> >> > > private static Call call = null;
> >> > > private static SOAPMappingRegistry smr = null;
> >> > > private static BeanSerializer beanSer = null;
> >> > > private static Output output = null;
> >> > >
> >> > > public static void soapInit() throws IOException
> >> > > {
> >> > > url = new
> >> URL("http://135.88.100.235:8081/services/services/AI");
> >> > > call = new Call();
> >> > > beanSer = new BeanSerializer();
> >> > > smr = new SOAPMappingRegistry();
> >> > > smr.mapTypes(Constants.NS_URI_SOAP_ENC,
> >> > > new QName("urn:AI","Output"),
> >> > > Output.class, beanSer, beanSer);
> >> > > call.setSOAPMappingRegistry(smr);
> >> > > call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> >> > > call.setTargetObjectURI("urn:AI");
> >> > > output= new Output();
> >> > > }
> >> > >
> >> > > public static Output AImodif_p1( String p1_old, String p1_new)
> >> > > throws IOException
> >> > > {
> >> > > System.out.println("Entewring Cliente AImodif_p1....");
> >> > > System.out.println("p1_old="+p1_old+" p1_new="+p1_new);
> >> > >
> >> > > soapInit();
> >> > >
> >> > > call.setMethodName("AImodif_p1");
> >> > >
> >> > > Vector params = new Vector();
> >> > > try
> >> > > {
> >> > > params.addElement(new
> >> Parameter("p1_old",String.class,p1_old,null));
> >> > > params.addElement(new
> >> Parameter("p1_new",String.class,p1_new,null));
> >> > > call.setParams(params);
> >> > > }
> >> > > catch (Exception e)
> >> > > {
> >> > > output.setPError(-1);
> >> > > output.setSError(e.getMessage());
> >> > > System.out.println("ERROR: Generated fault: " +
> >> e.getMessage());
> >> > > return output;
> >> > > };
> >> > >
> >> > > System.out.println("AImodif_p1.....Server answering ...");
> >> > > Response resp=null; try
> >> > > {
> >> > > System.out.println("url="+url);
> >> > > resp = call.invoke(url, "");
> >> > > }
> >> > > catch (SOAPException e)
> >> > > {
> >> > > System.out.println("SOAPException in client AImodif_p1...");
> >> > > output.setPError(-1);
> >> > > output.setSError(e.getMessage());
> >> > > System.out.println("Caught SOAPException (" + e.getFaultCode()
> >> + "):
> >> > > [" +
> >> > > e.getMessage()+"]");
> >> > > return output;
> >> > > } if (!resp.generatedFault())
> >> > > {
> >> > > Parameter ret = resp.getReturnValue();
> >> > > output = (Output)ret.getValue();
> >> > > }
> >> > > else
> >> > > {
> >> > > Fault fault = resp.getFault();
> >> > > output.setPError(-1);
> >> > > output.setSError(resp.getFault().getFaultString());
> >> > > System.out.println("ERROR: Generated fault: " + fault);
> >> > > }
> >> > > return output;
> >> > > }
> >> > >
> >> > > public void doGet(HttpServletRequest request, HttpServletResponse
> >> > > response)
> >> > > throws IOException, ServletException
> >> > > {
> >> > > response.setContentType("text/html");
> >> > > PrintWriter out = response.getWriter();
> >> > > PaintClient ps= new PaintClient();
> >> > > String p1_old="/";
> >> > > String p1_new = request.getParameter("p1_new");
> >> > >
> >> > > out.println("<center>PARAMETER 1 </center>");
> >> > > out.println(ps.PaintClientHtml("Modif p1",
> >> AImodif_p1(p1_old,p1_new)));
> >> > > }
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> >
> >> >--
> >> >View this message in context:
> >> http://www.nabble.com/No-Deserializer-found-in-encoding-string%21-tf2890711.html#a8085525
> >> >Sent from the Axis - User mailing list archive at Nabble.com.
> >> >
> >> >
> >> >---------------------------------------------------------------------
> >> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >
> >
>
>--
>View this message in context:
>http://www.nabble.com/No-Deserializer-found-in-encoding-string%21-tf2890711.html#a8122269
>Sent from the Axis - User mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>