use of org.apache.soap.rpc.Call in project iaf by ibissource.
the class ServiceDispatcher_ServiceProxy method dispatchRequest.
/**
* Dispatch a request.
* @param servicename ServiceName
* @param correlationId CorrelationID
* @param message Message
* @return String the result
* @throws SOAPException
*/
public String dispatchRequest(String servicename, String correlationId, String message) throws SOAPException {
Call call = new Call();
call.setTargetObjectURI("urn:service-dispatcher");
call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
String SOAPActionURI = "urn:service-dispatcher";
if (url == null) {
throw new SOAPException(Constants.FAULT_CODE_CLIENT, "A URL must be specified via " + "ServiceDispatcher_ServiceProxy.setEndPoint(URL).");
}
call.setMethodName("dispatchRequest");
Vector params = new Vector();
params.addElement(new Parameter("meth1_inType1", String.class, servicename, null));
params.addElement(new Parameter("meth1_inType2", String.class, correlationId, null));
params.addElement(new Parameter("meth1_inType3", String.class, message, null));
call.setParams(params);
Response resp = call.invoke(url, SOAPActionURI);
// Check the response.
if (resp.generatedFault()) {
Fault fault = resp.getFault();
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
} else {
Parameter retValue = resp.getReturnValue();
return (String) retValue.getValue();
}
}