Hugo Silva Hugo Silva - 1 year ago 101
Java Question

JDeveloper [JAVA] - Define response message in Webmethod

I am using JDeveloper to build webservices and testing them with the utility "HTTP Analyzer".
However I can't seem to create an output that works when I call that webmethod from HTTP Analyzer.

Example code:

public HashMap <Integer, Integer> DeleteSomething (Object something) {
return class.deleteSth(something); //This returns HashMap

The only thing displayed in the return message is the code '200 OK'.

How do I return something from the webmethod into HTTP Analyzer?

EDIT: I've managed to return something by using the HashMap values to create a List of Strings and returning the List instead. However I would still like to know why the HashMap didn't work.

Thanks for your help :)

Answer Source

List can be converted internally by SOAP WS. Map is something which explicitly needs adapter to convert into appropriate Response.

This explains the example of converting and wrapping up the response.

Briefly, using MapAdapter class helps JAXB in wrapping the response. SOAP can handle List being a member to a POJO class and not being the direct member in the older versions. A bug logged for this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download