当前位置: 首页>>代码示例>>Java>>正文


Java SOAPFactory.createOMElement方法代码示例

本文整理汇总了Java中org.apache.axiom.soap.SOAPFactory.createOMElement方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPFactory.createOMElement方法的具体用法?Java SOAPFactory.createOMElement怎么用?Java SOAPFactory.createOMElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axiom.soap.SOAPFactory的用法示例。


在下文中一共展示了SOAPFactory.createOMElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createGetQuotesRequestBody

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createGetQuotesRequestBody(String symbol, int iterations) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement top = fac.createOMElement("getQuotes", omNs);

    for (int i = 0; i < iterations; i++) {
        OMElement method = fac.createOMElement("getQuote", omNs);
        OMElement value1 = fac.createOMElement("request", omNs);
        OMElement value2 = fac.createOMElement("symbol", omNs);
        value2.addChild(fac.createOMText(value1, symbol));
        value1.addChild(value2);
        method.addChild(value1);
        top.addChild(method);
    }

    return top;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:18,代码来源:IterateClient.java

示例2: buildSoapEnvelope

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
    SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();

    SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();

    SOAPHeader header = soapFactory.createSOAPHeader();
    envelope.addChild(header);

    OMNamespace synNamespace = soapFactory.createOMNamespace(
        "http://ws.apache.org/ns/synapse", "syn");
    OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
    clientIDElement.setText(clientID);
    header.addChild(clientIDElement);

    SOAPBody body = soapFactory.createSOAPBody();
    envelope.addChild(body);

    OMElement valueElement = soapFactory.createOMElement("Value", null);
    valueElement.setText(value);
    body.addChild(valueElement);

    return envelope;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:24,代码来源:LoadBalanceSessionFullClient.java

示例3: buildSoapEnvelope

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private SOAPEnvelope buildSoapEnvelope(String clientID, String value) {
    SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();

    SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();

    SOAPHeader header = soapFactory.createSOAPHeader();
    envelope.addChild(header);

    OMNamespace synNamespace = soapFactory.
            createOMNamespace("http://ws.apache.org/ns/synapse", "syn");
    OMElement clientIDElement = soapFactory.createOMElement("ClientID", synNamespace);
    clientIDElement.setText(clientID);
    header.addChild(clientIDElement);

    SOAPBody body = soapFactory.createSOAPBody();
    envelope.addChild(body);

    OMElement valueElement = soapFactory.createOMElement("Value", null);
    valueElement.setText(value);
    body.addChild(valueElement);

    return envelope;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:24,代码来源:LoadbalanceFailoverClient.java

示例4: createElementMessageContextElement

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private MessageContext createElementMessageContextElement(String textPayload) throws AxisFault {

        try {
            MessageContext messageContext = new MessageContext();
            SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
            SOAPEnvelope envelope = factory.getDefaultEnvelope();
            OMElement textWrapper = factory.createOMElement(BaseConstants.DEFAULT_TEXT_WRAPPER);
            OMElement payload = AXIOMUtil.stringToOM(textPayload);
            textWrapper.addChild(payload);
            envelope.getBody().addChild(textWrapper);
            messageContext.setEnvelope(envelope);
            return messageContext;
        } catch (XMLStreamException e) {
            // This is highly unlikely to happen
            return null;
        }
    }
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:18,代码来源:PlainTextFormatterTest.java

示例5: testFaultReason

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
public void testFaultReason() throws Exception {
    SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
    OMElement response = soapFactory.createOMElement(new QName("testNs",
            "test"));
    String faultReason = "myFaultReason";
    AxisFault fault = new AxisFault(new QName("myQname"), faultReason,
            "myFaultNode", "myFaultRole", response);

    ConfigurationContext cc = ConfigurationContextFactory
            .createDefaultConfigurationContext();
    MessageContext ctx = cc.createMessageContext();
    SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
    ctx.setEnvelope(fac.getDefaultEnvelope());
    MessageContext faultCtx = MessageContextBuilder
            .createFaultMessageContext(ctx, fault);

    assertEquals(faultReason, Utils.getInboundFaultFromMessageContext(
            faultCtx).getReason());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:20,代码来源:FaultSerializationTest.java

示例6: getAbstractResponseMessageContext

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
public MessageContext getAbstractResponseMessageContext(MessageContext requestMessageContext) throws AxisFault {
    MessageContext outMessageCtx = MessageContextBuilder.createOutMessageContext(requestMessageContext);

    SOAPFactory factory = getSOAPFactory(requestMessageContext);
    AxisOperation operation = requestMessageContext.getOperationContext().getAxisOperation();
    AxisService service = requestMessageContext.getAxisService();

    OMElement bodyContent;
    AxisMessage outMessage = operation.getMessage(OperationsConstants.OUT);

    bodyContent = factory.createOMElement(outMessage.getName(),
            factory.createOMNamespace(namespace,
                    service.getSchemaTargetNamespacePrefix()));
    try {
        setPayload(bodyContent);
    } catch (XMLStreamException e) {
        String msg = "Error in adding the payload to the response message";
        log.error(msg);
        throw new AxisFault(msg, e);
    }

    SOAPEnvelope soapEnvelope = factory.getDefaultEnvelope();
    soapEnvelope.getBody().addChild(bodyContent);
    outMessageCtx.setEnvelope(soapEnvelope);
    return outMessageCtx;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:27,代码来源:AbstractOperation.java

示例7: createMultipleQuoteRequestBody

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createMultipleQuoteRequestBody(String symbol, int iterations) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);

    for (int i = 0; i < iterations; i++) {
        OMElement value1 = fac.createOMElement("request", omNs);
        OMElement value2 = fac.createOMElement("symbol", omNs);
        value2.addChild(fac.createOMText(value1, symbol));
        value1.addChild(value2);
        method.addChild(value1);
    }
    return method;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:IterateClient.java

示例8: createSimpleQuoteRequestBody

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createSimpleQuoteRequestBody(String symbol) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);
    OMElement value1 = fac.createOMElement("request", omNs);
    OMElement value2 = fac.createOMElement("symbol", omNs);
    value2.addChild(fac.createOMText(value1, symbol));
    value1.addChild(value2);
    method.addChild(value1);
    return method;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:12,代码来源:CloneClient.java

示例9: createEchoRequestBody

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
/**
 * Create the echo request body.
 * @return Echo request OMElement
 */
private OMElement createEchoRequestBody() {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://echo.services.core.carbon.wso2.org", "ns");
    OMElement method = fac.createOMElement("echoInt", omNs);
    OMElement value1 = fac.createOMElement("in", omNs);

    value1.addChild(fac.createOMText(value1, "565"));
    method.addChild(value1);
    return method;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:ESBJAVA1994SOAPFormatSwitchingTestcase.java

示例10: createMultipleSymbolPayLoad

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createMultipleSymbolPayLoad(int iterations) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);

    for (int i = 0; i < iterations; i++) {
        OMElement chkPrice = fac.createOMElement("CheckPriceRequest", omNs);
        OMElement code = fac.createOMElement("Code", omNs);
        chkPrice.addChild(code);
        code.setText("SYM" + i);
        method.addChild(chkPrice);
    }
    return method;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:NestedForEachTestCase.java

示例11: createQuoteRequestBody

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createQuoteRequestBody(String symbol) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);

    OMElement value1 = fac.createOMElement("request", omNs);
    OMElement value2 = fac.createOMElement("symbol", omNs);
    value2.addChild(fac.createOMText(value1, symbol));
    value1.addChild(value2);
    method.addChild(value1);

    return method;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:14,代码来源:EnrichIntegrationReplaceEnvelopeTestCase.java

