Examples of DetailEntry


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);
                }
            }
        }
    }
View Full Code Here

Examples of javax.xml.soap.DetailEntry

        //Add a Detail object to the SOAPFault object
        Detail d = sf.addDetail();
        QName name = new QName("http://www.wombat.org/trader",
                               "GetLastTradePrice", "WOMBAT");
        //Add a DetailEntry object to the Detail object
        DetailEntry de = d.addDetailEntry(name);
        assertNotNull(de);
        assertTrue(de instanceof DetailEntry);
    }
View Full Code Here

Examples of javax.xml.soap.DetailEntry

        //Add a Detail object to the SOAPFault object
        Detail d = sf.addDetail();
        QName name = new QName("http://www.wombat.org/trader",
                               "GetLastTradePrice", "WOMBAT");
        //Add a DetailEntry object to the Detail object
        DetailEntry de = d.addDetailEntry(name);
        //Successfully created DetailEntry object
        assertNotNull(de);
        assertTrue(de instanceof DetailEntry);
    }
View Full Code Here

Examples of javax.xml.soap.DetailEntry

      return true;
    }
    String detailMsg = ""; //$NON-NLS-1$
    Iterator it = detail.getDetailEntries();
    for ( ; it.hasNext(); ) {
      DetailEntry det = (DetailEntry) it.next();
      Iterator ita = det.getAllAttributes();
      for ( boolean cont = false; ita.hasNext(); cont = true ) {
        Name name = (Name) ita.next();
        if ( cont ) {
          detailMsg += "; "; //$NON-NLS-1$
        }
        detailMsg += name.getLocalName();
        detailMsg += " = "; //$NON-NLS-1$
        detailMsg += det.getAttributeValue( name );
      }
    }
    faults[ 3 ] = detailMsg;

    return true;
View Full Code Here

Examples of javax.xml.soap.DetailEntry

    private static @Nullable QName getFirstDetailEntryName(@Nullable Detail detail) {
        if (detail != null) {
            Iterator<DetailEntry> it = detail.getDetailEntries();
            if (it.hasNext()) {
                DetailEntry entry = it.next();
                return getFirstDetailEntryName(entry);
            }
        }
        return null;
    }
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"));
            }   
           
            // Try a second time
            try {
                // Dispatch
                TestLogger.logger.debug(">> Invoking SOAPMessageProviderDispatch");
                SOAPMessage response = dispatch.invoke(request);
                assertTrue("Expected failure", false);
            } catch (SOAPFaultException e) {
                // Okay
                SOAPFault fault = e.getFault();
                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

        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"));
       
        // Repeat to verify behavior
        try{
            exception = null;
           
            // the invoke will throw an exception, if the test is performed right
            int total = proxy.throwFault(2, "SOAPFaultException2", 2)// "SOAPFaultException" will cause service to throw SOAPFaultException
           
        }catch(SOAPFaultException e){
            // Okay
            exception = e;
        } catch (Exception e) {
            fail("Did not get a SOAPFaultException");
        }

        TestLogger.logger.debug("----------------------------------");
       
        assertNotNull(exception);
        sfe = (SOAPFaultException) exception;
        soapFault = sfe.getFault();
        assertTrue(soapFault != null);
        assertTrue(soapFault.getFaultString().equals("hello world2"));
        assertTrue(soapFault.getFaultActor().equals("actor2"));
        assertTrue(soapFault.getDetail() != null);
        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

            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

                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.