/** * If the input string is valid xml, this method will convert it into an OMElement and * return back. Otherwise returns null. */ public static OMElement getOMFromXML(String text) { try { return AXIOMUtil.stringToOM(text); } catch (Exception ignore) { return null; } } }
public static OMElement convertToAnyType(String s) { try { return AXIOMUtil.stringToOM(s); } catch (XMLStreamException e) { return null; } }
public static OMElement convertToAnyType(String s) { try { return AXIOMUtil.stringToOM(s); } catch (XMLStreamException e) { return null; } }
/** * Create an OMElement from an XML fragment given as a string. * * @param xmlFragment the well-formed XML fragment * @return The OMElement created out of the string XML fragment. * @throws XMLStreamException */ public static OMElement stringToOM(String xmlFragment) throws XMLStreamException { return stringToOM(OMAbstractFactory.getOMFactory(), xmlFragment); }
public static OMElement stringToOM(String xml) { try { return AXIOMUtil.stringToOM(xml); // Just wrap to add logging for any errors } catch (XMLStreamException e) { handleException("Unable to convert a string to OM Node as the string " + "is malformed , String : " + xml, e); } return null; }
public static OMElement deriveOMElementContent(String endpointContent) throws RegistryException { if (StringUtils.isBlank(endpointContent)) { throw new IllegalArgumentException("Invalid arguments supplied for derive endpoint name from content."); } try { OMElement endpointElement = AXIOMUtil.stringToOM(endpointContent); return endpointElement; } catch (XMLStreamException e) { throw new RegistryException("Invalid endpoint content", e); } } }
public static OMElement getHistoryInfoElement(String text){ try { String template = "<info></info>"; OMElement infoElement = AXIOMUtil.stringToOM(template); infoElement.setText(text); return infoElement; } catch (XMLStreamException e) { log.error("Unable to build the lifecycle history info element"); } return null; }
private void updateSchemaRelativePaths(String targetEnvironment, String currentEnvironment, StringBuilder resourceContent, Map.Entry<String, String> newPathMappingsEntry) { try { OMElement contentElement = AXIOMUtil.stringToOM(resourceContent.toString()); updateRelativePath(targetEnvironment, currentEnvironment, contentElement, newPathMappingsEntry); resourceContent.replace(0, resourceContent.length(), contentElement.toString()); } catch (XMLStreamException e) { log.error(e); } }
private void updateSchemaRelativePaths(String targetEnvironment, String currentEnvironment, StringBuilder resourceContent, Map.Entry<String, String> newPathMappingsEntry) { try { OMElement contentElement = AXIOMUtil.stringToOM(resourceContent.toString()); updateRelativePath(targetEnvironment, currentEnvironment, contentElement, newPathMappingsEntry); resourceContent.replace(0, resourceContent.length(), contentElement.toString()); } catch (XMLStreamException e) { log.error(e); } }
public static OMElement buildOMElement(String payload) throws RegistryException { OMElement element; try { element = AXIOMUtil.stringToOM(payload); element.build(); } catch (Exception e) { String message = "Unable to parse the XML configuration. Please validate the XML configuration"; log.error(message,e); throw new RegistryException(message,e); } return element; }
public static ResourceData convertStringToResourceData(String xml) throws XMLStreamException { ResourceData resourceData = new ResourceData(); OMElement resourceOM = AXIOMUtil.stringToOM(xml); convertResource(resourceOM, resourceData); return resourceData; }
private ServicoEnviarLoteEventosStub.LoteEventos_type0 getMsgLoteEvento(String xmlSoap) throws XMLStreamException { ServicoEnviarLoteEventosStub.LoteEventos_type0 msgLoteEvento = new ServicoEnviarLoteEventosStub.LoteEventos_type0(); OMElement ome = AXIOMUtil.stringToOM(xmlSoap); msgLoteEvento.setExtraElement(ome); return msgLoteEvento; } }
@Override public OMElement getConfigXMLForTemplate(Environment environment) throws APITemplateException { try { return AXIOMUtil.stringToOM(getConfigStringForVersionedWebAppTemplate(environment)); } catch (XMLStreamException e) { String msg = "Error converting string to OMElement - String: " + getConfigStringForVersionedWebAppTemplate(environment); log.error(msg, e); throw new APITemplateException(msg, e); } }
public RestResponse<OMElement> processAttachmentForXmlResponse() throws IOException, XMLStreamException { final String responseString = readResponse(httpURLConnection); final RestResponse<OMElement> restResponse = new RestResponse<OMElement>(); restResponse.setHttpStatusCode(httpURLConnection.getResponseCode()); restResponse.setHeadersMap(httpURLConnection.getHeaderFields()); if (responseString != null) { restResponse.setBody(AXIOMUtil.stringToOM(responseString)); } return restResponse; }
public RestResponse<OMElement> processAttachmentForXmlResponse() throws IOException, XMLStreamException { final String responseString = readResponse(httpURLConnection); final RestResponse<OMElement> restResponse = new RestResponse<OMElement>(); restResponse.setHttpStatusCode(httpURLConnection.getResponseCode()); restResponse.setHeadersMap(httpURLConnection.getHeaderFields()); if (responseString != null) { restResponse.setBody(AXIOMUtil.stringToOM(responseString)); } return restResponse; }
public void sendRequestOneWay(String payloadStr, EndpointReference targetEPR) throws XMLStreamException, AxisFault { OMElement payload = AXIOMUtil.stringToOM(payloadStr); Options options = new Options(); options.setTo(targetEPR); ServiceClient sender = new ServiceClient(); sender.setOptions(options); log.info("Request: " + payload.toString()); sender.fireAndForget(payload); }
public static OMElement sendRequest(String payloadStr, EndpointReference targetEPR) throws XMLStreamException, AxisFault { OMElement payload = AXIOMUtil.stringToOM(payloadStr); Options options = new Options(); options.setTo(targetEPR); ServiceClient sender = new ServiceClient(); sender.setOptions(options); log.info("Request: " + payload.toString()); OMElement result = sender.sendReceive(payload); log.info("Response: " + result.toString()); return result; }
public static void main(String[] args) throws Exception{ String connectorStr = "<sfdc.getContact xmlns=\"http://ws.apache.org/ns/synapse\">\n" + "\t\t <parameter name=\"param1\" value=\"val1\"/>\n" + "\t\t <parameter name=\"param2\" value=\"val2\"/>\n" + "\t</sfdc.getContact>"; OMElement inConnectorElem = AXIOMUtil.stringToOM(connectorStr); String libName = "synapse.lang.eip"; InvokeMediator invokeMediator = MediatorFactoryFinder.getInstance().getDynamicInvokeMediator(inConnectorElem, libName); invokeMediator.getTargetTemplate(); }
public void testSerializeInboundEPWithParent() throws Exception { ep = factory.createInboundEndpoint(AXIOMUtil.stringToOM(sampleEP3), config); OMElement elm2 = serializer.serializeInboundEndpoint(AXIOMUtil.stringToOM(parentElm), ep); Assert.assertNotNull("Serialized endpoint with parent is null", elm2); Assert.assertEquals("Invalid EP name for serialized inbound endpoint", "HttpListenerEP3", ep.getName()); }
public CTeNotaConsultaRetorno consultaNota(final String chaveDeAcesso) throws Exception { final OMElement omElementConsulta = AXIOMUtil.stringToOM(this.gerarDadosConsulta(chaveDeAcesso).toString()); WSNotaConsulta.LOGGER.debug(omElementConsulta.toString()); final OMElement omElementRetorno = this.efetuaConsulta(omElementConsulta, chaveDeAcesso); WSNotaConsulta.LOGGER.debug(omElementRetorno.toString()); final CTeNotaConsultaRetorno retorno = new DFPersister().read(CTeNotaConsultaRetorno.class, omElementRetorno.toString()); WSNotaConsulta.LOGGER.info(retorno.toString()); return retorno; }