List of usage examples for javax.xml.stream FactoryConfigurationError getMessage
public String getMessage()
From source file:edu.harvard.i2b2.pm.ws.PMServiceDriver.java
/** * Function to convert pm requestVdo to OMElement * /*w ww . j a v a2s. c om*/ * @param requestPm String request to send to pm web service * @return An OMElement containing the pm web service requestVdo */ public static OMElement getPmPayLoad(String requestPm) throws Exception { OMElement lineItem = null; try { StringReader strReader = new StringReader(requestPm); 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.eclipse.plugins.pft.ws.PFTServiceDriver2.java
/** * Function to convert PFT requestPdo to OMElement * // w w w . java2 s . c o m * @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 ww w .j a v a2 s .c o m * @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.common.util.axis2.ServiceClient.java
public static OMElement getPayLoad(String requestPm) throws Exception { OMElement lineItem = null;//w ww .j a v a2 s . c o m try { StringReader strReader = new StringReader(requestPm); 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.eclipse.plugins.admin.utilities.ws.OntServiceDriver.java
/** * Function to convert Ont requestVdo to OMElement * //from w ww . j a v a 2 s . c o 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.eclipse.plugins.fr.ws.CrcServiceDriver.java
/** * Function to convert Ont requestVdo to OMElement * // w ww .j a v a2 s. c o m * @param requestVdo String requestVdo to send to Ont web service * @return An OMElement containing the Ont web service requestVdo */ public static OMElement getCrcPayLoad(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.common.util.axis2.ServiceClient.java
public static String sendSOAP(String soapEPR, String requestString, String action, String operation) throws Exception { org.apache.axis2.client.ServiceClient serviceClient = null; serviceClient = new org.apache.axis2.client.ServiceClient(); OperationClient operationClient = serviceClient .createClient(org.apache.axis2.client.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); opts.setTo(new EndpointReference(soapEPR)); opts.setAction(action);/*w w w .j a v a 2 s . c o m*/ 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); operationClient.addMessageContext(outMsgCtx); operationClient.execute(true); MessageContext inMsgtCtx = operationClient.getMessageContext("In"); SOAPEnvelope responseEnv = inMsgtCtx.getEnvelope(); OMElement soapResponse = responseEnv.getBody().getFirstElement(); OMElement soapResult = soapResponse.getFirstElement(); String i2b2Response = soapResult.getText(); log.debug(i2b2Response); return i2b2Response; }
From source file:edu.harvard.i2b2.eclipse.plugins.fr.ws.FrServiceDriver.java
/** * Function to convert Ont requestVdo to OMElement * //from w w w. j a va2 s. c o m * @param requestVdo String requestVdo to send to Ont web service * @return An OMElement containing the Ont web service requestVdo */ public static OMElement getFrPayLoad(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.query.serviceClient.QueryListNamesClient.java
public static String sendQueryRequestSOAP(String XMLstr) { try {//from www .j a va 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(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.eclipse.plugins.fr.ws.CrcServiceDriver.java
public static String sendSOAP(String requestString, String action, String operation, String type) throws Exception { ServiceClient sender = FrServiceClient.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 .jav a2s. com*/ 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("<", "<", request); if (type.equals("CRC")) { System.setProperty("CRC_REQUEST", "URL: " + soapEPR + "\n" + formattedRequest); } else { System.setProperty("FIND_REQUEST", "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("CRC")) { String formattedResponse = XMLUtil.StrFindAndReplace("<", "<", responseEnv.toString()); String indentedResponse = XMLUtil.convertDOMToString(XMLUtil.convertStringToDOM(formattedResponse)); System.setProperty("CRC_RESPONSE", "URL: " + soapEPR + "\n" + indentedResponse); } else { String formattedResponse = XMLUtil.StrFindAndReplace("<", "<", responseEnv.toString()); String indentedResponse = XMLUtil.convertDOMToString(XMLUtil.convertStringToDOM(formattedResponse)); System.setProperty("FIND_RESPONSE", "URL: " + soapEPR + "\n" + indentedResponse); } } OMElement soapResult = soapResponse.getFirstElement(); String i2b2Response = soapResult.getText(); log.debug(i2b2Response); MessageUtil.getInstance().setRequest("URL: " + soapEPR + "\n" + requestString); MessageUtil.getInstance().setResponse("URL: " + soapEPR + "\n" + i2b2Response); return i2b2Response; }