You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Das, Kuntal" <Ku...@Schwab.com> on 2001/05/26 00:32:38 UTC

Solved Illegal argument Exception problem, but came up with anoth er question.......

Hey, I just fixed the problem. Here is what I did : 

	call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
    Vector params = new Vector();

    params.addElement(new Parameter("acctId", java.lang.String.class,
                                    acctId, Constants.NS_URI_SOAP_ENC));
    params.addElement(new Parameter("wirelessId", java.lang.String.class,
                                    wirelessId, Constants.NS_URI_SOAP_ENC));
	params.addElement(new Parameter("passwd", java.lang.String.class,
                                    passwd, Constants.NS_URI_SOAP_ENC));

	params.addElement(new Parameter("softwareVersion",
java.lang.String.class,
                                    softwareVersion,
Constants.NS_URI_SOAP_ENC));

    call.setParams(params);

which implies, I've set the Encoding type for the method call as
"NS_URI_LITERAL_XML", since it will return an xml doc, but teh encoding type
for the Parameters which r normal java types, I used the "NS_URI_SOAP_ENC",
and it worked.

BUT, now I've another question, what if one of the parameters r a java
literal type, like for instance a long or an int value. Right now, the
method call goes like this 

params.addElement(new Parameter("passwd", java.lang.String.class,
                                    passwd, Constants.NS_URI_SOAP_ENC));

where u have to mention the java class for the parameter. String is an
exceptional case since it ca nbe interpreted as both a literal javatype and
as an object, but for a long value, what should the Parameter look like.....
???

Thanks,
Kuntal Das
Charles Schwab & Co., Inc.
Wireless Technology
45 Fremont, SF
Email : kuntal.das@schwab.com
Phone : (415)667-4322
Live life to the brim.................



-----Original Message-----
From: Trang K. Duong [mailto:duong@nas.nasa.gov]
Sent: Friday, May 25, 2001 3:17 PM
To: soap-user@xml.apache.org
Subject: RE: Illegal argument Exception.....


I think i know what you did wrong...at:

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

use: Constants.NS_URI_LITERAL_XML instead beacause you get back not
primitive 
encoded type but the xml doc.