示例12: createMultipleQuoteRequestBody

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createMultipleQuoteRequestBody(String symbol, int iterations) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);

    for (int i = 0; i < iterations; i++) {
        OMElement value1 = fac.createOMElement("request", omNs);
        OMElement value2 = fac.createOMElement("symbol", omNs);
        value2.addChild(fac.createOMText(value1, symbol + "-" + i));
        value1.addChild(value2);
        method.addChild(value1);
    }
    return method;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:IterateSequentialPropertyTestCase.java

示例13: createPayload

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createPayload() {
    // creation of payload for echoString
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://service.carbon.wso2.org", "ns");
    OMElement operation = fac.createOMElement("echoString", omNs);
    OMElement getName = fac.createOMElement("s", omNs);
    getName.addChild(fac.createOMText(getName, "name"));
    operation.addChild(getName);

    return operation;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:12,代码来源:PayloadFormatWithCTXExpressionsTestCase.java

示例14: createMultipleCustomQuoteRequestBody

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private OMElement createMultipleCustomQuoteRequestBody(String symbol, int iterations) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);

    for (int i = 0; i < iterations; i++) {
        OMElement chkPrice = fac.createOMElement("CheckPriceRequest", omNs);
        OMElement code = fac.createOMElement("Code", omNs);
        chkPrice.addChild(code);
        code.setText(symbol);
        method.addChild(chkPrice);
    }
    return method;
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:15,代码来源:IterateClient.java

示例15: sendError

import org.apache.axiom.soap.SOAPFactory; //导入方法依赖的package包/类
private void sendError(HttpServletResponse res, Object object, String serviceName) throws EventHandlerException {
    try {
        // setup the response
        res.setContentType("text/xml");
        String xmlResults= SoapSerializer.serialize(object);
        XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xmlResults));
        StAXOMBuilder resultsBuilder = new StAXOMBuilder(xmlReader);
        OMElement resultSer = resultsBuilder.getDocumentElement();

        // create the response soap
        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope resEnv = factory.createSOAPEnvelope();
        SOAPBody resBody = factory.createSOAPBody();
        OMElement errMsg = factory.createOMElement(new QName((serviceName != null ? serviceName : "") + "Response"));
        errMsg.addChild(resultSer.getFirstElement());
        resBody.addChild(errMsg);
        resEnv.addChild(resBody);

        // The declareDefaultNamespace method doesn't work see (https://issues.apache.org/jira/browse/AXIS2-3156)
        // so the following doesn't work:
        // resService.declareDefaultNamespace(ModelService.TNS);
        // instead, create the xmlns attribute directly:
        OMAttribute defaultNS = factory.createOMAttribute("xmlns", null, ModelService.TNS);
        errMsg.addAttribute(defaultNS);

        // log the response message
        if (Debug.verboseOn()) {
            try {
                Debug.logInfo("Response Message:\n" + resEnv + "\n", module);
            } catch (Throwable t) {
            }
        }

        resEnv.serialize(res.getOutputStream());
        res.getOutputStream().flush();
    } catch (Exception e) {
        throw new EventHandlerException(e.getMessage(), e);
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:40,代码来源:SOAPEventHandler.java


注:本文中的org.apache.axiom.soap.SOAPFactory.createOMElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。