Example usage for javax.xml.stream FactoryConfigurationError getMessage

List of usage examples for javax.xml.stream FactoryConfigurationError getMessage

Introduction

In this page you can find the example usage for javax.xml.stream FactoryConfigurationError getMessage.

Prototype

public String getMessage() 

Source Link

Document

Report the message associated with this error

Usage

From source file:edu.harvard.i2b2.analysis.queryClient.QueryClient.java

public static String sendPDORequestSOAP(String requestString, boolean showname) {

    try {/*  w w  w  . ja  v  a2  s .c  o m*/
        ServiceClient sender = AxisServiceClient.getServiceClient();
        OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        // creating message context
        MessageContext outMsgCtx = new MessageContext();
        // assigning message context's option object into instance variable
        Options opts = outMsgCtx.getOptions();
        // setting properties into option

        if (showname) {
            // IM
            targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("IM"));
        } else {
            // crc
            targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("CRC"));
        }
        log.debug(targetEPR);
        opts.setTo(targetEPR);
        opts.setAction("http://rpdr.partners.org/GetPatientSetByQueryId");
        opts.setTimeOutInMilliSeconds(900000);

        log.debug(requestString);

        SOAPEnvelope envelope = null;
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", "rpdr");

        // creating the SOAP payload
        OMElement method = fac.createOMElement("GetPatientSetByQueryId", omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs);
        value.setText(requestString);
        method.addChild(value);
        envelope.getBody().addChild(method);

        outMsgCtx.setEnvelope(envelope);

        operationClient.addMessageContext(outMsgCtx);
        operationClient.execute(true);

        MessageContext inMsgtCtx = operationClient.getMessageContext("In");
        SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

        OMElement soapResponse = responseEnv.getBody().getFirstElement();
        // System.out.println("Sresponse: "+ soapResponse.toString());
        OMElement soapResult = soapResponse.getFirstElement();
        // System.out.println("Sresult: "+ soapResult.toString());

        String i2b2Response = soapResult.getText();
        log.debug(i2b2Response);
        return i2b2Response;

    } catch (FactoryConfigurationError e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return null;
    } catch (AxisFault e) {
        log.error("CellDown");
        e.printStackTrace();
        return "CellDown";
    } catch (Exception e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return null;
    }
}

From source file:edu.harvard.i2b2.eclipse.login.LoginHelper.java

public static String sendSOAP(EndpointReference soapEPR, String requestString, String action, String operation)
        throws Exception {

    ServiceClient sender = PmServiceClient.getServiceClient();
    OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

    // creating message context
    MessageContext outMsgCtx = new MessageContext();
    // assigning message context's option object into instance variable
    Options opts = outMsgCtx.getOptions();
    // setting properties into option
    log.debug(soapEPR);/* w ww.j a  v  a2  s . co m*/
    opts.setTo(soapEPR);
    opts.setAction(action);
    opts.setTimeOutInMilliSeconds(180000);

    log.debug(requestString);

    SOAPEnvelope envelope = null;

    try {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", //$NON-NLS-1$
                "rpdr"); //$NON-NLS-1$

        // creating the SOAP payload
        OMElement method = fac.createOMElement(operation, omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs); //$NON-NLS-1$
        value.setText(requestString);
        method.addChild(value);
        envelope.getBody().addChild(method);
    } catch (FactoryConfigurationError e) {
        log.error(e.getMessage());
        throw new Exception(e);
    }

    outMsgCtx.setEnvelope(envelope);

    operationClient.addMessageContext(outMsgCtx);
    operationClient.execute(true);

    MessageContext inMsgtCtx = operationClient.getMessageContext("In"); //$NON-NLS-1$
    SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

    OMElement soapResponse = responseEnv.getBody().getFirstElement();
    //      System.out.println("Sresponse: "+ soapResponse.toString());
    OMElement soapResult = soapResponse.getFirstElement();
    //      System.out.println("Sresult: "+ soapResult.toString());

    String i2b2Response = soapResult.getText();
    log.debug(i2b2Response);

    return i2b2Response;
}

From source file:edu.harvard.i2b2.analysis.queryClient.QueryClient.java

