Examples of SoapFaultException


Examples of javax.xml.rpc.soap.SOAPFaultException

      QName faultCode = ((NameImpl)soapFault.getFaultCodeAsName()).toQName();
      String faultString = soapFault.getFaultString();
      String faultActor = soapFault.getFaultActor();
      Detail detail = soapFault.getDetail();

      SOAPFaultException faultEx = new SOAPFaultException(faultCode, faultString, faultActor, detail);

      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
      if (detail != null && msgContext != null)
      {
         SerializationContext serContext = msgContext.getSerializationContext();
         TypeMapping typeMapping = serContext.getTypeMapping();

         Iterator it = detail.getDetailEntries();
         while (it.hasNext())
         {
            DetailEntry deElement = (DetailEntry)it.next();
            Name deName = deElement.getElementName();
            QName xmlName = new QName(deName.getURI(), deName.getLocalName());

            OperationMetaData opMetaData = msgContext.getOperationMetaData();
            FaultMetaData faultMetaData = opMetaData.getFault(xmlName);
            if (faultMetaData != null)
            {
               if (log.isDebugEnabled())
                  log.debug("Deserialize fault: " + faultMetaData);
               QName xmlType = faultMetaData.getXmlType();
               Class javaType = faultMetaData.getJavaType();

               // Get the deserializer from the type mapping
               AbstractDeserializerFactory desFactory = (AbstractDeserializerFactory)typeMapping.getDeserializer(javaType, xmlType);
               if (desFactory == null)
                  throw new JAXRPCException("Cannot obtain deserializer factory for: " + xmlType);

               // Try jaxb deserialization
               try
               {
                  // http://jira.jboss.org/jira/browse/JBWS-955
                  // Cannot deserialize fault detail
                  String prefix = deName.getPrefix();
                  if (prefix.length() > 0)
                  {
                     String nsURI = deName.getURI();
                     String attrValue = deElement.getAttribute("xmlns:" + prefix);
                     if (nsURI.length() > 0 && attrValue.length() == 0)
                        deElement.addNamespaceDeclaration(prefix, nsURI);
                  }

                  Source xmlFragment = new DOMSource(deElement);
                  DeserializerSupport des = (DeserializerSupport)desFactory.getDeserializer();
                  Object userEx = des.deserialize(xmlName, xmlType, xmlFragment, serContext);
                  if (userEx == null || (userEx instanceof Exception) == false)
                     throw new WSException("Invalid deserialization result: " + userEx);

                  faultEx.initCause((Exception)userEx);
               }
               catch (RuntimeException rte)
               {
                  throw rte;
               }
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

        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

Examples of javax.xml.ws.soap.SOAPFaultException

                                                           null));
        assertNotNull(objContext.getException());
        faultEx = objContext.getException();
        assertTrue("Should be a SOAPFaultException",
                   SOAPFaultException.class.isAssignableFrom(faultEx.getClass()));
        SOAPFaultException sfe = (SOAPFaultException)faultEx;
        SOAPFault sf = sfe.getFault();
        assertNotNull(sf);
    }
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

                } catch (Exception ex) {
                    throw new WebServiceException("error in unmarshal of SOAPFault", ex);
                }
            }
        }
        return new SOAPFaultException(fault);
    }
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

                LOG.log(Level.INFO, "SOAP_FAULT_NO_READER");
                faultObj = reader.read(null, 0, fault);
            }
            if (null == faultObj) {
                LOG.log(Level.INFO, "SOAP_FAULT_UNMARSHALLING_MSG", fault.getElementQName().toString());
                faultObj = new SOAPFaultException(fault);
            }
           
            objContext.setException((Throwable)faultObj);
        } catch (SOAPException se) {
            LOG.log(Level.SEVERE, "SOAP_UNMARSHALLING_FAILURE_MSG", se);
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

        for (StackTraceElement s : cause.getStackTrace()) {
            str.append(s.toString());
            str.append("\n");
        }
       
        SOAPFaultException sfe = createSOAPFaultEx(soapFactory, faultCode, str.toString());
        sfe.initCause(cause);
        return sfe;
    }
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

            sf.setFaultCode(faultCode);
            sf.setFaultString(message);           
        } catch (SOAPException se) {
            se.printStackTrace();           
        }
        return new SOAPFaultException(sf);
    }
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

        try {
            dispImpl.invoke(soapReqMsg);
            fail("Expecting a instance of ProtocolException");
        } catch (ProtocolException pe) {
            assertTrue("Should be instance of SOAPFaultException", pe instanceof SOAPFaultException);
            SOAPFaultException sfe = (SOAPFaultException)pe;
            assertNotNull("Should have a details obj", sfe.getFault());
            assertEquals(
                         new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server"),
                         sfe.getFault().getFaultCodeAsQName());
            assertEquals("Test Exception", sfe.getFault().getFaultString());
        }
        is.close();
    }
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

      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.getFirstChild()!=null) {
          try {
            report =  new DispositionReport(detail.getFirstChild());
          } catch (JAXBException je) {
            log.error("Could not unmarshall detail to a DispositionReport");
View Full Code Here

Examples of javax.xml.ws.soap.SOAPFaultException

  private void serializeProtocolException()
    throws WebServiceException
  {
    if (_protocolException instanceof SOAPFaultException) {
      SOAPFaultException sfe = (SOAPFaultException) _protocolException;
      SOAPFault fault = sfe.getFault();

      try {
        MessageFactory factory = _soapContext.getMessageFactory();
        SOAPMessage message = factory.createMessage();
        message.getSOAPBody().addChildElement(fault);
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.