Package javax.xml.soap

Examples of javax.xml.soap.SOAPFactory.createFault()


      if (obj == null)
      {
         try
         {
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault fault = factory.createFault("Request object cannot be null", new QName("http://org.jboss.ws", "Dispatch"));
            fault.setFaultActor("client");
            throw new SOAPFaultException(fault);
         }
         catch (SOAPException e)
         {
View Full Code Here


            if (v.contains("Return sayHi")) {
                response = sayHiResponse;
            } else if (v.contains("throwFault")) {
                try {
                    SOAPFactory f = SOAPFactory.newInstance();
                    SOAPFault soapFault = f.createFault();
                   
                    soapFault.setFaultString("Test Fault String ****");
      
                    Detail detail = soapFault.addDetail();
                    detail = soapFault.getDetail();
View Full Code Here

    }

    @Validated @Test
    public void testSetGetFaultCodeAsName1() throws Exception {
        SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
        SOAPFault sf = fac.createFault();

        Name name = fac.createName("myfault", "flt", "http://example.com");
        sf.setFaultCode(name);
       
        Name name2 = sf.getFaultCodeAsName();           
View Full Code Here

    public void testSetGetFaultCodeAsName2() throws Exception {
        QName qname = SOAPConstants.SOAP_SENDER_FAULT;
        SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
        Name name = fac.createName(qname.getLocalPart(),
                                   qname.getPrefix(), qname.getNamespaceURI());
        SOAPFault sf = fac.createFault();
        sf.setFaultCode(name);
       
        Name name2 = sf.getFaultCodeAsName();           
        assertNotNull(name2);
        assertEquals(name.getLocalName(), name2.getLocalName());
View Full Code Here

    }

    @Validated @Test
    public void testSetGetFaultCodeAsQName1() throws Exception {
        SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
        SOAPFault sf = fac.createFault();

        QName name = new QName("http://example.com", "myfault", "flt");
        sf.setFaultCode(name);
       
        QName name2 = sf.getFaultCodeAsQName();
View Full Code Here

    @Validated @Test
    public void testSetGetFaultCodeAsQName2() throws Exception {
        QName name = SOAPConstants.SOAP_SENDER_FAULT;
        SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
        SOAPFault sf = fac.createFault();
        sf.setFaultCode(name);
       
        QName name2 = sf.getFaultCodeAsQName();
        assertNotNull(name2);
        assertEquals(name.getLocalPart(), name2.getLocalPart());
View Full Code Here

        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

    @Validated @Test
    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

    @Test
    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 */
    @Validated @Test
    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

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.