public static String sendQueryRequestSOAP(String requestString) {

    try {//from  w w w  .  jav  a  2  s .  c  o  m
        ServiceClient sender = AxisServiceClient.getServiceClient();
        OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        // creating message context
        MessageContext outMsgCtx = new MessageContext();
        // assigning message context's option object into instance variable
        Options opts = outMsgCtx.getOptions();
        // setting properties into option

        targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("CRC"));
        log.debug(targetEPR);
        opts.setTo(targetEPR);
        opts.setAction("http://rpdr.partners.org/GetPreviousQueryList");
        opts.setTimeOutInMilliSeconds(180000);

        log.debug(requestString);

        SOAPEnvelope envelope = null;
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", "rpdr");

        // creating the SOAP payload
        OMElement method = fac.createOMElement("GetPreviousQueryList", omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs);
        value.setText(requestString);
        method.addChild(value);
        envelope.getBody().addChild(method);

        outMsgCtx.setEnvelope(envelope);

        operationClient.addMessageContext(outMsgCtx);
        operationClient.execute(true);

        MessageContext inMsgtCtx = operationClient.getMessageContext("In");
        SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

        OMElement soapResponse = responseEnv.getBody().getFirstElement();
        log.debug("Sresponse: " + soapResponse.toString());
        OMElement soapResult = soapResponse.getFirstElement();
        // System.out.println("Sresult: "+ soapResult.toString());

        String i2b2Response = soapResult.getText();
        log.debug(i2b2Response);
        return i2b2Response;

    } catch (FactoryConfigurationError e) {
        e.printStackTrace();
        log.error(e.getMessage());
        return null;
    } catch (AxisFault e) {
        e.printStackTrace();
        log.error("CellDown");
        return "CellDown";
    } catch (Exception e) {
        e.printStackTrace();
        log.error(e.getMessage());
        return null;
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.analysis.ontologyMessaging.OntServiceDriver.java

/**
 * Function to convert Ont requestVdo to OMElement
 * /*  w w  w.j  a  v a 2 s .co m*/
 * @param requestVdo   String requestVdo to send to Ont web service
 * @return An OMElement containing the Ont web service requestVdo
 */
public static OMElement getOntPayLoad(String requestVdo) throws Exception {
    OMElement lineItem = null;
    try {
        StringReader strReader = new StringReader(requestVdo);
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(strReader);

        StAXOMBuilder builder = new StAXOMBuilder(reader);
        lineItem = builder.getDocumentElement();
    } catch (FactoryConfigurationError e) {
        log.error(e.getMessage());
        throw new Exception(e);
    }
    return lineItem;
}

From source file:edu.harvard.i2b2.patientSet.serviceClient.QueryListNamesClient.java

public static String sendPDORequestSOAP(String requestString, boolean showname) {

    try {//from  w  w  w  . j  a v a  2  s  .  com
        ServiceClient sender = QueryServiceClient.getServiceClient();
        OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        // creating message context
        MessageContext outMsgCtx = new MessageContext();
        // assigning message context's option object into instance variable
        Options opts = outMsgCtx.getOptions();
        // setting properties into option

        if (showname) {
            // IM
            targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("IM"));
        } else {
            // crc
            targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("CRC"));
        }
        log.debug(targetEPR);
        opts.setTo(targetEPR);
        opts.setAction("http://rpdr.partners.org/GetPatientSetByQueryId");
        opts.setTimeOutInMilliSeconds(900000);

        log.debug(requestString);

        SOAPEnvelope envelope = null;
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", "rpdr");

        // creating the SOAP payload
        OMElement method = fac.createOMElement("GetPatientSetByQueryId", omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs);
        value.setText(requestString);
        method.addChild(value);
        envelope.getBody().addChild(method);

        outMsgCtx.setEnvelope(envelope);

        operationClient.addMessageContext(outMsgCtx);
        operationClient.execute(true);

        MessageContext inMsgtCtx = operationClient.getMessageContext("In");
        SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

        OMElement soapResponse = responseEnv.getBody().getFirstElement();
        // System.out.println("Sresponse: "+ soapResponse.toString());
        OMElement soapResult = soapResponse.getFirstElement();
        // System.out.println("Sresult: "+ soapResult.toString());

        String i2b2Response = soapResult.getText();
        log.debug(i2b2Response);
        return i2b2Response;

    } catch (FactoryConfigurationError e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return null;
    } catch (AxisFault e) {
        log.error("CellDown");
        e.printStackTrace();
        return "CellDown";
    } catch (Exception e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return null;
    }
}

From source file:edu.harvard.i2b2.eclipse.login.LoginHelper.java

/**
 * Function to convert pm request to OMElement
 * /* w  ww .  j a v  a  2 s. c om*/
 * @param requestVdo   String request to send to pm web service
 * @return An OMElement containing the pm web service request
 */
