Examples of SOAPFactory


Examples of javax.xml.soap.SOAPFactory

            assertEqualsStructWithAnyStrict(x, ret);
        }
    }

    public void testStructWithAnyStrictComplex() throws Exception {
        SOAPFactory factory = SOAPFactory.newInstance();
        SOAPElement elem = factory.createElement("AnonTypeElementQualified",
            "x1", "http://objectweb.org/type_test/types1");
        elem.addNamespaceDeclaration("x1", "http://objectweb.org/type_test/types1");
        SOAPElement floatElem = factory.createElement("varFloat", "x1",
            "http://objectweb.org/type_test/types1");
        floatElem.addTextNode("12.5");
        elem.addChildElement(floatElem);
        SOAPElement intElem = factory.createElement("varInt", "x1",
            "http://objectweb.org/type_test/types1");
        intElem.addTextNode("34");
        elem.addChildElement(intElem);
        SOAPElement stringElem = factory.createElement("varString", "x1",
            "http://objectweb.org/type_test/types1");
        stringElem.addTextNode("test string within any");
        elem.addChildElement(stringElem);
                                
        StructWithAnyStrict x = new StructWithAnyStrict();
        x.setName("Name x");
        x.setAddress("Some Address x");
        x.setAny(elem);
       
        elem = factory.createElement("AnonTypeElementQualified", "x1",
            "http://objectweb.org/type_test/types1");
        elem.addNamespaceDeclaration("x1", "http://objectweb.org/type_test/types1");
        floatElem = factory.createElement("varFloat", "x1",
            "http://objectweb.org/type_test/types1");
        floatElem.addTextNode("12.76");
        elem.addChildElement(floatElem);
        intElem = factory.createElement("varInt", "x1",
            "http://objectweb.org/type_test/types1");
        intElem.addTextNode("56");
        elem.addChildElement(intElem);
        stringElem = factory.createElement("varString", "x1",
            "http://objectweb.org/type_test/types1");
        stringElem.addTextNode("test string");
        elem.addChildElement(stringElem);
       
        StructWithAnyStrict yOrig = new StructWithAnyStrict();
View Full Code Here

Examples of javax.xml.soap.SOAPFactory

            assertEqualsStructWithAnyStrict(x, ret);
        }
    }

    public void testStructWithAnyArrayLax() throws Exception {
        SOAPFactory factory = SOAPFactory.newInstance();
        SOAPElement elem = factory.createElement("StringElementQualified",
            "x1", "http://objectweb.org/type_test/types1");
        elem.addNamespaceDeclaration("x1", "http://objectweb.org/type_test/types1");
        elem.addTextNode("This is the text of the node");

        StructWithAnyArrayLax x = new StructWithAnyArrayLax();
        x.setName("Name x");
        x.setAddress("Some Address x");
        x.getAny().add(elem);

        elem = factory.createElement("StringElementQualified", "x1",
            "http://objectweb.org/type_test/types1");
        elem.addNamespaceDeclaration("x1", "http://objectweb.org/type_test/types1");
        elem.addTextNode("This is the text of the node for the second struct");

        StructWithAnyArrayLax yOrig = new StructWithAnyArrayLax();
View Full Code Here

Examples of javax.xml.soap.SOAPFactory

            assertEqualsStructWithAnyArrayLax(x, ret);
        }
    }
   
    public void testStructWithAnyArrayLaxComplex() throws Exception {
        SOAPFactory factory = SOAPFactory.newInstance();
        SOAPElement elem = factory.createElement("AnonTypeElementQualified", "x1",
            "http://objectweb.org/type_test/types1");
        elem.addNamespaceDeclaration("x1", "http://objectweb.org/type_test/types1");
        SOAPElement floatElem = factory.createElement("varFloat", "x1",
            "http://objectweb.org/type_test/types1");
        floatElem.addTextNode("12.76");
        elem.addChildElement(floatElem);
        SOAPElement intElem = factory.createElement("varInt", "x1",
            "http://objectweb.org/type_test/types1");
        intElem.addTextNode("56");
        elem.addChildElement(intElem);
        SOAPElement stringElem = factory.createElement("varString", "x1",
            "http://objectweb.org/type_test/types1");
        stringElem.addTextNode("test string");
        elem.addChildElement(stringElem);

        StructWithAnyArrayLax x = new StructWithAnyArrayLax();
View Full Code Here

Examples of javax.xml.soap.SOAPFactory

    private SOAPFaultException createSOAPFaultException(String localName,
                                                        String prefix,
                                                        String namespace,
                                                        String reason)
        throws SOAPException {
        SOAPFactory factory = getSOAPFactory();
        SOAPFault fault = factory.createFault();
        Name qname = factory.createName(localName, prefix, namespace);
        fault.setFaultCode(qname);
        fault.setFaultString(reason);
        return new SOAPFaultException(fault);
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFactory

    }

    public void testMarshall() throws Exception {
        String str = new String("Hello");
        QName inCorrectElName = new QName("http://test_jaxb_marshall", "requestType");
        SOAPFactory soapElFactory = SOAPFactory.newInstance();
        Element elNode = soapElFactory.createElement(inCorrectElName);
        assertNotNull(elNode);

        Node node;
        try {
            JAXBEncoderDecoder.marshall(context, null, null, inCorrectElName,  elNode);
View Full Code Here

Examples of javax.xml.soap.SOAPFactory

            //expected - not a valid object
        }
    }
   
    public void testMarshalRPCLit() throws Exception {
        SOAPFactory soapElFactory = SOAPFactory.newInstance();
        QName elName = new QName("http://test_jaxb_marshall", "in");
        SOAPElement elNode = soapElFactory.createElement(elName);
        JAXBEncoderDecoder.marshall(context, null, new String("TestSOAPMessage"), elName,  elNode);
       
        assertNotNull(elNode.getChildNodes());
        assertEquals("TestSOAPMessage", elNode.getFirstChild().getFirstChild().getNodeValue());
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFactory

        //Hello World Wsdl generated namespace
        QName elName = new QName(wrapperAnnotation.targetNamespace(),
                                 wrapperAnnotation.localName());
        //Create a XML Tree of
        //<GreetMe><requestType>Hello</requestType></GreetMe>
        SOAPFactory soapElFactory = SOAPFactory.newInstance();
        SOAPElement elNode = soapElFactory.createElement(elName);
        elNode.addNamespaceDeclaration("", elName.getNamespaceURI());

        String str = new String("Hello Test");
        elNode.addChildElement("requestType").setValue(str);

        Object obj = JAXBEncoderDecoder.unmarshall(context, null,
                         elNode, elName, Class.forName(wrapperAnnotation.className()));
        assertNotNull(obj);

        //Add a Node and then test
        assertEquals(GreetMe.class,  obj.getClass());
        assertEquals(str, ((GreetMe)obj).getRequestType());
       
        try {
            JAXBEncoderDecoder.unmarshall(context, null, null, null, String.class);
            fail("Should have received a ProtocolException");
        } catch (ProtocolException pe) {
            //Expected Exception
        } catch (Exception ex) {
            fail("Should have received a ProtocolException, not: " + ex);
        }
       
        // Now test schema validation during unmarshaling
        elName = new QName(wrapperAnnotation.targetNamespace(),
                           "stringStruct");
        // Create an XML Tree of
        // <StringStruct><arg1>World</arg1></StringStruct>
        elNode = soapElFactory.createElement(elName);
        elNode.addNamespaceDeclaration("", elName.getNamespaceURI());
        str = new String("World");
        elNode.addChildElement("arg1").setValue(str);
        // Should unmarshal without problems when no schema used.
        obj = JAXBEncoderDecoder.unmarshall(context, null, elNode,  elName,
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFactory

                    elem.build();
                    if (elem instanceof SOAPEnvelope) {
                        SOAPEnvelope soapEnvelope = (SOAPEnvelope) elem;
                        String soapNamespace = soapEnvelope.getNamespace().getNamespaceURI();
                        if (soapEnvelope.getHeader() == null) {
                            SOAPFactory soapFactory;
                            if (soapNamespace.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
                                soapFactory = OMAbstractFactory.getSOAP12Factory();
                            } else {
                                soapFactory = OMAbstractFactory.getSOAP11Factory();
                            }
                            soapFactory.createSOAPHeader(soapEnvelope);
                        }
                        sourceNodeList.add(soapEnvelope);
                    } else {
                        sourceNodeList.add(elem);
                    }
                } catch (XMLStreamException e) {
                    synLog.error("Source Property cannot be parsed : " + e.getStackTrace().toString());
                }
            } else if (o instanceof ArrayList) {
                ArrayList nodesList = (ArrayList) o;
                for (Object node : nodesList) {
                    if (node instanceof OMElement) {
                        if (node instanceof SOAPEnvelope) {
                            SOAPEnvelope soapEnvelope = (SOAPEnvelope) node;
                            String soapNamespace = null;

                            if (soapEnvelope.getNamespace() != null) {
                                soapNamespace = soapEnvelope.getNamespace().getNamespaceURI();
                            }
                            if (soapEnvelope.getHeader() == null && soapNamespace != null) {
                                SOAPFactory soapFactory;
                                if (soapNamespace.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
                                    soapFactory = OMAbstractFactory.getSOAP12Factory();
                                } else {
                                    soapFactory = OMAbstractFactory.getSOAP11Factory();
                                }
                                soapFactory.createSOAPHeader(soapEnvelope);
                            }
                            sourceNodeList.add(soapEnvelope);
                        } else {
                            OMElement ele = (OMElement) node;
                            sourceNodeList.add(ele);
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFactory

        }
        return sourceNodeList;
    }

    private SOAPEnvelope getSOAPEnvFromOM(OMElement inlineElement) {
        SOAPFactory soapFactory;
        if (inlineElement.getQName().getNamespaceURI().equals(
                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            soapFactory = OMAbstractFactory.getSOAP12Factory();
        } else {
            soapFactory = OMAbstractFactory.getSOAP11Factory();
View Full Code Here

Examples of org.apache.axiom.soap.SOAPFactory

    public void setAxis2xml(String axis2xml) {
        this.axis2xml = axis2xml;
    }

    private SOAPEnvelope createSOAPEnvelope(OMElement payload , String soapNamespaceUri) {
         SOAPFactory soapFactory = null;
                if (soapNamespaceUri.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
                    soapFactory = OMAbstractFactory.getSOAP12Factory();
                } else {
                    soapFactory = OMAbstractFactory.getSOAP11Factory();
                }
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        envelope.getBody().addChild(payload);
        return envelope;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.