• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is JAX-WS method ArrayList

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to all.

I have made one web service using JAX-WS. In that i have made one method which return ArrayList.

code :
@WebMethod(operationName = "getStudentList")
public ArrayList getStudentList(@WebParam(name = "StudentId")
String StudentId)
{

ArrayList al = new ArrayList();

//TODO write your implementation code here

return al;
}

When i am trying to access this method from Client Application it will show error message such as.
Error Message : com.sun.xml.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html;charset=utf-8 Supported ones are: [text/xml]

Why this error occur and what is solution.

Thanks in advance.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You create a separate bean with name ResponseData and in that bean you create this Array list object and while returning set data into this ArrayList and return it. Thats what I am practicing my current Web Services code


Hope this helps, Thanks Vijay Gadde
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Return ArrayList - My advice is DONT!

Use the very handy toArray method and define your method to return an array. Arrays of common types are supported by all languages - Net, Python, javascript, whatever, that may want to talk to your web service, but the ArrayList class is Java only.

There is really no reason for any client program to receive an ArrayList.

Bill
 
I've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic