Package javax.xml.soap

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


                                                        String prefix,
                                                        String namespace,
                                                        String reason)
        throws SOAPException {
        SOAPFactory factory = getSOAPFactory();
        SOAPFault fault = factory.createFault();
        Name qname = factory.createName(localName, prefix, namespace);
        fault.setFaultCode(qname);
        fault.setFaultString(reason);
        return new SOAPFaultException(fault);
    }
View Full Code Here


    if (Integer.parseInt(lastDigit.toString()) % 2 == 0) {
      return true;
    } else {
      SOAPFactory soapFactory = SOAPFactory.newInstance();
      SOAPFault fault = soapFactory.createFault("The credit card number is invalid", new QName("ValidationFault"));
      throw new CardValidatorSOAPFaultException21(fault);
    }
  }

  public static void main(String[] args) {
View Full Code Here

    public GreetMeResponse greetMe(GreetMeRequest gmr) {
        if ("fault".equals(gmr.getName())) {
            try {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault fault = factory.createFault("this is a fault string!",
                                                      new QName("http://foo", "FooCode"));
                fault.setFaultActor("mr.actor");
                fault.addDetail().addChildElement("test").addTextNode("TestText");
                throw new SOAPFaultException(fault);
            } catch (SOAPException ex) {
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

    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

      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

   {
      // This should be thrown as-is
      try
      {
         SOAPFactory factory = SOAPFactory.newInstance();
         SOAPFault fault = factory.createFault("this is a fault string!", new QName("http://foo", "FooCode"));
         fault.setFaultActor("mr.actor");
         fault.addDetail().addChildElement("test");
         throw new SOAPFaultException(fault);
      }
      catch (SOAPException s)
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.