Examples of DetailEntry


Examples of javax.xml.soap.DetailEntry

                OMBlockFactory bf =
                        (OMBlockFactory)FactoryRegistry.getFactory(OMBlockFactory.class);
                ArrayList<Block> list = new ArrayList<Block>();
                Iterator it = detail.getDetailEntries();
                while (it.hasNext()) {
                    DetailEntry de = (DetailEntry)it.next();
                    OMElement om = converter.toOM(de);
                    Block b = bf.createFrom(om, null, om.getQName());
                    list.add(b);
                }
                blocks = new Block[list.size()];
View Full Code Here

Examples of javax.xml.soap.DetailEntry

                    fault.setFaultString(e.getMessage());
                }
                Detail detail = fault.addDetail();
                detail = fault.getDetail();
                QName qName = new QName(WSTRUST_13_NAMESPACE, "Fault", "ns");
                DetailEntry de = detail.addDetailEntry(qName);
                qName = new QName(WSTRUST_13_NAMESPACE, "ErrorCode", "ns");
                SOAPElement errorElement = de.addChildElement(qName);
                StackTraceElement[] ste = e.getStackTrace();
                errorElement.setTextContent(ste[0].toString());
                throw new SOAPFaultException(fault);
            } catch (SOAPException e1) {
                throw new Fault(e1);
View Full Code Here

Examples of javax.xml.soap.DetailEntry

        Detail faultDetail = fault.getDetail();
        NodeList faultDetailChildNodes = faultDetail.getChildNodes();
        assertEquals(2, faultDetailChildNodes.getLength());
       
        Iterator<?> detailEntries = faultDetail.getDetailEntries();
        DetailEntry detailEntry = (DetailEntry)detailEntries.next();
        assertEquals("errorcode", detailEntry.getLocalName());
        assertEquals(3, Integer.valueOf(detailEntry.getTextContent()).intValue());
        detailEntry = (DetailEntry)detailEntries.next();
        assertEquals("errorstring", detailEntry.getLocalName());
        assertEquals("This is a fault detail error string", detailEntry.getTextContent());
       
    }
View Full Code Here