public static OMElement getPmPayLoad(String requestVdo) throws Exception {
    OMElement method = null;
    try {
        StringReader strReader = new StringReader(requestVdo);
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(strReader);

        StAXOMBuilder builder = new StAXOMBuilder(reader);
        method = builder.getDocumentElement();

        /*
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://www.i2b2.org/xsd/hive/msg",
        "i2b2");
                
        method = fac.createOMElement("request", omNs);
                
        StringReader strReader = new StringReader(requestVdo);
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(strReader);
                
        StAXOMBuilder builder = new StAXOMBuilder(reader);
        //method = builder.getDocumentElement();
        OMElement lineItem = builder.getDocumentElement();
        method.addChild(lineItem);
        */
    } catch (FactoryConfigurationError e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        log.error(e.getMessage());
        throw new Exception(e);
    }
    return method;
}

From source file:edu.harvard.i2b2.previousquery.serviceClient.QueryListNamesClient.java

public static String sendPDORequestSOAP(String requestString, boolean showname) {

    try {/*from   www.j av  a  2 s  .  c o  m*/
        ServiceClient sender = QueryServiceClient.getServiceClient();
        OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        // creating message context
        MessageContext outMsgCtx = new MessageContext();
        // assigning message context's option object into instance variable
        Options opts = outMsgCtx.getOptions();
        // setting properties into option

        //if (showname) {
        // IM
        //targetEPR = new EndpointReference(UserInfoBean.getInstance()
        //.getCellDataUrl("IM"));
        //} else {
        // crc
        targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("CRC"));
        //}
        log.debug(targetEPR);
        opts.setTo(targetEPR);
        opts.setAction("http://rpdr.partners.org/GetPatientSetByQueryId");
        opts.setTimeOutInMilliSeconds(900000);

        log.debug(requestString);

        SOAPEnvelope envelope = null;
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", "rpdr");

        // creating the SOAP payload
        OMElement method = fac.createOMElement("GetPatientSetByQueryId", omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs);
        value.setText(requestString);
        method.addChild(value);
        envelope.getBody().addChild(method);

        outMsgCtx.setEnvelope(envelope);

        operationClient.addMessageContext(outMsgCtx);
        operationClient.execute(true);

        MessageContext inMsgtCtx = operationClient.getMessageContext("In");
        SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

        OMElement soapResponse = responseEnv.getBody().getFirstElement();
        // System.out.println("Sresponse: "+ soapResponse.toString());
        OMElement soapResult = soapResponse.getFirstElement();
        // System.out.println("Sresult: "+ soapResult.toString());

        String i2b2Response = soapResult.getText();
        log.debug(i2b2Response);
        return i2b2Response;

    } catch (FactoryConfigurationError e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return null;
    } catch (AxisFault e) {
        log.error("CellDown");
        e.printStackTrace();
        return "CellDown";
    } catch (Exception e) {
        log.error(e.getMessage());
        e.printStackTrace();
        return null;
    }
}

From source file:edu.harvard.i2b2.patientSet.serviceClient.QueryListNamesClient.java

public static String sendQueryRequestSOAP(String requestString) {

    try {/*from ww  w  .  j  a  v a  2 s  .co m*/
        ServiceClient sender = QueryServiceClient.getServiceClient();
        OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

        // creating message context
        MessageContext outMsgCtx = new MessageContext();
        // assigning message context's option object into instance variable
        Options opts = outMsgCtx.getOptions();
        // setting properties into option

        targetEPR = new EndpointReference(UserInfoBean.getInstance().getCellDataUrl("CRC"));
        log.debug(targetEPR);
        opts.setTo(targetEPR);
        opts.setAction("http://rpdr.partners.org/GetPreviousQueryList");
        opts.setTimeOutInMilliSeconds(180000);

        log.debug(requestString);

        SOAPEnvelope envelope = null;
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", "rpdr");

        // creating the SOAP payload
        OMElement method = fac.createOMElement("GetPreviousQueryList", omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs);
        value.setText(requestString);
        method.addChild(value);
        envelope.getBody().addChild(method);

        outMsgCtx.setEnvelope(envelope);

        operationClient.addMessageContext(outMsgCtx);
        operationClient.execute(true);

        MessageContext inMsgtCtx = operationClient.getMessageContext("In");
        SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

        OMElement soapResponse = responseEnv.getBody().getFirstElement();
        System.out.println("Sresponse: " + soapResponse.toString());
        OMElement soapResult = soapResponse.getFirstElement();
        // System.out.println("Sresult: "+ soapResult.toString());

        String i2b2Response = soapResult.getText();
        log.debug(i2b2Response);
        return i2b2Response;

    } catch (FactoryConfigurationError e) {
        e.printStackTrace();
        log.error(e.getMessage());
        return null;
    } catch (AxisFault e) {
        e.printStackTrace();
        log.error("CellDown");
        return "CellDown";
    } catch (Exception e) {
        e.printStackTrace();
        log.error(e.getMessage());
        return null;
    }
}

