• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Can we support Map/HashMap in the webservice as one of internal parameters?

 
Greenhorn
Posts: 15
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have written a simple webservice. Which just prints the content of the input.

And


I am using Eclipse Java EE IDE for Web Developers.(Version: Helios Service Release 1) for generating stubs like this :
New wizard , webservice, Selecting the server runtime (tomcat 6) and webruntime as Axis2. And clicking finish.

It generates the project with name TestClient. And inside that 2 classes : ServiceClassCallbackHandler and ServiceClassStub.

Once WebService is generated its also opening one JSP (WebService explorer) . In that I can see the WebService and clicking on basicwebservice it shows UI where I can input my data.

But its not showing if I can add key/value for map.

I am not sure how to test this?
More importantly can I test my webservice that it prints the passed data?
How to pass the test data to this webservice?
Or how to pass MyVO object to the webservice?

Thanks in advance.

 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Generally, it is considered a bad idea to use Java collection classes as parameter or result types of methods that are to be exposed as web service operations.
A suggestion, in your case, may be to store key-value pairs from the map in an array of arrays, where each row contains two elements, a key and a pair.
I am not sure about the specific case of Axis, though - there may be some mechanism that can cope with Java collection classes.
Best wishes!
 
Arpan Raj
Greenhorn
Posts: 15
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan.
I agree that we should avoid sending collections over the wire but here requirement is such that i cannot avoid .

I tried writing the wsdl first and generate the stubs/skeleton but i am not able to generate in the eclipse.
I tried generated the stubs/skeleton using wsdl2java but it gives the compilation issues.
I am stuck badly in this.

I am sharing WSDL here. Can you pl. suggest if I am missing something?

Thanks in advance.

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
As before, I have little experience with Axis. However, a quick search on the internet reveals this:
http://mail-archives.apache.org/mod_mbox/cxf-users/200809.mbox/%3Cc1038ac90809180311k716baf17pab636c0837aaa47c@mail.gmail.com%3E
It seems like the Map type is rather old and also uses SOAP encoding.
Best wishes!
 
Arpan Raj
Greenhorn
Posts: 15
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan.

I checked on the link. I am using the map in the same way in the xsd declaration.
I am able to generate the skeleton successfully.
But I've an issue with passing the value.
It generates its own map implementation and that map has Map Element entry.
Now This entry has two methods of our use to set entry's value
i.e. SetKey and SetValue in both of these generated method it takes OMElement as parameter.


And this key is of type OMElement interface I am not sure how to set this.
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic