Forums Register Login

problem in generating stubs with java.util.List

+Pie Number of slices to send: Send
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>
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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

 
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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

 
+Pie Number of slices to send: Send
check all the namespaces url you have used and the binding element .It must be java.util.List
ice is for people that are not already cool. Chill with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1978 times.
Similar Threads
How to access byte array web method
Axis2 databinding problem
Can we support Map/HashMap in the webservice as one of internal parameters?
Cannot create service instance, service 'x' not found in wsdl
response unable to receive the parameter sent
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 00:33:23.