Examples of SoapFault


Examples of javax.xml.soap.SOAPFault

        inCtx.setInputStream(is);
        try {
            binding.read(inCtx, soapContext);
            fail("Should have received a SOAP FaultException");
        } catch (SOAPFaultException sfe) {
            SOAPFault sf = sfe.getFault();
            assertNotNull("Should have a non null soap fault", sf);
            assertEquals(SOAPConstants.FAULTCODE_VERSIONMISMATCH, sf.getFaultCodeAsQName());
        }
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFault

        assertNotNull(msg);
        Node xmlNode = msg.getSOAPBody();
        assertNotNull(xmlNode);
        assertEquals(1, xmlNode.getChildNodes().getLength());
        assertTrue(msg.getSOAPBody().hasFault());
        SOAPFault fault = msg.getSOAPBody().getFault();
        assertNotNull(fault);
        assertEquals(
                     getExceptionString(ex, exMessage),
                     fault.getFaultString());
        assertTrue(fault.hasChildNodes());
        Detail detail = fault.getDetail();
        assertNotNull(detail);
       
        NodeList list = detail.getChildNodes();
        assertEquals(1, list.getLength());
       
View Full Code Here

Examples of javax.xml.soap.SOAPFault

        Node xmlNode = msg.getSOAPBody();
        assertNotNull(xmlNode);
        assertEquals(1, xmlNode.getChildNodes().getLength());

        assertTrue(msg.getSOAPBody().hasFault());
        SOAPFault fault = msg.getSOAPBody().getFault();
        assertNotNull(fault);
        assertEquals(
                     getExceptionString(se, se.getMessage()),
                     fault.getFaultString());
        assertTrue(fault.hasChildNodes());
        NodeList list = fault.getChildNodes();
        assertEquals(2, list.getLength());        
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFault

        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.soap.SOAPFault

   
    public SOAPFaultDataReader(JAXBDataBindingCallback cb) {
        callback = cb;
    }
    public Object read(QName name, int idx, T input) {
        SOAPFault fault = (SOAPFault)input;
        if (fault.getDetail() != null) {
            NodeList list = fault.getDetail().getChildNodes();

            QName faultName;
            for (int i = 0; i < list.getLength(); i++) {
                Node entry = list.item(i);
                if (entry.getNodeType() != Node.ELEMENT_NODE) {
                    continue;
                }
               
                faultName = new QName(entry.getNamespaceURI(),
                                      entry.getLocalName());
       
                Class<?> clazz = callback.getWebFault(faultName);
                try {
                    if (clazz != null) {
                        Class<?> faultInfo = clazz.getMethod("getFaultInfo").getReturnType();
                        Object obj = JAXBEncoderDecoder.unmarshall(callback.getJAXBContext(),
                                                                   callback.getSchema(),
                                                                   entry,
                                                                   faultName,
                                                                   faultInfo);
                        Constructor<?> ctor = clazz.getConstructor(String.class,
                                                                   obj.getClass());
                        return ctor.newInstance(fault.getFaultString(), obj);
                    }
                } catch (Exception ex) {
                    throw new WebServiceException("error in unmarshal of SOAPFault", ex);
                }
            }
View Full Code Here

Examples of javax.xml.soap.SOAPFault

                        str.append(s.toString());
                        str.append("\n");
                    }
                }

                SOAPFault fault = msg.getSOAPBody().addFault(faultCode, str.toString());

                DataWriter<Detail> writer = callback.createWriter(Detail.class);
                if (writer != null) {
                    writer.write(t, fault.addDetail());
                    if (!fault.getDetail().hasChildNodes()) {
                        fault.removeChild(fault.getDetail());
                    }
                }
            }
        } catch (SOAPException se) {
            LOG.log(Level.SEVERE, "FAULT_MARSHALLING_FAILURE_MSG", se);
View Full Code Here

Examples of javax.xml.soap.SOAPFault

            }

            SOAPMessageContext soapContext = SOAPMessageContext.class.cast(context);
            SOAPMessage soapMessage = soapContext.getMessage();

            SOAPFault fault = soapMessage.getSOAPBody().getFault();
            DataReader<SOAPFault> reader = callback.createReader(SOAPFault.class);

            Object faultObj = null;
            if (null != reader) {
                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) {
View Full Code Here

Examples of javax.xml.soap.SOAPFault

    }
   
    public static SOAPFaultException createSOAPFaultEx(SOAPFactory soapFactory,
                                                       QName faultCode,
                                                       String message) {
        SOAPFault sf = null;
        try {
            sf = soapFactory.createFault();
            sf.setFaultCode(faultCode);
            sf.setFaultString(message);           
        } catch (SOAPException se) {
            se.printStackTrace();           
        }
        return new SOAPFaultException(sf);
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFault

  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

Examples of javax.xml.soap.SOAPFault

        try {
            handlerTest.pingWithArgs("soapHandler3 inbound throw SOAPFaultExceptionWDetail");
            fail("did not get expected SOAPFaultException");
        } catch (SOAPFaultException e) {
            assertEquals("HandleMessage throws exception", e.getMessage());
            SOAPFault fault = e.getFault();
            assertNotNull(fault);
            assertEquals(new QName(SOAPConstants.URI_NS_SOAP_ENVELOPE, "Server"),
                         fault.getFaultCodeAsQName());
            assertEquals("http://gizmos.com/orders", fault.getFaultActor());
           
            Detail detail = fault.getDetail();
            assertNotNull(detail);
           
            QName nn = new QName("http://gizmos.com/orders/", "order");
            Iterator<Element> it = CastUtils.cast(detail.getChildElements(nn));
            assertTrue(it.hasNext());
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.