Package javax.xml.soap

Examples of javax.xml.soap.SOAPFactory


    }

    public void testCreateElement() {
        try {
            //SOAPFactory sf = SOAPFactory.newInstance();
            SOAPFactory sf = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            if (sf == null) {
                fail("createElementTest4() could not create SOAPFactory object");
            }
            //Create QName object with localName=MyName1,prefix=MyPrefix1, uri=MyUri1
            QName name = new QName("MyUri1", "MyName1", "MyPrefix1");
            SOAPElement se = sf.createElement(name);
            assertNotNull(se);
            name = se.getElementQName();
            String localName = name.getLocalPart();
            String prefix = name.getPrefix();
            String uri = name.getNamespaceURI();
View Full Code Here


    }


    public void testCreateElement2() {
        try {
            SOAPFactory sf = SOAPFactory.newInstance();
            //SOAPFactory sf = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            if (sf == null) {
                fail("could not create SOAPFactory object");
            }
            log.info("Create a DOMElement");
            DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dbfactory.newDocumentBuilder();
            Document document = builder.newDocument();
            Element de = document.createElementNS("http://MyNamespace.org/", "MyTag");
            //Calling SOAPFactory.createElement(org.w3c.dom.Element)
            SOAPElement se = sf.createElement(de);
            if (!de.getNodeName().equals(se.getNodeName()) || !de.getNamespaceURI().equals(
                    se.getNamespaceURI())) {
                //Node names are not equal
                fail("Got: <URI=" + se.getNamespaceURI() + ", PREFIX=" +
                        se.getPrefix() + ", NAME=" + se.getNodeName() + ">" +
View Full Code Here

        }
    }

    public void testCreateElement3() {
        try {
            SOAPFactory factory = SOAPFactory.newInstance();
            if (factory == null) {
                fail("createFaultTest1() could not create SOAPFactory object");
            }
            SOAPFault sf = factory.createFault();
            if (sf == null) {
                fail("createFault() returned null");
            } else if (!(sf instanceof SOAPFault)) {
                fail("createFault() did not create a SOAPFault object");
            }
View Full Code Here

        }
    }

    public void testCreateElement4() {
        try {
            SOAPFactory sf = SOAPFactory.newInstance();
            if (sf == null) {
                fail("createElementTest6() could not create SOAPFactory object");
            }
            QName qname = new QName("http://MyNamespace.org/", "MyTag");
            SOAPElement se1 = sf.createElement(qname);
            //Create second SOAPElement from first SOAPElement
            SOAPElement se2 = sf.createElement(se1);
            //commented to support jdk 1.4 build
            //        if(!se1.isEqualNode(se2) && !se1.isSameNode(se2)) {
            //          fail("The SOAPElement's are not equal and not the same (unexpected)");
            //        }
            if (!se1.getNodeName().equals(se2.getNodeName()) || !se1.getNamespaceURI().equals(
View Full Code Here

        }
    }

    public void testCreateFault() {
        try {
            SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            //SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault sf = factory.createFault("This is the fault reason.",
                                               SOAPConstants.SOAP_RECEIVER_FAULT);
            assertNotNull(sf);
            assertTrue(sf instanceof SOAPFault);
            QName fc = sf.getFaultCodeAsQName();
            //Expect FaultCode="+SOAPConstants.SOAP_RECEIVER_FAULT
View Full Code Here

    }

    public void testCreateFault1() {
        try {
            //SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault sf = factory.createFault("This is the fault reason.",
                                               SOAPConstants.SOAP_RECEIVER_FAULT);
            assertNotNull(sf);
            QName fc = sf.getFaultCodeAsQName();
            Iterator i = sf.getFaultReasonTexts();
View Full Code Here

    }

    /** for soap 1.1 */
    public void testSOAPFaultException1() {
        try {
            SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            SOAPFault fault = factory.createFault("This is the fault reason.",
                                                  new QName("http://MyNamespaceURI.org/",
                                                            "My Fault Code"));
        } catch (UnsupportedOperationException e) {
            //Caught expected UnsupportedOperationException
        } catch (SOAPException e) {
View Full Code Here

    }

    /** for soap 1.2 */
    public void testSOAPFaultException2() {
        try {
            SOAPFactory factory = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            SOAPFault sf = factory.createFault("This is the fault reason.",
                                               new QName("http://MyNamespaceURI.org/",
                                                         "My Fault Code"));
            fail("Did not throw expected SOAPException");
        } catch (UnsupportedOperationException e) {
            //Caught expected UnsupportedOperationException
View Full Code Here

   
    // Stept 2: Create OM and parent SOAPElement
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace wrapNs = fac.createOMNamespace("namespace", "prefix");
        OMElement ome = fac.createOMElement("localname", wrapNs);
        SOAPFactory sf = SOAPFactory.newInstance();
        SOAPElement se = sf.createElement("name");
       
        // Step 3: Do the conversion
        converter.toSAAJ(ome, se, sf);
    }
View Full Code Here

     * @return
     */
    public static SOAPFactory createSOAPFactory(String namespace)
            throws WebServiceException, SOAPException {
        Method m = getSOAPFactoryNewInstanceProtocolMethod();
        SOAPFactory sf = null;
        if (m == null) {
            if (namespace.equals(SOAP11_ENV_NS)) {
                sf = SOAPFactory.newInstance();
            } else {
                throw ExceptionFactory
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPFactory

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.