Package org.apache.axis2.soap

Examples of org.apache.axis2.soap.SOAPEnvelope


          opStr = "substract";
        }else if ("*".equals(operation)){
          opStr = "multiply";
        }
        System.out.println("Invoking...");
        SOAPEnvelope result = call.invokeBlocking(opStr,getRequestEnvelope(opStr,param1,param2,
            serviceGroupContextId));
        printResult(result);
       
        if (serviceGroupContextId==null)
          serviceGroupContextId = getServiceGroupContextId(result);
       
       
      }else if ("c".equalsIgnoreCase(option)){
        if (serviceGroupContextId==null)
        {
          System.out.println ("Error: First operation must be a New one. Please select 'n'");
          continue;
        }
       
        System.out.print ("Enter parameter...");
        String paramStr = reader.readLine();
        int param = Integer.parseInt(paramStr);
        String opStr = null;
        if ("+".equals(operation)){
          opStr = "addPrevious";
        }else if ("-".equals(operation)){
          opStr = "substractPrevious";
        }else if ("*".equals(operation)){
          opStr = "multiplyPrevious";
        }
       
        System.out.println("Invoking...");
        SOAPEnvelope result = call.invokeBlocking(opStr,getPreviousRequestEnvelope(opStr,param,
            serviceGroupContextId));
        printResult(result);
       
      }
     
View Full Code Here


  }

  public static SOAPEnvelope getRequestEnvelope(String operationName,
      int param1, int param2, String groupContextId) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    SOAPEnvelope envelope = fac.getDefaultEnvelope();
    OMNamespace namespace = fac.createOMNamespace(
        "http://axis2/test/namespace1", "ns1");

    OMElement params = fac.createOMElement(operationName, namespace);
    OMElement param1OM = fac.createOMElement("param1", namespace);
    OMElement param2OM = fac.createOMElement("param2", namespace);
    param1OM.setText(Integer.toString(param1));
    param2OM.setText(Integer.toString(param2));
    params.addChild(param1OM);
    params.addChild(param2OM);
    envelope.getBody().setFirstChild(params);

    if (groupContextId != null) {
      OMNamespace axis2Namespace = fac.createOMNamespace(
          Constants.AXIS2_NAMESPACE_URI,
          Constants.AXIS2_NAMESPACE_PREFIX);
      SOAPHeaderBlock soapHeaderBlock = envelope.getHeader()
          .addHeaderBlock(Constants.SERVICE_GROUP_ID, axis2Namespace);
      soapHeaderBlock.setText(groupContextId);
    }

    return envelope;
View Full Code Here

  }
 
  public static SOAPEnvelope getPreviousRequestEnvelope(String operationName,
      int param, String groupContextId) {
    SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
    SOAPEnvelope envelope = fac.getDefaultEnvelope();
    OMNamespace namespace = fac.createOMNamespace(
        "http://axis2/test/namespace1", "ns1");

    OMElement params = fac.createOMElement(operationName, namespace);
    OMElement paramOM = fac.createOMElement("param", namespace);
    paramOM.setText(Integer.toString(param));
    params.addChild(paramOM);
    envelope.getBody().setFirstChild(params);

    if (groupContextId != null) {
      OMNamespace axis2Namespace = fac.createOMNamespace(
          Constants.AXIS2_NAMESPACE_URI,
          Constants.AXIS2_NAMESPACE_PREFIX);
      SOAPHeaderBlock soapHeaderBlock = envelope.getHeader()
          .addHeaderBlock(Constants.SERVICE_GROUP_ID, axis2Namespace);
      soapHeaderBlock.setText(groupContextId);
    }   
   
    return envelope;
View Full Code Here

    private void extractDetails(AsyncResult result) {
        Iterator iterator, iterator2;
        OMNode node;
        SOAPBody body;
        OMElement operation, elem;
        SOAPEnvelope resEnvelope;
        resEnvelope = result.getResponseEnvelope();
        body = resEnvelope.getBody();
        operation = body.getFirstElement();
        if (body.hasFault()) {
            snippet =
                    snippet +
                    "A Fault message received, Check your Licence key. Else you have reached the" +
View Full Code Here

        String str_ST_index = Integer.toString(asyncClient.getStartIndex());

        defNs = OMAbstractFactory.getSOAP11Factory().createOMNamespace("", "");
        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = omFactory.getDefaultEnvelope();
        envelope.declareNamespace("http://schemas.xmlsoap.org/soap/envelope/",
                "soapenv");
        envelope.declareNamespace("http://schemas.xmlsoap.org/soap/encoding/",
                "SOAP-ENC");
        envelope.declareNamespace("http://www.w3.org/2001/XMLSchema-instance",
                "xsi");
        envelope.declareNamespace("http://www.w3.org/2001/XMLSchema",
                "xsd");

        operation =
                omFactory.createOMElement("doGoogleSearch",
                        "urn:GoogleSearch",
                        "ns1");
        envelope.getBody().addChild(operation);
        operation.addAttribute("soapenv:encordingStyle",
                "http://schemas.xmlsoap.org/soap/encoding/", null);

        operation.addChild(
                getOMElement(omFactory,
View Full Code Here

                opClient.addMessageContext(requetMessageContext);
                opClient.setOptions(options);

                opClient.execute(true);

                SOAPEnvelope result = opClient.getMessageContext(
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();

                printResult(result);

                if (serviceGroupContextId == null)
                    serviceGroupContextId = getServiceGroupContextId(result);


            } else if ("c".equalsIgnoreCase(option)) {
                if (serviceGroupContextId == null) {
                    System.out.println("Error: First operation must be a New one. Please select 'n'");
                    continue;
                }

                System.out.print("Enter parameter...");
                String paramStr = reader.readLine();
                int param = Integer.parseInt(paramStr);
                String opStr = null;
                if ("+".equals(operation)) {
                    opStr = "addPrevious";
                } else if ("-".equals(operation)) {
                    opStr = "substractPrevious";
                } else if ("*".equals(operation)) {
                    opStr = "multiplyPrevious";
                }

                System.out.println("Invoking...");


                ServiceClient serviceClient = new ServiceClient();
                serviceClient.setOptions(options);
                MessageContext requetMessageContext = new MessageContext();
                requetMessageContext.setEnvelope(getPreviousRequestEnvelope(opStr, param,
                        serviceGroupContextId));

                OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
                opClient.addMessageContext(requetMessageContext);
                opClient.setOptions(options);

                opClient.execute(true);

                SOAPEnvelope result = opClient.getMessageContext(
                        WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();

                printResult(result);

            }
View Full Code Here

    }

    public static SOAPEnvelope getRequestEnvelope(String operationName,
                                                  int param1, int param2, String groupContextId) {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();
        OMNamespace namespace = fac.createOMNamespace(
                "http://axis2/test/namespace1", "ns1");

        OMElement params = fac.createOMElement(operationName, namespace);
        OMElement param1OM = fac.createOMElement("param1", namespace);
        OMElement param2OM = fac.createOMElement("param2", namespace);
        param1OM.setText(Integer.toString(param1));
        param2OM.setText(Integer.toString(param2));
        params.addChild(param1OM);
        params.addChild(param2OM);
        envelope.getBody().setFirstChild(params);

        if (groupContextId != null) {
            OMNamespace axis2Namespace = fac.createOMNamespace(
                    Constants.AXIS2_NAMESPACE_URI,
                    Constants.AXIS2_NAMESPACE_PREFIX);
            SOAPHeaderBlock soapHeaderBlock = envelope.getHeader()
                    .addHeaderBlock(Constants.SERVICE_GROUP_ID, axis2Namespace);
            soapHeaderBlock.setText(groupContextId);
        }

        return envelope;
View Full Code Here

    }

    public static SOAPEnvelope getPreviousRequestEnvelope(String operationName,
                                                          int param, String groupContextId) {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();
        OMNamespace namespace = fac.createOMNamespace(
                "http://axis2/test/namespace1", "ns1");

        OMElement params = fac.createOMElement(operationName, namespace);
        OMElement paramOM = fac.createOMElement("param", namespace);
        paramOM.setText(Integer.toString(param));
        params.addChild(paramOM);
        envelope.getBody().setFirstChild(params);

        if (groupContextId != null) {
            OMNamespace axis2Namespace = fac.createOMNamespace(
                    Constants.AXIS2_NAMESPACE_URI,
                    Constants.AXIS2_NAMESPACE_PREFIX);
            SOAPHeaderBlock soapHeaderBlock = envelope.getHeader()
                    .addHeaderBlock(Constants.SERVICE_GROUP_ID, axis2Namespace);
            soapHeaderBlock.setText(groupContextId);
        }

        return envelope;
View Full Code Here

    public void testGetText() {
        try {
            StAXSOAPModelBuilder soapBuilder = getOMBuilder(
                    "soap/OMElementTest.xml");
            SOAPEnvelope soapEnvelope = (SOAPEnvelope) soapBuilder.getDocumentElement();
            OMElement wsaTo = soapEnvelope.getHeader().getFirstChildWithName(
                    new QName(WSA_URI, WSA_TO));

            String expectedString = "http://localhost:8081/axis/services/BankPort";
            assertEquals("getText is not returning the correct value",
                    wsaTo.getText().trim(),
View Full Code Here

                    InputStream stream = Thread.currentThread().getContextClassLoader()
                            .getResourceAsStream(filePath);

                    XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(stream);
                    OMXMLParserWrapper builder = new StAXSOAPModelBuilder(parser, null);
                    SOAPEnvelope refEnv = (SOAPEnvelope) builder.getDocumentElement();
                    //OMElement refNode = (OMElement) resEnv.getBody().getFirstElement();
                    XMLComparatorInterop comparator = new XMLComparatorInterop();
                    ok = comparator.compare(retEnv, refEnv);
                } else
                    return false;
View Full Code Here

TOP

Related Classes of org.apache.axis2.soap.SOAPEnvelope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.