Package javax.xml.rpc.soap

Examples of javax.xml.rpc.soap.SOAPFaultException


         return response;
      }
      catch (SubscriptionError e)
      {
         throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null);
      }
   }
View Full Code Here


      {
         getSubscriptionManager().unsubscribe(identifier);
      }
      catch (SubscriptionError e)
      {
         throw new SOAPFaultException(buildFaultQName(e.getSubcode()), e.getReason(), null, null);
      }

   }
View Full Code Here

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      AddressingProperties addrProps = (AddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);

      if (null == addrProps)
      {
         throw new SOAPFaultException(
            Constants.SOAP11_FAULT_CODE_CLIENT,
            "The message is not valid and cannot be processed: " +
               "Cannot obtain addressing properties.",
            null, null
         );
      }

      ReferenceParameters refParams = addrProps.getReferenceParameters();
      if (refParams != null)
      {
         for (Object obj : refParams.getElements())
         {
            if (obj instanceof Element)
            {
               Element el = (Element)obj;
               QName qname = DOMUtils.getElementQName(el);
               if (qname.equals(IDQN))
               {
                  try
                  {
                     subscriptionId = new URI(DOMUtils.getTextContent(el));
                     break;
                  }
                  catch (URISyntaxException e)
                  {
                     throw new SOAPFaultException(
                        Constants.SOAP11_FAULT_CODE_CLIENT,
                        "The message is not valid and cannot be processed: " +
                           "Invalid subscription id.",
                        null, null
                     );
                  }
               }
            }
         }
      }

      if (null == subscriptionId)
      {
         throw new SOAPFaultException(
            buildFaultQName(EventingConstants.CODE_INVALID_MESSAGE),
            "The message is not valid and cannot be processed: "
               + "Cannot obtain subscription id.",
            null, null
         );
View Full Code Here

      Detail detail = soapFault.addDetail();
      Name name = soapEnv.createName("GetLastTradePrice", "WOMBAT", "http://www.wombat.org/trader");
      detail.addDetailEntry(name);

      QName faultCode = new QName("http://foo.bar", "faultCode");
      SOAPFaultException sfex = new SOAPFaultException(faultCode, "faultString", "faultActor", detail);
      assertEquals("faultString", sfex.getFaultString());
      assertEquals(faultCode, sfex.getFaultCode());
      assertEquals("faultActor", sfex.getFaultActor());
   }
View Full Code Here

      "</env:Envelope>";

   public void testExceptionToFault() throws Exception
   {
      Detail detail = createDetailElement();
      SOAPFaultException faultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, "Some fault message", "Some fault actor", detail);
      SOAPEnvelope soapEnv = SOAPFaultHelperJAXRPC.exceptionToFaultMessage(faultEx).getSOAPPart().getEnvelope();
      assertEquals(DOMUtils.parse(envStr), soapEnv);
   }
View Full Code Here

      assertEquals("env:Client", soapFault.getFaultCode());
      assertEquals("Some fault message", soapFault.getFaultString());
      assertEquals("Some fault actor", soapFault.getFaultActor());
      assertEquals(createDetailElement(), soapFault.getDetail());

      SOAPFaultException faultEx = SOAPFaultHelperJAXRPC.getSOAPFaultException((SOAPFault)soapFault);

      assertEquals(Constants.SOAP11_FAULT_CODE_CLIENT, faultEx.getFaultCode());
      assertEquals("Some fault message", faultEx.getFaultString());
      assertEquals("Some fault actor", faultEx.getFaultActor());
      assertEquals(createDetailElement(), faultEx.getDetail());
   }
View Full Code Here

    public void testRequestHandlerThrowsSFE() throws Exception {
        SOAPService soapService = new SOAPService();

        // SETUP THE 2nd HANDLER IN THE REQUEST CHAIN TO THROW SOAPFaultException
        handler1Config.put("HANDLE_REQUEST_RETURN_VALUE",
                new SOAPFaultException(null, "f", "f", new Detail()));
        TestHandlerInfoChainFactory factory = buildInfoChainFactory();
        soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
        soapService.init();
        MessageContext msgContext = new TestMessageContext();
        soapService.invoke(msgContext);
View Full Code Here

    public void testHandleFaultReturnsFalse() throws Exception {
        SOAPService soapService = new SOAPService();

        // SETUP THE LAST HANDLER IN THE REQUEST CHAIN TO THROW SOAPFaultException
        handler2Config.put("HANDLE_REQUEST_RETURN_VALUE",
                new SOAPFaultException(null, "f", "f", new Detail()));
        handler1Config.put("HANDLE_FAULT_RETURN_VALUE", Boolean.FALSE);
        TestHandlerInfoChainFactory factory = buildInfoChainFactory();
        soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
        soapService.init();
        MessageContext msgContext = new TestMessageContext();
View Full Code Here

    public void testFaultHandlerThrowsJAXRPCException() throws Exception {
        SOAPService soapService = new SOAPService();

        // SETUP THE LAST HANDLER IN THE REQUEST CHAIN TO THROW SOAPFaultException
        handler2Config.put("HANDLE_REQUEST_RETURN_VALUE",
                new SOAPFaultException(null, "f", "f", new Detail()));
        handler1Config.put("HANDLE_FAULT_RETURN_VALUE", new JAXRPCException());
        TestHandlerInfoChainFactory factory = buildInfoChainFactory();
        soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
        soapService.init();
        MessageContext msgContext = new TestMessageContext();
View Full Code Here

    public void testFaultHandlerThrowsRuntimeException() throws Exception {
        SOAPService soapService = new SOAPService();

        // SETUP THE LAST HANDLER IN THE REQUEST CHAIN TO THROW SOAPFaultException
        handler2Config.put("HANDLE_REQUEST_RETURN_VALUE",
                new SOAPFaultException(null, "f", "f", new Detail()));
        handler1Config.put("HANDLE_FAULT_RETURN_VALUE", new RuntimeException());
        TestHandlerInfoChainFactory factory = buildInfoChainFactory();
        soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
        soapService.init();
        MessageContext msgContext = new TestMessageContext();
View Full Code Here

TOP

Related Classes of javax.xml.rpc.soap.SOAPFaultException

Copyright © 2018 www.massapicom. 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.