Search in sources :

Example 1 with WSIFOperation

use of xsul.wsif.WSIFOperation in project airavata by apache.

the class SimpleWSClient method sendSOAPMessage.

/**
 * @param wclient
 * @param args
 * @param opName
 * @return The output
 * @throws ComponentRegistryException
 */
public WSIFMessage sendSOAPMessage(WSIFClient wclient, Object[][] args, String opName) throws ComponentRegistryException {
    WSIFPort port = wclient.getPort();
    WSIFOperation operation = port.createOperation(opName);
    WSIFMessage outputMessage = operation.createOutputMessage();
    WSIFMessage faultMessage = operation.createFaultMessage();
    String messageName = operation.createInputMessage().getName();
    XmlElement inputMsgElem = builder.newFragment(this.requestNS, messageName);
    for (int i = 0; i < args.length; i++) {
        createMessage((String) args[i][0], args[i][1], inputMsgElem);
    }
    WSIFMessageElement inputMessage = new WSIFMessageElement(inputMsgElem);
    boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
    if (success) {
        logger.debug("" + outputMessage);
        return outputMessage;
    } else {
        throw new ComponentRegistryException("Excpetion at server " + faultMessage);
    }
}
Also used : WSIFMessageElement(xsul.wsif.impl.WSIFMessageElement) WSIFOperation(xsul.wsif.WSIFOperation) WSIFPort(xsul.wsif.WSIFPort) XmlElement(org.xmlpull.v1.builder.XmlElement) ComponentRegistryException(org.apache.airavata.workflow.model.component.ComponentRegistryException) WSIFMessage(xsul.wsif.WSIFMessage)

Example 2 with WSIFOperation

use of xsul.wsif.WSIFOperation in project airavata by apache.

the class GFacServiceCreator method shutdownService.

/**
 * Shutdowns the service created.
 *
 * @throws WorkflowException
 */
public void shutdownService() throws WorkflowException {
    WSIFService service = WSIFServiceFactory.newInstance().getService(this.serviceDefinitions);
    WSIFPort port = service.getPort();
    WSIFOperation operation = port.createOperation(SHUTDOWN_OPERATION);
    WSIFMessage inputMessage = operation.createInputMessage();
    WSIFMessage outputMessage = operation.createOutputMessage();
    WSIFMessage faultMessage = operation.createFaultMessage();
    boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
    if (!success) {
        // An implementation of WSIFMessage, WSIFMessageElement,
        // implements toString(), which serialize the message XML.
        String message = "Failed to shutdown the service: " + faultMessage.toString();
        throw new WorkflowException(message);
    }
}
Also used : WSIFService(xsul.wsif.WSIFService) WSIFOperation(xsul.wsif.WSIFOperation) WSIFPort(xsul.wsif.WSIFPort) WorkflowException(org.apache.airavata.workflow.model.exceptions.WorkflowException) WSIFMessage(xsul.wsif.WSIFMessage)

Aggregations

WSIFMessage (xsul.wsif.WSIFMessage)2 WSIFOperation (xsul.wsif.WSIFOperation)2 WSIFPort (xsul.wsif.WSIFPort)2 ComponentRegistryException (org.apache.airavata.workflow.model.component.ComponentRegistryException)1 WorkflowException (org.apache.airavata.workflow.model.exceptions.WorkflowException)1 XmlElement (org.xmlpull.v1.builder.XmlElement)1 WSIFService (xsul.wsif.WSIFService)1 WSIFMessageElement (xsul.wsif.impl.WSIFMessageElement)1