From source file:edu.harvard.i2b2.eclipse.plugins.analysis.ontologyMessaging.OntServiceDriver.java

public static String sendSOAP(String requestString, String action, String operation, String type)
        throws Exception {

    ServiceClient sender = OntServiceClient.getServiceClient();
    OperationClient operationClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);

    // creating message context
    MessageContext outMsgCtx = new MessageContext();
    // assigning message context's option object into instance variable
    Options opts = outMsgCtx.getOptions();
    // setting properties into option
    log.debug(soapEPR);/*from   w  w  w . ja  v a 2s.c o  m*/
    opts.setTo(soapEPR);
    opts.setAction(action);
    opts.setTimeOutInMilliSeconds(180000);

    log.debug(requestString);

    SOAPEnvelope envelope = null;

    try {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        envelope = fac.getDefaultEnvelope();
        OMNamespace omNs = fac.createOMNamespace("http://rpdr.partners.org/", "rpdr");

        // creating the SOAP payload
        OMElement method = fac.createOMElement(operation, omNs);
        OMElement value = fac.createOMElement("RequestXmlString", omNs);
        value.setText(requestString);
        method.addChild(value);
        envelope.getBody().addChild(method);
    } catch (FactoryConfigurationError e) {
        log.error(e.getMessage());
        throw new Exception(e);
    }

    outMsgCtx.setEnvelope(envelope);

    // used to be envelope.getBody().getFirstElement().toString()
    if (type != null) {
        String request = envelope.toString();
        String formattedRequest = XMLUtil.StrFindAndReplace("&lt;", "<", request);
        if (type.equals("ONT")) {
            MessageUtil.getInstance().setRequest("URL: " + soapEPR + "\n" + formattedRequest);
        }

        else {
            MessageUtil.getInstance().setRequest("URL: " + soapEPR + "\n" + formattedRequest);
        }
    }

    operationClient.addMessageContext(outMsgCtx);
    operationClient.execute(true);

    MessageContext inMsgtCtx = operationClient.getMessageContext("In");
    SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope();

    OMElement soapResponse = responseEnv.getBody().getFirstElement();

    if (type != null) {
        if (type.equals("ONT")) {
            String formattedResponse = XMLUtil.StrFindAndReplace("&lt;", "<", responseEnv.toString());
            String indentedResponse = XMLUtil.convertDOMToString(XMLUtil.convertStringToDOM(formattedResponse));
            MessageUtil.getInstance().setResponse("URL: " + soapEPR + "\n" + indentedResponse);
        } else {
            String formattedResponse = XMLUtil.StrFindAndReplace("&lt;", "<", responseEnv.toString());
            String indentedResponse = XMLUtil.convertDOMToString(XMLUtil.convertStringToDOM(formattedResponse));
            MessageUtil.getInstance().setResponse("URL: " + soapEPR + "\n" + indentedResponse);
        }
    }

    //      System.out.println("Sresponse: "+ soapResponse.toString());
    OMElement soapResult = soapResponse.getFirstElement();
    //      System.out.println("Sresult: "+ soapResult.toString());

    String i2b2Response = soapResult.getText();
    log.debug(i2b2Response);

    return i2b2Response;
}

From source file:edu.harvard.i2b2.eclipse.plugins.patientSet.workplaceMessaging.WorkplaceServiceDriver.java

/**
 * Function to convert Work requestWdo to OMElement
 * /*from www.j av  a  2 s .c om*/
 * @param requestWdo   String requestWdo to send to Work web service
 * @return An OMElement containing the Work web service requestWdo
 */
public static OMElement getWorkPayLoad(String requestWdo) throws Exception {
    OMElement lineItem = null;
    try {
        StringReader strReader = new StringReader(requestWdo);
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(strReader);

        StAXOMBuilder builder = new StAXOMBuilder(reader);
        lineItem = builder.getDocumentElement();
    } catch (FactoryConfigurationError e) {
        log.error(e.getMessage());
        throw new Exception(e);
    }
    return lineItem;
}