本文整理汇总了Java中org.apache.axiom.om.OMXMLParserWrapper类的典型用法代码示例。如果您正苦于以下问题:Java OMXMLParserWrapper类的具体用法?Java OMXMLParserWrapper怎么用?Java OMXMLParserWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OMXMLParserWrapper类属于org.apache.axiom.om包,在下文中一共展示了OMXMLParserWrapper类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getContent
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
public ArrayList<OMElement> getContent() {
if (Utils.isNullOrEmpty(xmlContent) && !Utils.isNullOrEmpty(CONTENT)) {
// Data has not been deserialized yet
// Create parser to get XML from database string
final OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(new StringReader(CONTENT));
// Parse document and get root element
final OMElement contentElement = builder.getDocumentElement();
// Now the children of this element are the actual content of the Receipt
xmlContent = new ArrayList<>();
final Iterator<?> it = contentElement.getChildElements();
while (it.hasNext())
xmlContent.add((OMElement) it.next());
}
return xmlContent;
}
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:17,代码来源:Receipt.java
示例2: readOMElementFromFile
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
private static OMElement readOMElementFromFile(String fileLocation) {
OMElement element = null;
File serviceDescFile = new File(fileLocation);
if (serviceDescFile.exists()) {
InputStream fis = null;
try {
fis = new FileInputStream(serviceDescFile);
OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createOMBuilder(fis);
element = omBuilder.getDocumentElement();
element.build();
} catch (FileNotFoundException ex ) {
log.error("Error while processing the services file : " + fileLocation, ex);
}
// finally {
// if(fis != null) {
// IOUtils.closeQuietly(fis);
// }
// }
}
return element;
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:22,代码来源:ServiceConfigurationUtil.java
示例3: processNullReturns
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
/**
* This method is use to to crete the reposne when , the return value is null
*
* @param service Current AxisService
* @param envelope response envelope
* @param partName
*/
private static void processNullReturns(AxisService service,
SOAPEnvelope envelope, String partName) {
QName resName;
if (service.isElementFormDefault()) {
resName = new QName(service.getSchemaTargetNamespace(),
partName,
service.getSchemaTargetNamespacePrefix());
} else {
resName = new QName(partName);
}
XMLStreamReader xr = new NullXMLStreamReader(resName);
StreamWrapper parser = new StreamWrapper(xr);
OMXMLParserWrapper stAXOMBuilder =
OMXMLBuilderFactory.createStAXOMBuilder(
OMAbstractFactory.getSOAP11Factory(), parser);
envelope.getBody().addChild(stAXOMBuilder.getDocumentElement());
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:RPCUtil.java
示例4: getEnvelope
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
private SOAPEnvelope getEnvelope(MessageContext messageContext) throws AxisFault {
ByteArrayOutputStream out = new ByteArrayOutputStream();
TransportUtils.writeMessage(messageContext, out);
ByteArrayInputStream bs = new ByteArrayInputStream(out.toByteArray());
InputStreamReader streamReader = new InputStreamReader(bs);
OMXMLParserWrapper builder;
try {
builder = BuilderUtil.getBuilder(streamReader);
} catch (XMLStreamException e) {
throw AxisFault.makeFault(e);
}
return (SOAPEnvelope) builder.getDocumentElement();
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:LocalResponder.java
示例5: toOM
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
/**
* Convert DOM Element into a fully built OMElement
* @param element
* @param buildAll if true, full OM tree is immediately built. if false, caller is responsible
* for building the tree and closing the parser.
* @return
* @throws Exception
*/
public static OMElement toOM(Element element, boolean buildAll) throws Exception {
Source source = new DOMSource(element);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Result result = new StreamResult(baos);
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
ByteArrayInputStream is = new ByteArrayInputStream(baos.toByteArray());
OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(is);
builder.setCache(true);
OMElement omElement = builder.getDocumentElement();
if (buildAll) {
omElement.build();
builder.close();
}
return omElement;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:31,代码来源:XMLUtils.java
示例6: processObjectAsDocLitBare
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
public static void processObjectAsDocLitBare(SOAPFactory fac,
Object resObject,
OMElement bodyContent,
OMNamespace ns,
SOAPEnvelope envelope,
boolean qualified,
TypeTable typeTable,
String partName) {
if (resObject instanceof OMElement) {
OMElement result = (OMElement) resObject;
bodyContent = fac.createOMElement(
partName, ns);
bodyContent.addChild(result);
} else if (SimpleTypeMapper.isSimpleType(resObject)) {
bodyContent = fac.createOMElement(
partName, ns);
bodyContent.addChild(fac.createOMText(bodyContent,
SimpleTypeMapper.getStringValue(resObject)));
} else {
QName returnWrapper = new QName(ns.getNamespaceURI(), partName, ns.getPrefix());
XMLStreamReader xr = BeanUtil.getPullParser(resObject,
returnWrapper, typeTable, qualified, true);
OMXMLParserWrapper stAXOMBuilder =
OMXMLBuilderFactory.createStAXOMBuilder(
OMAbstractFactory.getOMFactory(), new StreamWrapper(xr));
OMElement documentElement = stAXOMBuilder.getDocumentElement();
if (documentElement != null) {
envelope.getBody().addChild(documentElement);
}
}
if (bodyContent != null) {
envelope.getBody().addChild(bodyContent);
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:RPCUtil.java
示例7: getSOAPFactory
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
/**
* Get an axiom SOAPFactory for the specified element
*
* @param e OMElement
* @return SOAPFactory
*/
public static SOAPFactory getSOAPFactory(OMElement e) {
// Getting a factory from a SOAPEnvelope is not straight-forward.
// Please change this code if an easier mechanism is discovered.
OMXMLParserWrapper builder = e.getBuilder();
if (builder instanceof StAXBuilder) {
StAXBuilder staxBuilder = (StAXBuilder)builder;
OMDocument document = staxBuilder.getDocument();
if (document != null) {
OMFactory factory = document.getOMFactory();
if (factory instanceof SOAPFactory) {
return (SOAPFactory)factory;
}
}
}
// Flow to here indicates that the envelope does not have
// an accessible factory. Create a new factory based on the
// protocol.
while (e != null && !(e instanceof SOAPEnvelope)) {
e = (OMElement)e.getParent();
}
if (e instanceof SOAPEnvelope) {
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.
equals(e.getNamespace().getNamespaceURI())) {
return OMAbstractFactory.getSOAP11Factory();
} else {
return OMAbstractFactory.getSOAP12Factory();
}
}
return null;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:39,代码来源:MessageUtils.java
示例8: close
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
public void close() {
OMElement om = getContentAsOMElement();
if (om !=null) {
OMXMLParserWrapper builder = om.getBuilder();
if (builder instanceof StAXBuilder) {
StAXBuilder staxBuilder = (StAXBuilder) builder;
staxBuilder.releaseParserOnClose(true);
if (!staxBuilder.isClosed()) {
staxBuilder.close();
}
}
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:XMLPartBase.java
示例9: getDocument
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
/**
* Parse input stream to get document.
*
* @param in
* input stream
* @return the document
*/
public static OMDocument getDocument(final InputStream in) {
// create the builder
OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(new StAXParserConfiguration() {
@Override
public XMLInputFactory configure(XMLInputFactory factory, StAXDialect dialect) {
return factory;
}
}, in);
// get the root element
OMDocument doc = builder.getDocument();
return doc;
}
开发者ID:niuxuetao,项目名称:paxml,代码行数:26,代码来源:AxiomUtils.java
示例10: createSOAPFault
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
@Override
public SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder) {
return new CustomSOAP12FaultImpl(parent, builder, this);
}
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:5,代码来源:CustomSOAP12Factory.java
示例11: CustomSOAP12FaultImpl
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
public CustomSOAP12FaultImpl(SOAPBody parent, OMXMLParserWrapper builder, SOAPFactory factory) {
super(parent, builder, factory);
}
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:4,代码来源:CustomSOAP12Factory.java
示例12: processResponse
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
public static void processResponse(SOAPFactory fac, Object resObject,
OMElement bodyContent,
OMNamespace ns,
SOAPEnvelope envelope,
Method method,
boolean qualified,
TypeTable typeTable) {
if (resObject != null) {
//simple type
if (resObject instanceof OMElement) {
OMElement result = (OMElement) resObject;
bodyContent = fac.createOMElement(
method.getName() + "Response", ns);
OMElement resWrapper;
if (qualified) {
resWrapper = fac.createOMElement(RETURN_WRAPPER, ns.getNamespaceURI(),
ns.getPrefix());
} else {
resWrapper = fac.createOMElement(RETURN_WRAPPER, null);
}
resWrapper.addChild(result);
bodyContent.addChild(resWrapper);
} else if (SimpleTypeMapper.isSimpleType(resObject)) {
bodyContent = fac.createOMElement(
method.getName() + "Response", ns);
OMElement child;
if (qualified) {
child = fac.createOMElement(RETURN_WRAPPER, ns);
} else {
child = fac.createOMElement(RETURN_WRAPPER, null);
}
child.addChild(fac.createOMText(child, SimpleTypeMapper.getStringValue(resObject)));
bodyContent.addChild(child);
} else {
bodyContent = fac.createOMElement(
method.getName() + "Response", ns);
// Java Beans
QName returnWrapper;
if (qualified) {
returnWrapper = new QName(ns.getNamespaceURI(), RETURN_WRAPPER, ns.getPrefix());
} else {
returnWrapper = new QName(RETURN_WRAPPER);
}
XMLStreamReader xr = BeanUtil.getPullParser(resObject,
returnWrapper, typeTable, qualified, false);
OMXMLParserWrapper stAXOMBuilder =
OMXMLBuilderFactory.createStAXOMBuilder(
OMAbstractFactory.getOMFactory(), new StreamWrapper(xr));
OMElement documentElement = stAXOMBuilder.getDocumentElement();
if (documentElement != null) {
bodyContent.addChild(documentElement);
}
}
}
if (bodyContent != null) {
envelope.getBody().addChild(bodyContent);
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:59,代码来源:RPCUtil.java
示例13: testAddToSOAPHeader
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
public void testAddToSOAPHeader() throws Exception {
EndpointReference replyTo = new EndpointReference(
"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
EndpointReference epr = new EndpointReference("http://www.to.org/service/");
for (int i = 0; i < 5; i++) {
epr.addReferenceParameter(
new QName(Submission.WSA_NAMESPACE, "Reference" + i,
AddressingConstants.WSA_DEFAULT_PREFIX),
"Value " + i * 100);
}
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
ConfigurationContext configCtx =
ConfigurationContextFactory.createEmptyConfigurationContext();
MessageContext msgCtxt = configCtx.createMessageContext();
msgCtxt.setProperty(WS_ADDRESSING_VERSION, Submission.WSA_NAMESPACE);
msgCtxt.setTo(epr);
msgCtxt.setReplyTo(replyTo);
msgCtxt.setEnvelope(defaultEnvelope);
msgCtxt.setWSAAction("http://www.actions.org/action");
msgCtxt.setMessageID("urn:test:123");
OMAttribute extAttr = OMAbstractFactory.getOMFactory().createOMAttribute("AttrExt",
OMAbstractFactory
.getOMFactory().createOMNamespace(
"http://ws.apache.org/namespaces/axis2",
"axis2"),
"123456789");
ArrayList al = new ArrayList();
al.add(extAttr);
msgCtxt.setProperty(AddressingConstants.ACTION_ATTRIBUTES, al);
msgCtxt.setProperty(AddressingConstants.MESSAGEID_ATTRIBUTES, al);
outHandler.invoke(msgCtxt);
OMXMLParserWrapper omBuilder = TestUtil.getOMBuilder("eprTest.xml");
XMLUnit.setIgnoreWhitespace(true);
assertXMLEqual(omBuilder.getDocumentElement().toString(), defaultEnvelope.toString());
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:48,代码来源:AddressingOutHandlerTest.java
示例14: getOMBuilder
import org.apache.axiom.om.OMXMLParserWrapper; //导入依赖的package包/类
public static OMXMLParserWrapper getOMBuilder(String fileName) throws Exception {
if ("".equals(fileName) || fileName == null) {
fileName = IN_FILE_NAME;
}
return OMXMLBuilderFactory.createSOAPModelBuilder(new FileInputStream(getTestResourceFile(fileName)), null);
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:7,代码来源:TestUtil.java
注:本文中的org.apache.axiom.om.OMXMLParserWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论