• 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

problem in generating stubs with java.util.List

 
Ranch Hand
Posts: 59
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,I am facing the problem in creating the stubs for an wsdl file. Actually, the webmethods are implemented using the generic collections like they made use of java.util.List and java.util.Map . At time of generation of wsdl file using the java, we got the following element defined for java.util.List.

At time of creating the stubs using wscompile, it is creating the seperate List class instead considering it as java.util.List. So please provide me the solution in generating the stubs with Generic Collections.


<xsd:schema xmlns:stns="java:language_builtins.util"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified"
targetNamespace="java:language_builtins.util"
elementFormDefault="qualified">
<xsd:complexType name="List">
<xsd:sequence>
<xsd:element maxOccurs="unbounded"
nillable="true"
name="anyType"
type="xsd:anyType"
minOccurs="0">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use Java Collections as your return types you will essentially require that the users of your Web Services use Java only to access your services. Since no other language is guaranteed to have those Collections available. If you use Arrays on the other hand then anyone will be able to use your Web Services.

Rudy
 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rudy, i understood your answer but here we are using the java on both the ends. i mean webservice is developed using java and at client side also , we are making use of java. But i am unable to bind the List variable to java.util.List .

Because the at time of generating the stubs , as the List is defined as complex element in wsdl, the jwsdp is considering it as a seperate class and genearating the seperate class with name List, due to which i am unable to bind the response object to java.util.List. as here jwsdp is considering the response object is an instace List class(a stub which is generated by jwsdp using wsdl file)

Hope you understood my focus. So please provide me the solution into this.

Rudy Gireyev wrote:If you use Java Collections as your return types you will essentially require that the users of your Web Services use Java only to access your services. Since no other language is guaranteed to have those Collections available. If you use Arrays on the other hand then anyone will be able to use your Web Services.

Rudy

 
Rudy Gireyev
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm unaware of SOAs ability to support Java Collections. Maybe someone else knows better though. However, if you really want to work with List you can simply do the following.
1. Use List.toArray() - to turn your List into an Array
2. Arrays.asList(Object[]) - to turn an Array into a List

Here's a link that discusses the issues with using Collections with SOA:
http://www.ibm.com/developerworks/webservices/library/ws-tip-coding/index.html

Rudy
 
Ravi Majety
Ranch Hand
Posts: 59
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rudy, I am very happy for getting a fast response from you. I understood your approach. I know that only use of arrays would be useful in webservices inplace of collections. But I like to whether is there any other solutions to customize the mapping of this complex type List to java.util.List.


Rudy Gireyev wrote:I'm unaware of SOAs ability to support Java Collections. Maybe someone else knows better though. However, if you really want to work with List you can simply do the following.
1. Use List.toArray() - to turn your List into an Array
2. Arrays.asList(Object[]) - to turn an Array into a List

Here's a link that discusses the issues with using Collections with SOA:
http://www.ibm.com/developerworks/webservices/library/ws-tip-coding/index.html

Rudy

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check all the namespaces url you have used and the binding element .It must be java.util.List
 
reply
    Bookmark Topic Watch Topic
  • New Topic