axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NY...@aol.com
Subject Re: Returning an Array over Axis
Date Thu, 15 Jul 2004 09:58:57 GMT
 
Thank you for your responses,
 
I was wondering if you could tell me exactly what you did to get it ot  work. 
Currently an array is is the needed type in my java (yes I  use Doc/Lit), 
however the error occurs anyway. 
 
Please help,
James
 
In a message dated 7/14/2004 7:00:42 PM Eastern Standard Time,  
an4m@cs.virginia.edu writes:

James,

I'll back off from my claim that there's a  problem.
When I write a class/interface that has a method
that returns a  string array, the WSDL seems to indicate
that the return is a single  xsd:string. Even the
stubs generated from the WSDL show a return of  String.
However, when I actually invoke the method, I do get
back the  array, just in different  namespaces:

...
<soapenv:Body>
<echoArrReturn  xmlns="urn:EchoDocLit">vlad</echoArrReturn>
<ns1:echoArrReturn  xmlns:ns1="urn:EchoDocLit">is</ns1:echoArrReturn>
<ns2:echoArrReturn  xmlns:ns2="urn:EchoDocLit">sanguine</ns2:echoArrReturn>
</soapenv:Body>
...

Perhaps  that's what the spec for doc/lit indicates, but
it seems unintuitive to  me.

I'm moving over to wrapped/literal after this  experience;
perhaps you could do the same.

Anand

On Wed, 14  Jul 2004, Anand Natrajan wrote:

: Is your web service exposed as a  document/literal?
: If yes, I face a similar problem - Axis 1.2 beta
:  (June 14th release) makes the return type of the
: method a String, instead  of String[]. The problem
: is right where I do java2wsdl - even the WSDL,  I
: think, is incorrrect. The problem does not occur
: with rpc/encoded,  rpc/literal or wrapped/literal.
:
: I mailed a post about this a week or  so ago but got
: no response. I'm compiling a test case along with
: the  WSDL and sample clients to illustrate the issue.
: Next post...
:
:  Anand
:
: On Wed, 14 Jul 2004 NYY96@aol.com wrote:
:
: :
: : I  have a very nice Axis Web Service running in which I call a "query"
: :  function which returns an arbitrarily sized array of type String[].
:  :
: : I call the axis implementation file with the following call (Assume  all
: : setup of service is correct):
: :
: : java.lang.String[]  yes_list = 
(java.lang.String[])handler.query(groupName,
: : password,  accountName, conditions);
: :
: : handler.query is the function which  returns the String[]. Regardless, 
this
: : function, while actually  successfully running through Axis, brings about 
the
: : following exception  on the local machine:
: :
: : java.lang.ClassCastException
: :  java.lang.ClassCastException
: : at $Proxy0.query(Unknown Source)
: :  at
: :  
_2._0._0._127.axis.services.adminHandlerServicePort.adminHandlerClient2.main(adminHandler
:  : Client2.java:77)
: :
: : I have checked the mailing list for possible  causes but to know avail.  
Would
: : somebody be kind enough to offer  some advice as to how I could stop this
: : message from coming up?
:  :
: : Below is my client program:
: : package  placeholder.axis.services.clientHandlerServicePort;
: :
: : public class  clientHandlerClient2
: : {
: : static String  url   =
: :  "_http://placeholder/axis/services/clientHandlerServicePort_  
(http://placeholder/axis/services/clientHandlerServicePort) ";
: : static  String router  = "_http://placeholder/axis/clientDirect_
: :  (http://placeholder/axis/clientDirect) ";
: :
: :      static String service =  "clientDirectService.wsdl";
: :
: :
: :  public static void main(String[]  args)
: : {
: : try
: : {
:  : System.err.println("This Client tests getReport");
: :
: :   ServiceFactory sf =  ServiceFactory.newInstance();
: :  URL u = new URL(router + "/" +  service);
: : QName  serviceName  = new  QName(url,"clientHandlerService");
: : Service s =  sf.createService(u,serviceName);
: :
: :         QName portName  = new  QName(url,"clientHandlerServicePort");
: :
: :       List  handlerChain =
: :  s.getHandlerRegistry().getHandlerChain(portName);
: : HandlerInfo hi =  new  HandlerInfo(LoggingHandler.class,null,null);
: :  handlerChain.add(hi);
: :
: :             //Checking for  proper syntax of  call
: : if   (args.length!=3)
: : {
: : System.err.println("Incorrect  usage of  Client. Please use the 
following:");
: :  System.err.println("clientHandlerClient" + " [Account Name]" +  "
: :  [Password]" + "    [Conditions]");
: : }
: : else
: :  {
: : System.out.println("Thank You. Processing. . .");
: :  ClientHandler  handler = (ClientHandler) s.getPort(portName,
: :  ClientHandler.class);
: :
: :   String accountName    =  args[0];
: : String password    =  args[1];
: :  String conditions = args[2];
: :
: : if(s == null)
: :  System.out.println("Service Not Working Properly");
: :
: :    String[] queryList = handler.query(accountName, password,   
conditions);
: :
: :   System.out.println("Testing in  csv  format");
: : String format = "csv";
: :
: :    String[] rawQueryList = handler.getQuery(accountName, password,   
queryList,
: : format);
: :
: :    System.out.println("Finished.");
: : }
: : }
: :  catch(Exception  e)
: : {
: : System.err.println("Error  running  Client:");
: : System.err.println(e);
: :  e.printStackTrace();
: : }
: : }
: : }
: :
: : I would  appreciate any comments on this manner. I have checked the
: : axis-mailing  list for previous solutions however have found none have 
been  helpful  for
: : me to diagnose.
: :
: : Sincere Thanks,
: : James  Crosson





Mime
View raw message