Package javax.xml.ws.soap

Examples of javax.xml.ws.soap.SOAPFaultException


            } else if (getBinding() instanceof SOAPBinding) {
                SOAPFault soapFault = createSoapFault((SOAPBinding)getBinding(), ex);
                if (soapFault == null) {
                    throw new WebServiceException(ex);
                }
                SOAPFaultException  exception = new SOAPFaultException(soapFault);
                if (ex instanceof Fault && ex.getCause() != null) {
                    exception.initCause(ex.getCause());
                } else {
                    exception.initCause(ex);
                }
                throw exception;               
            } else {
                throw new WebServiceException(ex);
            }
View Full Code Here


   
    private void throwUnsupportedOperation(String string) {
        try {
            SOAPFault fault = SAAJFactoryResolver.createSOAPFactory(null).createFault();
            fault.setFaultString("Unsupported operation " + string);
            throw new SOAPFaultException(fault);
        } catch (SOAPException e) {
            throw new Fault(e);
        }
    }
View Full Code Here

                    SOAPConstants.SOAP_VERSIONMISMATCH_FAULT);
            fault.setFaultActor("mr.actor");
            fault.addDetail().addChildElement("test");
            fault.appendFaultSubcode(new QName("http://ws.gss.redhat.com/", "NullPointerException"));
            fault.appendFaultSubcode(new QName("http://ws.gss.redhat.com/", "OperatorNotFound"));
            throw new SOAPFaultException(fault);
        } catch (SOAPException ex) {
            ex.printStackTrace();
        }
        return "Failure!";
    }
View Full Code Here

      }
      if (t instanceof Exception) {
         if (t instanceof InvocationTargetException) {
            throw (Exception) t;
         } else {
            SOAPFaultException ex = findSoapFaultException(t);
            if (ex != null) {
               throw new InvocationTargetException(ex);
            }
            throw new InvocationTargetException(t);
         }
View Full Code Here

      DispositionReport report = null;
      if (e instanceof DispositionReportFaultMessage) {
        DispositionReportFaultMessage faultMsg = (DispositionReportFaultMessage) e;
        report = faultMsg.getFaultInfo();
      } else if (e instanceof SOAPFaultException) {
        SOAPFaultException soapFault = (SOAPFaultException) e;
        Detail detail = soapFault.getFault().getDetail();
        if (detail != null && detail.getFirstChild()!=null) {
          try {
            report =  new DispositionReport(detail.getFirstChild());
          } catch (JAXBException je) {
            log.error("Could not unmarshall detail to a DispositionReport");
View Full Code Here

            } else if (getBinding() instanceof SOAPBinding) {
                SOAPFault soapFault = createSoapFault((SOAPBinding)getBinding(), ex);
                if (soapFault == null) {
                    throw new WebServiceException(ex);
                }
                SOAPFaultException  exception = new SOAPFaultException(soapFault);
                if (ex instanceof Fault && ex.getCause() != null) {
                    exception.initCause(ex.getCause());
                } else {
                    exception.initCause(ex);
                }
                throw exception;               
            } else {
                throw new WebServiceException(ex);
            }
View Full Code Here

        if (f == null) {
            return;
        }
        try {
            if (f.getCause().getClass().equals(SOAPFaultException.class)) {
                SOAPFaultException sf = (SOAPFaultException) (f.getCause());
                if (f instanceof SoapFault) {
                    for (Iterator<QName> it = CastUtils.cast(sf.getFault().getFaultSubcodes()); it.hasNext();) {
                        ((SoapFault) f).addSubCode(it.next());   
                    }
                }
                if (sf.getFault().getFaultReasonLocales().hasNext()) {
                    Locale lang = (Locale) sf.getFault()
                           .getFaultReasonLocales().next();
                    String convertedLang = lang.getLanguage();
                    String country = lang.getCountry();
                    if (country.length() > 0) {
                        convertedLang = convertedLang + '_' + country;
View Full Code Here

        } else if (b.equals("SOAPFaultException")) {
            try {
                SOAPFault soapFault = createSOAPFault();
                soapFault.setFaultString("hello world");
                soapFault.setFaultActor("actor");
                throw new SOAPFaultException(soapFault);
            } catch (SOAPException se) {}
        } else if (b.equals("SOAPFaultException2")) {
            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")) {
            // Throw NPE with a message
View Full Code Here

        // with the right protocol.
        byte[] bytes = sampleEnvelope_MustUnderstand.getBytes();
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        StreamSource request = new StreamSource(bais);
       
        SOAPFaultException e = null;
        try {
            Source response = dispatch.invoke(request);
        } catch (SOAPFaultException ex) {
            e = ex;
        }
       
        assertNotNull("We should have an exception, but none was thrown.", e);
        assertEquals("FaultCode should be \"MustUnderstand\"", "MustUnderstand", e.getFault().getFaultCodeAsQName().getLocalPart());
       
       
    }
View Full Code Here

                log.debug("Constructing SOAPFaultException for " + e);
            }
            try {
                SOAPFault soapFault = SOAPFactory.newInstance().createFault();
                soapFault.setFaultString(e.getMessage());
                return new SOAPFaultException(soapFault);
            } catch (Exception ex) {
                if (log.isDebugEnabled()) {
                    log.debug("Exception occurred during fault processing:", ex);
                }
                return ExceptionFactory.makeProtocolException(e.getMessage(), null);
View Full Code Here

TOP

Related Classes of javax.xml.ws.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.