aspose file tools*
The moose likes Web Services and the fly likes Problem returning a String array from a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem returning a String array from a web service" Watch "Problem returning a String array from a web service" New topic
Author

Problem returning a String array from a web service

Sac Anand
Greenhorn

Joined: Apr 21, 2006
Posts: 19
Hi,

I am trying to send an array of string from my web service.

When i try to compile client, following error comes:
incompatible types
[javac] found : java.util.List<java.lang.String>
[javac] required: java.lang.String[]


I am using Sun Application Server to deploy my web service application.

Can anybody help me in this regard?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42585
    
  65
It sounds like there is a type mismatch somewhere. Apparently, somewhere a List<String> is used, instead of a String[]. Make sure arrays are used where you consume the WS.


Ping & DNS - my free Android networking tools app
Sac Anand
Greenhorn

Joined: Apr 21, 2006
Posts: 19
Server Code


Client Code


Now, when i generate client side artifacts, it uses java.util.List<java.lang.String> but i don't know why?

WSDL looks like (automatically generated)


XSD is also generated at server side .. it looks like


Any help is highly appreciated.
Marty Speck
Greenhorn

Joined: Jan 21, 2003
Posts: 4
[javac] found : java.util.List<java.lang.String>
[javac] required: java.lang.String[]


Looks like you're returning a List of Strings from a method instead of an Array of Strings.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem returning a String array from a web service