> Mailing-List: contact soap-user-help@xml.apache.org; run by ezmlm
> list-help: <ma...@xml.apache.org>
> list-unsubscribe: <ma...@xml.apache.org>
> list-post: <ma...@xml.apache.org>
> Delivered-To: mailing list soap-user@xml.apache.org
> Received-Date: Fri, 25 May 2001 18:04:57 -0400 (EDT)
> From: "Das, Kuntal" <Ku...@Schwab.com>
> To: "'soap-user@xml.apache.org'" <so...@xml.apache.org>
> Subject: RE: Illegal argument Exception.....
> Date: Fri, 25 May 2001 15:04:59 -0700
> MIME-Version: 1.0
> X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N
> 
> Nope, I used the Constants.String NS_URI_SOAP_ENC  as my Encoding URI,
which
> when I do a System.out.println, prints the sorrect URI, with the trailing
> "/". Here's the main chunk of my code....it's very simple, but don't know
> what I'm missing ....?
> 
>     Call call = new Call();
> 
>     call.setTargetObjectURI("urn:sessionManagement");
>     call.setMethodName("signOn");
>     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>         Vector params = new Vector();
> 
>     params.addElement(new Parameter("acctId", java.lang.String.class,
>                                     acctId, null));
>     params.addElement(new Parameter("wirelessId", java.lang.String.class,
>                                     wirelessId, null));
> 	params.addElement(new Parameter("passwd", java.lang.String.class,
>                                     passwd, null));	
> 	params.addElement(new Parameter("softwareVersion",
> java.lang.String.class,
>                                     softwareVersion, null));
> 
>     call.setParams(params);
> 
>     // Invoke the call.
>     Response resp;
> 
>     try
>     {
>       resp = call.invoke(url, "");
>     }
>     catch (SOAPException e)
>     {
> 		System.out.println("************ SOAPException caught
> *************");
>       System.err.println("Caught SOAPException (" +
>                          e.getFaultCode() + "): " +
>                          e.getMessage());
>       return;
>     }
> 
>     // Check the response.
>     if (!resp.generatedFault())
>     {
>       Parameter ret = resp.getReturnValue();
>       org.w3c.dom.Element accountSignOn =
> (org.w3c.dom.Element)ret.getValue();
> 
>       System.out.println(DOM2Writer.nodeToString(accountSignOn));
>     }
>     else
>     {
> 		System.out.println("************* Fault created
> **************");
>       Fault fault = resp.getFault();
> 
>       System.err.println("Generated fault: ");
>       System.out.println ("  Fault Code   = " + fault.getFaultCode());  
>       System.out.println ("  Fault String = " + fault.getFaultString());
>     }
>   }
> 
> And the exception is in my previous mail......
> 
> Any hints ?
> 
> 
> Thanks,
> Kuntal Das
> Charles Schwab & Co., Inc.
> Wireless Technology
> 45 Fremont, SF
> Email : kuntal.das@schwab.com
> Phone : (415)667-4322
> Live life to the brim.................
> 
> 
> 
> -----Original Message-----
> From: Trang K. Duong [mailto:duong@nas.nasa.gov]
> Sent: Friday, May 25, 2001 2:56 PM
> To: soap-user@xml.apache.org
> Subject: Re: Illegal argument Exception.....
> 
> 
> Hi Kuntal,
> 
> Is the exception is at when you use soap client to invoke your remote
> method?
> Did you try to explixitly put '/' at the end of the coding style:
> 	"http://schemas.xmlsoap.org/soap/encoding"
> because I saw this line in your stackTrace.  Adding '/' at the end fixed
my 
> problem.
> 
> 
> 	
> > Mailing-List: contact soap-user-help@xml.apache.org; run by ezmlm
> > list-help: <ma...@xml.apache.org>
> > list-unsubscribe: <ma...@xml.apache.org>
> > list-post: <ma...@xml.apache.org>
> > Delivered-To: mailing list soap-user@xml.apache.org
> > Received-Date: Fri, 25 May 2001 16:41:52 -0400 (EDT)
> > From: "Das, Kuntal" <Ku...@Schwab.com>
> > To: "'soap-dev@xml.apache.org'" <so...@xml.apache.org>, 
> "'soap-user@xml.apache.org'" <so...@xml.apache.org>
> > Subject: Illegal argument Exception.....
> > Date: Fri, 25 May 2001 13:41:15 -0700
> > MIME-Version: 1.0
> > X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N
> > 
> > Hi all,
> >       I NEVER GOT ANY ANSWER TO MY PROBLEMS from the SOAP-mailing list,
> i.e.
> > SOAP@DISCUSS.DEVELOP.COM, and that's why I thought that maybe I can get
> some
> > help here. Please forgive me if I'm in the wrong place with the wrong
> > question. Thanks ....
> >       Here's the scenario. I have a remote SOAP method which takes three
> > string
> > values as parameters, and returns an Element. And here's where I get
this
> > exception :
> > 
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > 
> > org.xml.sax.SAXParseException: The markup in the document following the
> > root ele
> > ment must be well-formed.
> >         at org.apache.xerces.framework.XMLParser.reportError
> > (XMLParser.java:1056
> > )
> >         at
> > org.apache.xerces.framework.XMLDocumentScanner$TrailingMiscDispatcher
> > .dispatch(XMLDocumentScanner.java, Compiled Code)
> >         at org.apache.xerces.framework.XMLDocumentScanner.parseSome
> > (XMLDocumentS
> > canner.java, Compiled Code)
> >         at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:948)
> >         at org.apache.soap.util.xml.XercesParserLiaison.read
> > (XercesParserLiaison
> > .java:85)
> >         at org.apache.soap.rpc.Call.invoke(Call.java:157)
> >         at AccountSignOnClient.main(AccountSignOnClient.java:64)
> > ************ SOAPException caught *************
> > Caught SOAPException (SOAP-ENV:Protocol): <h1>Error: 500</h1>
> > <h2>Location: /soap/servlet/rpcrouter</h2><b>Internal Servlet
> > Error:</b><br><pre
> > >javax.servlet.ServletException: Error building response envelope
> >         at org.apache.soap.server.http.RPCRouterServlet.doPost
> > (RPCRouterServlet.
> > java:345)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at org.apache.tomcat.core.ServletWrapper.doService
> > (ServletWrapper.java:4
> > 04)
> >         at org.apache.tomcat.core.Handler.service(Handler.java:286)
> >         at org.apache.tomcat.core.ServletWrapper.service
> > (ServletWrapper.java:372
> > )
> >         at org.apache.tomcat.core.ContextManager.internalService
> > (ContextManager.
> > java:797)
> >         at org.apache.tomcat.core.ContextManager.service
> > (ContextManager.java:743
> > )
> >         at
> > org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
> > n(HttpConnectionHandler.java:210)
> >         at org.apache.tomcat.service.TcpWorkerThread.runIt
> > (PoolTcpEndpoint.java:
> > 416)
> >         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run
> > (ThreadPool.java
> > :498)
> >         at java.lang.Thread.run(Thread.java:479)
> > </pre>
> > <b>Root cause:</b>
> > <pre>java.lang.IllegalArgumentException: No Serializer found to
serialize
> > a 'org
> > .w3c.dom.Element' using encoding
> > style 'http://schemas.xmlsoap.org/soap/encoding
> > /'.
> >         at
org.apache.soap.util.xml.XMLJavaMappingRegistry.querySerializer
> > (XMLJa
> > vaMappingRegistry.java:125)
> >         at org.apache.soap.encoding.SOAPMappingRegistry.querySerializer
> > (SOAPMapp
> > ingRegistry.java:297)
> >         at org.apache.soap.encoding.soapenc.ParameterSerializer.marshall
> > (Paramet
> > erSerializer.java:98)
> >         at org.apache.soap.rpc.RPCMessage.marshall(RPCMessage.java:260)
> >         at org.apache.soap.Body.marshall(Body.java:141)
> >         at org.apache.soap.Envelope.marshall(Envelope.java:180)
> >         at org.apache.soap.server.http.RPCRouterServlet.doPost
> > (RPCRouterServlet.
> > java:343)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >         at org.apache.tomcat.core.ServletWrapper.doService
> > (ServletWrapper.java:4
> > 04)
> >         at org.apache.tomcat.core.Handler.service(Handler.java:286)
> >         at org.apache.tomcat.core.ServletWrapper.service
> > (ServletWrapper.java:372
> > )
> >         at org.apache.tomcat.core.ContextManager.internalService
> > (ContextManager.
> > java:797)
> >         at org.apache.tomcat.core.ContextManager.service
> > (ContextManager.java:743
> > )
> >         at
> > org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
> > n(HttpConnectionHandler.java:210)
> >         at org.apache.tomcat.service.TcpWorkerThread.runIt
> > (PoolTcpEndpoint.java:
> > 416)
> >         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run
> > (ThreadPool.java
> > :498)
> >         at java.lang.Thread.run(Thread.java:479)
> > </pre>
> > 
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > 
> > Any help is appreciated....
> > 
> > Thanks
> > Kuntal
> > 
> > 
> > Thanks,
> > Kuntal Das
> > Charles Schwab & Co., Inc.
> > Wireless Technology
> > 45 Fremont, SF
> > Email : kuntal.das@schwab.com
> > Phone : (415)667-4322
> > Live life to the brim.................
> > 
> > 
> > 
> > Thanks,
> > Kuntal Das
> > Charles Schwab & Co., Inc.
> > Wireless Technology
> > 45 Fremont, SF
> > Email : kuntal.das@schwab.com
> > Phone : (415)667-4322
> > Live life to the brim.................
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
> 
> 
> Trang K Duong
> duong@nas.nasa.gov
> 
> 
> 650-604-3989 (P)	   650-604-2238 (F)
> ELORET - Thermosciences Institute
> NASA Ames Research Center
> M/S 258-1
> Moffett Field, CA 94035-1000
> http://www.eloret.com/
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org


Trang K Duong
duong@nas.nasa.gov


650-604-3989 (P)	   650-604-2238 (F)
ELORET - Thermosciences Institute
NASA Ames Research Center
M/S 258-1
Moffett Field, CA 94035-1000
http://www.eloret.com/




---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org