Example usage for javax.xml.stream FactoryConfigurationError printStackTrace

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

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:edu.harvard.i2b2.eclipse.plugins.pft.ws.PFTServiceDriver2.java

/**
 * Function to convert PFT requestPdo to OMElement
 * /*w w w.  java2  s  .com*/
 * @param requestPdo   String requestPdo to send to PFT web service
 * @return An OMElement containing the PFT web service requestPdo
 */
public static OMElement getPFTPayLoad(String requestPdo) throws Exception {
    OMElement method = null;
    try {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://i2b2.mgh.harvard.edu/message", "i2b2");
        method = fac.createOMElement("getPulmonaryData", omNs);

        StringReader strReader = new StringReader(requestPdo);
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(strReader);

        StAXOMBuilder builder = new StAXOMBuilder(reader);
        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.eclipse.plugins.admin.utilities.ws.CRCServiceDriver.java

/**
 * Function to convert PFT requestPdo to OMElement
 * //from   www .  jav  a2s .c  om
 * @param requestPdo   String requestPdo to send to PFT web service
 * @return An OMElement containing the PFT web service requestPdo
 */
public static OMElement getStatusPayLoad(String request) throws Exception {
    OMElement method = null;
    try {
        OMFactory fac = OMAbstractFactory.getOMFactory();

        StringReader strReader = new StringReader(request);
        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLStreamReader reader = xif.createXMLStreamReader(strReader);

        StAXOMBuilder builder = new StAXOMBuilder(reader);
        method = 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.eclipse.plugins.admin.utilities.ws.OntServiceDriver.java

/**
 * Function to convert Ont requestVdo to OMElement
 * //from ww  w . j a va2  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) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        log.error(e.getMessage());
        throw new Exception(e);
    }
    return lineItem;
}

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

public static String sendQueryRequestSOAP(String XMLstr) {
    try {//from   w  w  w  . j  a va  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

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

        log.debug(XMLstr);

        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(XMLstr);
        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.analysis.queryClient.QueryClient.java

public static String sendQueryRequestSOAP(String requestString) {

    try {/*from   w  w w .j  ava 2 s  . co 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.analysis.queryClient.QueryClient.java

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

    try {/*from  w  w w  .j a v  a2 s.co 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

/**
 * Function to convert pm request to OMElement
 * //from  w ww  .  j a v  a2 s . c  o m
 * @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.patientSet.serviceClient.QueryListNamesClient.java

public static String sendQueryRequestSOAP(String requestString) {

    try {/*from  w w w . ja 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.patientSet.serviceClient.QueryListNamesClient.java

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

    try {/*  w w  w . jav a2  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.previousquery.serviceClient.QueryListNamesClient.java

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

    try {/*from  w ww .  j av a 2  s .  c om*/
        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;
    }
}