Package javax.xml.soap

Examples of javax.xml.soap.SOAPBody.addFault()


      // the SOAPFault so lets piece it together and
      // send it on it's way.
     
      try {
        SOAPBody soapResBody = soapRes.getSOAPBody();    
        SOAPFault soapFault = soapResBody.addFault();
        soapFault.setFaultCode(faultCode);
        soapFault.setFaultString(faultString);
        soapFault.setFaultActor(faultActor);
       
        // We're always going to include a DispositionReport (for
View Full Code Here


    }

    public void testFaults() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
        SOAPBody body = envelope.getBody();
        SOAPFault sf = body.addFault();
        sf.setFaultCode("myFault");
        String fc = sf.getFaultCode();
        assertTrue(fc.equals("myFault"));
    }
View Full Code Here

     */
    public void testCustomFault11() throws Exception {
        MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
        SOAPMessage sm = mf.createMessage();
        SOAPBody body = sm.getSOAPBody();
        SOAPFault fault = body.addFault(CUSTOM, "Custom Fault");
       
        XMLFault xmlFault = XMLFaultUtils.createXMLFault(fault);
       
        assertTrue(xmlFault != null);
       
View Full Code Here

        MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
        SOAPMessage sm = mf.createMessage();
        SOAPBody body = sm.getSOAPBody();
       
        try {
            SOAPFault fault = body.addFault(CUSTOM, "Custom Fault");
            fail("Expected Failure, custom fault codes are not supported with SOAP 1.2");
        } catch (SOAPException e) {
            // Expected...
        } catch (Throwable t) {
            fail("Expected different failure, received: " + t);
View Full Code Here

    public void testCustomRoleNodeFault12() throws Exception {
        MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
        SOAPMessage sm = mf.createMessage();
        SOAPBody body = sm.getSOAPBody();
       
        SOAPFault fault = body.addFault();
        fault.setFaultRole("TestRole");
        fault.setFaultNode("http://XMLFaultTest/testCustomRoleNodeFault/");
       
        XMLFault xmlFault = XMLFaultUtils.createXMLFault(fault);
       
View Full Code Here

        SOAPHeaderElement id = header.addHeaderElement(idName);
        id.setMustUnderstand(true);
        id.addTextNode("HEADERID-7867678");

        //Create the SOAPFault object
        SOAPFault fault = body.addFault();
        fault.setFaultCode("Client");
        fault.setFaultString("CWMP fault");
        fault.setFaultActor("http://gizmos.com/order");

        assertEquals("Client", fault.getFaultCode());
View Full Code Here

        SOAPPart soapPart = soapMessage.getSOAPPart();
        SOAPEnvelope envelope = soapPart.getEnvelope();
        envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
        SOAPBody body = envelope.getBody();

        body.addFault().addDetail();
        try {
            body.getFault().addDetail();
            fail("Expected Exception did not occur");
        } catch (SOAPException e) {
            assertTrue(true);
View Full Code Here

    public void testFaults() throws Exception {
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPFactory soapFactory = SOAPFactory.newInstance();
        SOAPMessage message = messageFactory.createMessage();
        SOAPBody body = message.getSOAPBody();
        SOAPFault fault = body.addFault();

        Name faultName =
                soapFactory.createName("Client", "",
                                       SOAPConstants.URI_NS_SOAP_ENVELOPE);
        fault.setFaultCode(faultName);
View Full Code Here

        SOAPMessage soapMessage = fac.createMessage();
        SOAPPart soapPart = soapMessage.getSOAPPart();
        SOAPEnvelope envelope = soapPart.getEnvelope();
        envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
        SOAPBody body = envelope.getBody();
        SOAPFault soapFault = body.addFault();
        QName qname = new QName("http://example.com", "myfault1", "flt1");
        soapFault.appendFaultSubcode(qname);

        QName qname2 = new QName("http://example2.com", "myfault2", "flt2");
        soapFault.appendFaultSubcode(qname2);
View Full Code Here

        SOAPMessage soapMessage = fac.createMessage();
        SOAPPart soapPart = soapMessage.getSOAPPart();
        SOAPEnvelope envelope = soapPart.getEnvelope();
        envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
        SOAPBody body = envelope.getBody();
        SOAPFault sf = body.addFault();

        QName expected1 = new QName("http://example.com", "myfault1", "flt1");
        QName expected2 = new QName("http://example.com", "myfault2", "flt2");
        boolean found1 = false;
        boolean found2 = false;
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.