Multiple parameters in a Axis webservice client
This is my first time writing a web service client, it's funny, I have already written a webservice;)
Anyways, I am using axis to invoke the WS by following code
String endpoint =
"http://localhost:8080/SpeechServices/SpeechWebService/SpeechWebService";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://ws.ecw.com/", "parseN开发者_JAVA技巧otes"));
HashMap ret = (HashMap) call.invoke(new Object[]{"", "", ""});
System.out.println("Sent 'Hello!', got '" + ret + "'");
My Service returns a HashMap and has three input parameters apuId,providerId,notes I am not sure how to send these parameters to the WS, I am sure it's just few method calls away ex; call.setProperty. Please advise
Okay, this is the answer, it does not completely work yet because Axis does not seem to be supporting hashmap as webservice response.
String endpoint =
"http://localhost:8080/eCWServices/StructSpeech/StructSpeech";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://ejb.ecw.com/", "parseNotes"));
call.addParameter("notes", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
call.addParameter("apuId", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
call.addParameter("providerId", org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.SOAP_MAP);
HashMap ret = (HashMap) call.invoke(new Object[]{"","",""});
System.out.println("Sent 'Hello!', got '" + ret + "'");
精彩评论