Package edu.monash.merc.exception

Examples of edu.monash.merc.exception.WSException


            _serviceClient.getOptions().setTo(new EndpointReference(this.targetEndpoint));
            _serviceClient.getOptions().setUseSeparateListener(this.useSeparateListener);
            _serviceClient.getOptions().setTimeOutInMilliSeconds(timeout);
            configured = true;
        } catch (Exception e) {
            throw new WSException(e);
        }
    }
View Full Code Here


        return Long.toString(System.currentTimeMillis()) + "_" + counter;
    }

    public String getNlaId(String authcateId) {
        if (!isConfigured()) {
            throw new WSException("call serviceInit first before getNlaId.");
        }

        try {
            OperationClient operationClient = _serviceClient.createClient(operations[0].getName());
            operationClient.getOptions().setAction(ACTION_GET_NLAID);
            operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
            // operationClient.getOptions().setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
            // create a message context
            MessageContext messageContext = new org.apache.axis2.context.MessageContext();

            // create SOAP envelope with that payload
            org.apache.axiom.soap.SOAPEnvelope env = null;
            SOAPFactory factory = getFactory(operationClient.getOptions().getSoapVersionURI());
            env = createEnvelope(factory, ACTION_GET_NLAID, authcateId);

            // adding SOAP soap_headers
            _serviceClient.addHeadersToEnvelope(env);

            // set the message context with that soap envelope
            messageContext.setEnvelope(env);

            // add the message contxt to the operation client
            operationClient.addMessageContext(messageContext);

            // execute the operation client
            operationClient.execute(true);

            MessageContext returnMessageContext = operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);

            SOAPEnvelope _returnEnv = returnMessageContext.getEnvelope();

            return parseNlaId(_returnEnv);
        } catch (AxisFault axe) {

            OMElement fault = axe.getDetail();
            if (fault != null) {
                throw new WSException(fault.getFirstElement().getText());
            } else {
                throw new WSException(axe);
            }
        } catch (Exception e) {
            loger.error("research master ws failed, " + e);
            throw new WSException(e);
        } finally {
            try {
                if (_serviceClient != null) {
                    _serviceClient.cleanupTransport();
                }
View Full Code Here

        return nlaIdElement.getText();
    }

    public PartyBean getPartyRegistryObject(String nlaId) {
        if (!isConfigured()) {
            throw new WSException("call serviceInit first before getPartyRegistryObject.");
        }

        try {
            OperationClient operationClient = _serviceClient.createClient(operations[1].getName());
            operationClient.getOptions().setAction(ACTION_GET_PARTY_OBJECT);
            operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
            // operationClient.getOptions().setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
            // create a message context
            MessageContext messageContext = new org.apache.axis2.context.MessageContext();

            // create SOAP envelope with that payload
            org.apache.axiom.soap.SOAPEnvelope env = null;
            SOAPFactory factory = getFactory(operationClient.getOptions().getSoapVersionURI());
            env = createEnvelope(factory, ACTION_GET_PARTY_OBJECT, nlaId);
            // System.out.println("=== sending envelope: " + env);
            // adding SOAP soap_headers
            _serviceClient.addHeadersToEnvelope(env);

            // set the message context with that soap envelope
            messageContext.setEnvelope(env);

            // add the message contxt to the operation client
            operationClient.addMessageContext(messageContext);

            // execute the operation client
            operationClient.execute(true);

            MessageContext returnMessageContext = operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);

            SOAPEnvelope _returnEnv = returnMessageContext.getEnvelope();

            return parseParty(_returnEnv);
        } catch (AxisFault axe) {
            OMElement fault = axe.getDetail();
            if (fault != null) {
                String message = fault.getFirstElement().getText();
                throw new WSException(message);
            } else {
                throw new WSException(axe);
            }
        } catch (Exception e) {
            loger.error("research master ws failed, " + e);
            throw new WSException(e);
        } finally {
            try {
                if (_serviceClient != null) {
                    _serviceClient.cleanupTransport();
                }
View Full Code Here

        return pb;
    }

    public List<ProjectBean> getProjects(String nlaId) {
        if (!isConfigured()) {
            throw new WSException("call serviceInit first before getProjects.");
        }

        try {
            OperationClient operationClient = _serviceClient.createClient(operations[2].getName());
            operationClient.getOptions().setAction(ACTION_GET_PROJECTS);
            operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
            // operationClient.getOptions().setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
            // create a message context
            MessageContext messageContext = new org.apache.axis2.context.MessageContext();

            // create SOAP envelope with that payload
            org.apache.axiom.soap.SOAPEnvelope env = null;
            SOAPFactory factory = getFactory(operationClient.getOptions().getSoapVersionURI());
            env = createEnvelope(factory, ACTION_GET_PROJECTS, nlaId);

            // adding SOAP soap_headers
            _serviceClient.addHeadersToEnvelope(env);

            // set the message context with that soap envelope
            messageContext.setEnvelope(env);

            // add the message contxt to the operation client
            operationClient.addMessageContext(messageContext);

            // execute the operation client
            operationClient.execute(true);

            MessageContext returnMessageContext = operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            SOAPEnvelope _returnEnv = returnMessageContext.getEnvelope();
            // System.out.println("===> env: " + _returnEnv);
            return parseActivitySummary(_returnEnv);
        } catch (AxisFault axe) {
            OMElement fault = axe.getDetail();
            if (fault != null) {
                String message = fault.getFirstElement().getText();
                throw new WSException(message);
            } else {
                throw new WSException(axe);
            }
        } catch (Exception e) {
            loger.error("research master ws failed, " + e);
            throw new WSException(e);
        } finally {
            try {
                if (_serviceClient != null) {
                    _serviceClient.cleanupTransport();
                }
View Full Code Here

        return projectsList;
    }

    public ActivityBean getActivityRegistryObject(String activityId) {
        if (!isConfigured()) {
            throw new WSException("call serviceInit first before getActivityRegistryObject.");
        }

        try {
            OperationClient operationClient = _serviceClient.createClient(operations[3].getName());
            operationClient.getOptions().setAction(ACTION_GET_ACTIVITY_OBJECT);
            operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
            operationClient.getOptions().setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
            // create a message context
            MessageContext messageContext = new org.apache.axis2.context.MessageContext();

            // create SOAP envelope with that payload
            org.apache.axiom.soap.SOAPEnvelope env = null;
            SOAPFactory factory = getFactory(operationClient.getOptions().getSoapVersionURI());
            env = createEnvelope(factory, ACTION_GET_ACTIVITY_OBJECT, activityId);

            // adding SOAP soap_headers
            _serviceClient.addHeadersToEnvelope(env);

            // set the message context with that soap envelope
            messageContext.setEnvelope(env);

            // add the message contxt to the operation client
            operationClient.addMessageContext(messageContext);

            // execute the operation client
            operationClient.execute(true);

            MessageContext returnMessageContext = operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);

            SOAPEnvelope _returnEnv = returnMessageContext.getEnvelope();

            // System.out.println("===> env: " + _returnEnv);
            return parseActivity(_returnEnv);
        } catch (AxisFault axe) {
            OMElement fault = axe.getDetail();
            if (fault != null) {
                String message = fault.getFirstElement().getText();
                throw new WSException(message);
            } else {
                throw new WSException(axe);
            }
        } catch (Exception e) {
            loger.error("research master ws failed, " + e);
            throw new WSException(e);
        } finally {
            try {
                if (_serviceClient != null) {
                    _serviceClient.cleanupTransport();
                }
View Full Code Here

TOP

Related Classes of edu.monash.merc.exception.WSException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.