org.apache.axiom.om.util.AXIOMUtil类的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(37)

本文整理了Java中org.apache.axiom.om.util.AXIOMUtil类的一些代码示例,展示了AXIOMUtil类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AXIOMUtil类的具体详情如下:
包路径:org.apache.axiom.om.util.AXIOMUtil
类名称:AXIOMUtil

AXIOMUtil介绍

暂无

代码示例

代码示例来源:origin: org.apache.synapse/synapse-core

/**
   * 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;
    }
  }
}

代码示例来源:origin: org.apache.axis2/axis2-adb

public static OMElement convertToAnyType(String s) {
  try {
    return AXIOMUtil.stringToOM(s);
  } catch (XMLStreamException e) {
    return null;
  }
}

代码示例来源:origin: apache/axis2-java

public static OMElement convertToAnyType(String s) {
  try {
    return AXIOMUtil.stringToOM(s);
  } catch (XMLStreamException e) {
    return null;
  }
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
 * 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);
}

代码示例来源:origin: org.apache.synapse/synapse-core

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;
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

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);
    }
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

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;
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

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);
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

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);
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.lcm

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;
}

代码示例来源:origin: org.wso2.carbon.mediation/org.wso2.carbon.rest.api.ui

public static ResourceData convertStringToResourceData(String xml) throws XMLStreamException {
  ResourceData resourceData = new ResourceData();
  OMElement resourceOM = AXIOMUtil.stringToOM(xml);
  convertResource(resourceOM, resourceData);
  return resourceData;
}

代码示例来源:origin: tst-labs/esocial

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;
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

@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);
  }
}

代码示例来源:origin: org.wso2.esb.integration/integration-base

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;
}

代码示例来源:origin: wso2-attic/esb-connectors

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;
  
}

代码示例来源:origin: org.wso2.ei/org.wso2.ei.businessprocess.integration.common.utils

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);
}

代码示例来源:origin: org.wso2.ei/org.wso2.ei.businessprocess.integration.common.utils

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;
}

代码示例来源:origin: wso2/wso2-synapse

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();
}

代码示例来源:origin: wso2/wso2-synapse

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());
}

代码示例来源:origin: wmixvideo/nfe

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;
}

相关文章

最新文章

更多

AXIOMUtil类方法