Send a Map (internally converted to XML) to a Web Service -
i have map in java , want send web service. web service expects xml.
example
map<string, string> dummymap = new hashmap<string, string>(); dummymap.put("a", "a"); dummymap.put("b", "b"); dummymap.put("c", "c"); dummymap.put("d", "d");
is there tool can send map internally converted xml , sent web service in java?
try ... using map .... fill in rest of details have set comments ....
the connection post default ...
import java.util.hashmap; import java.util.map; import cjm.component.mb.commons.mbconstants; import cjm.component.mb.ws.wsmessenger; public class testclass { public static void main(string[] args) { try { map<string, string> dummymap = new hashmap<string, string>(); dummymap.put("a", "a"); dummymap.put("b", "b"); dummymap.put("c", "c"); dummymap.put("d", "d"); wsmessenger wsmessenger = new wsmessenger(); string communicationurl = "http://whatever"; //web service host url map<string, string> propertymap = new hashmap<string, string>(); // add properties related web service (like hostname, content map, etc.) map map<string, object> responsemap = wsmessenger.sendrequest(dummymap, communicationurl , propertymap ); system.out.println(responsemap.get(mbconstants.status)); //web service hit status code system.out.println(responsemap.get(mbconstants.response_xml)); //web service response xml system.out.println(responsemap.get(mbconstants.response)); //web service response map } catch (exception e) { e.printstacktrace(); } }
}
Comments
Post a Comment