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 NY...@aol.com on 2004/07/14 22:27:53 UTC
Returning an Array over Axis
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
Re: Returning an Array over Axis
Posted by Anand Natrajan <an...@cs.virginia.edu>.
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
Server Broken Pipe
Posted by Steve Wells <St...@mohomine.com>.
I am using a client application built with WSDL2Java derived code to
communicate with Axis 1.1 server under WebLogic
Fairly regularly, when I terminate the client Java application with ctrl-c
the WebLogic Managed Server (under which Axis is running) crashes hard &
completely with the message "Broken Pipe" - I've tried to see if there are
any close() type APIs I should call for the SOAP Binding class generated
via Axis but there is no such API in the event the server equivalent is
not cleaning up properly.
Suggestions? Ideas?
-- Steve
Re: Returning an Array over Axis
Posted by Anand Natrajan <an...@cs.virginia.edu>.
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
:
:
: