Package org.apache.ws.commons.soap

Examples of org.apache.ws.commons.soap.SOAPEnvelope


    }

    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


    //done
    public void testEnvelopeMissing() throws Exception {
        try {
            SOAPEnvelope soapEnvelope =
                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
                            getTestResourceFile(TestConstants.BAD_ENVELOPE_MISSING))
                    .getDocumentElement();
            OMTestUtils.walkThrough(soapEnvelope);
            fail("this must failed gracefully with OMException or AxisFault");
View Full Code Here

    }

    //done
    public void testHeaderBodyWrongOrder() throws Exception {
        try {
            SOAPEnvelope soapEnvelope =
                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
                            getTestResourceFile(TestConstants.BAD_HEADER_BODY_WRONG_ORDER))
                    .getDocumentElement();
            OMTestUtils.walkThrough(soapEnvelope);
            fail("this must failed gracefully with OMException or AxisFault");
View Full Code Here

    //    }

    //done
    public void testTwoBodymessage() throws Exception {
        try {
            SOAPEnvelope soapEnvelope =
                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
                            getTestResourceFile(TestConstants.BAD_TWO_BODY))
                    .getDocumentElement();
            OMTestUtils.walkThrough(soapEnvelope);
            fail("this must failed gracefully with OMException or AxisFault");
View Full Code Here

    }

    //done
    public void testTwoheaders() throws Exception {
        try {
            SOAPEnvelope soapEnvelope =
                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
                            getTestResourceFile(TestConstants.BAD_TWO_HEADERS))
                    .getDocumentElement();
            OMTestUtils.walkThrough(soapEnvelope);
            fail("this must failed gracefully with OMException or AxisFault");
View Full Code Here

    }

    //done
    public void testWrongSoapNs() throws Exception {
        try {
            SOAPEnvelope soapEnvelope =
                    (SOAPEnvelope) OMTestUtils.getOMBuilder(
                            getTestResourceFile(TestConstants.BAD_WRONG_SOAP_NS))
                    .getDocumentElement();
            OMTestUtils.walkThrough(soapEnvelope);
            fail("this must failed gracefully with OMException or AxisFault");
View Full Code Here

        File dir = new File(testResourceDir, "soap");
        File[] files = dir.listFiles();
        if (files != null) {
            for (int i = 0; i < files.length; i++) {
                if (files[i].isFile() && files[i].getName().endsWith(".xml") && !files[i].getName().startsWith("wrong")) {
                    SOAPEnvelope soapEnvelope = (SOAPEnvelope) OMTestUtils.getOMBuilder(
                            files[i])
                            .getDocumentElement();
                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                    dbf.setNamespaceAware(true);
                    DocumentBuilder builder = dbf.newDocumentBuilder();
View Full Code Here

//        writer.flush();
//    }


    public void testSerilizationWithDefaultNamespaces() throws Exception {
        SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
        env.serialize(writer);
        OMElement balanceElement = env.getBody().getFirstElement();
        assertEquals("Deafualt namespace has not been set properly",
                balanceElement.getNamespace().getName(),
                "http://localhost:8081/axis/services/BankPort/");

        OMElement accountNo = balanceElement.getFirstElement();
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.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.