This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 41631
    
  55
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem returning a String array from a web service