I have written a simple webservice. Which just prints the content of the input.
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?
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.
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?
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.
subject: Can we support Map/HashMap in the webservice as one of internal parameters?