private OMElement createRequestPayload() {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement top = fac.createOMElement("getQuotes", omNs);

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

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

    return top;
  }
Exemplo n.º 2
0
  private OMElement createMultipleQuoteRequestBody(String symbol, int iterations) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method1 = fac.createOMElement("getQuotes", omNs);
    OMElement method2 = 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);
      method2.addChild(value1);
      method1.addChild(method2);
    }
    return method1;
  }