Examples of javax.xml.soap.DetailEntry

        assertEquals("http://gizmos.com/order", fault.getFaultActor());

        //Add Fault Detail information
        Detail faultDetail = fault.addDetail();
        Name cwmpFaultName = envelope.createName("Fault", "cwmp", "http://cwmp.com");
        DetailEntry faultDetailEntry = faultDetail.addDetailEntry(cwmpFaultName);
        SOAPElement e = faultDetailEntry.addChildElement("FaultCode");

        e.addTextNode("This is the fault code");
        SOAPElement e2 = faultDetailEntry.addChildElement(envelope.createName("FaultString",
                                                                              "cwmp",
                                                                              "http://cwmp.com"));
        e2.addTextNode("Fault Message");

        SOAPElement e3 = faultDetailEntry.addChildElement("Message");
        e3.addTextNode("This is a test fault");

        soapMessage.saveChanges();

        // ------------------- Validate the contents -------------------------------------
        final Detail detail = fault.getDetail();
        final Iterator detailEntryIter = detail.getDetailEntries();
        boolean foundFirst = false;
        boolean foundSecond = false;
        boolean foundThird = false;
        while (detailEntryIter.hasNext()) {
            final DetailEntry detailEntry = (DetailEntry)detailEntryIter.next();
            final Iterator childElementsIter = detailEntry.getChildElements();
            while (childElementsIter.hasNext()) {
                final SOAPElement soapElement = (SOAPElement)childElementsIter.next();
                if (soapElement.getTagName().equals("FaultCode") &&
                        soapElement.getValue().equals("This is the fault code")) {
                    foundFirst = true;
View Full Code Here

Examples of javax.xml.soap.DetailEntry

            Detail detail = fault.addDetail();

            Name entryName =
                    soapFactory.createName("order", "PO",
                                           "http://gizmos.com/orders/");
            DetailEntry entry = detail.addDetailEntry(entryName);
            entry.addTextNode("Quantity element does not have a value");

            Name entryName2 =
                    soapFactory.createName("confirmation", "PO",
                                           "http://gizmos.com/confirm");
            DetailEntry entry2 = detail.addDetailEntry(entryName2);
            entry2.addTextNode("Incomplete address: " + "no zip code");

            message.saveChanges();
            //message.writeTo(System.out);

            // Now retrieve the SOAPFault object and
            // its contents, after checking to see that
            // there is one
            if (body.hasFault()) {
                SOAPFault newFault = body.getFault();

                // Get the qualified name of the fault code
                assertNotNull(newFault.getFaultCodeAsName());
                assertNotNull(newFault.getFaultString());
                assertNotNull(newFault.getFaultActor());
                Detail newDetail = newFault.getDetail();

                if (newDetail != null) {
                    Iterator entries = newDetail.getDetailEntries();

                    while (entries.hasNext()) {
                        DetailEntry newEntry = (DetailEntry)entries.next();
                        String value = newEntry.getValue();
                        assertNotNull(value);
                    }
                }
            }
        } catch (Exception e) {
View Full Code Here

Examples of javax.xml.soap.DetailEntry

                assertTrue(fault != null);
                assertTrue(fault.getFaultString().equals("sample fault"));
                QName expectedFaultCode = new QName(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, "Client");
                assertTrue(fault.getFaultCodeAsQName().equals(expectedFaultCode));
                assertTrue(fault.getDetail() != null);
                DetailEntry de = (DetailEntry) fault.getDetail().getDetailEntries().next();
                assertTrue(de != null);
                assertTrue(de.getLocalName().equals("detailEntry"));
                assertTrue(de.getValue().equals("sample detail"));
                assertTrue(fault.getFaultActor().equals("sample actor"));
            }   
    }
View Full Code Here

Examples of javax.xml.soap.DetailEntry

            try {
                SOAPFault soapFault = createSOAPFault();
                soapFault.setFaultString("hello world2");
                soapFault.setFaultActor("actor2");
                Detail detail = soapFault.addDetail();
                DetailEntry de = detail.addDetailEntry(new QName("urn://sample", "detailEntry"));
                de.setValue("Texas");
                throw new SOAPFaultException(soapFault);
            } catch (SOAPException se) {}
        } else if (b.equals("NPE")) {
            throw new NullPointerException();
        } else if (b.equals("NPE2")) {
View Full Code Here

Examples of javax.xml.soap.DetailEntry

        assertTrue(d2 != null);
        Iterator i = d2.getDetailEntries();
        assertTrue(getIteratorCount(i) == 1);
        i = d2.getDetailEntries();
        while (i.hasNext()) {
            DetailEntry de = (DetailEntry)i.next();
            assertEquals(de.getElementName(), name);
        }
    }
View Full Code Here

Examples of javax.xml.soap.DetailEntry

        SOAPFault soapFault = sfe.getFault();
        assertTrue(soapFault != null);
        assertTrue(soapFault.getFaultString().equals("hello world2"));
        assertTrue(soapFault.getFaultActor().equals("actor2"));
        assertTrue(soapFault.getDetail() != null);
        DetailEntry de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
        assertTrue(de != null);
        assertTrue(de.getNamespaceURI().equals("urn://sample"));
        assertTrue(de.getLocalName().equals("detailEntry"));
        assertTrue(de.getValue().equals("Texas"));
    }
View Full Code Here

Examples of javax.xml.soap.DetailEntry

                OMBlockFactory bf =
                        (OMBlockFactory)FactoryRegistry.getFactory(OMBlockFactory.class);
                ArrayList<Block> list = new ArrayList<Block>();
                Iterator it = detail.getChildElements();
                while (it.hasNext()) {
                    DetailEntry de = (DetailEntry)it.next();
                    OMElement om = converter.toOM(de);
                    Block b = bf.createFrom(om, null, om.getQName());
                    list.add(b);
                }
                blocks = new Block[list.size()];
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.