Search in sources :

Example 1 with Fault

use of org.apache.soap.Fault 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();
    }
}
Also used : Response(org.apache.soap.rpc.Response) Call(org.apache.soap.rpc.Call) SOAPException(org.apache.soap.SOAPException) Parameter(org.apache.soap.rpc.Parameter) Fault(org.apache.soap.Fault) Vector(java.util.Vector)

Aggregations

Vector (java.util.Vector)1 Fault (org.apache.soap.Fault)1 SOAPException (org.apache.soap.SOAPException)1 Call (org.apache.soap.rpc.Call)1 Parameter (org.apache.soap.rpc.Parameter)1 Response (org.apache.soap.rpc.Response)1