Search in sources :

Example 1 with FaultDetail

use of org.apache.hello_world_doc_lit.types.FaultDetail in project cxf by apache.

the class GreeterImplDoc method pingMe.

public void pingMe() throws PingMeFault {
    FaultDetail faultDetail = new FaultDetail();
    faultDetail.setMajor((short) 2);
    faultDetail.setMinor((short) 1);
    throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) FaultDetail(org.apache.hello_world_doc_lit.types.FaultDetail)

Example 2 with FaultDetail

use of org.apache.hello_world_doc_lit.types.FaultDetail in project cxf by apache.

the class GreeterImplDoc method pingMe.

public void pingMe() throws PingMeFault {
    FaultDetail faultDetail = new FaultDetail();
    faultDetail.setMajor((short) 2);
    faultDetail.setMinor((short) 1);
    throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
Also used : FaultDetail(org.apache.hello_world_doc_lit.types.FaultDetail)

Example 3 with FaultDetail

use of org.apache.hello_world_doc_lit.types.FaultDetail in project cxf by apache.

the class MultiTransportGreeter method pingMe.

public void pingMe() throws PingMeFault {
    FaultDetail faultDetail = new FaultDetail();
    faultDetail.setMajor((short) 2);
    faultDetail.setMinor((short) 1);
    throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
Also used : FaultDetail(org.apache.hello_world_doc_lit.types.FaultDetail)

Example 4 with FaultDetail

use of org.apache.hello_world_doc_lit.types.FaultDetail in project cxf by apache.

the class XMLFaultOutInterceptorTest method testFault.

@Test
public void testFault() throws Exception {
    FaultDetail detail = new FaultDetail();
    detail.setMajor((short) 2);
    detail.setMinor((short) 1);
    PingMeFault fault = new PingMeFault("TEST_FAULT", detail);
    XMLFault xmlFault = XMLFault.createFault(new Fault(fault));
    Element el = xmlFault.getOrCreateDetail();
    JAXBContext ctx = JAXBContext.newInstance(FaultDetail.class);
    Marshaller m = ctx.createMarshaller();
    m.marshal(detail, el);
    OutputStream outputStream = new ByteArrayOutputStream();
    xmlMessage.setContent(OutputStream.class, outputStream);
    XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(outputStream);
    xmlMessage.setContent(XMLStreamWriter.class, writer);
    xmlMessage.setContent(Exception.class, xmlFault);
    out.handleMessage(xmlMessage);
    outputStream.flush();
    XMLStreamReader reader = getXMLReader();
    DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
    dxr.nextTag();
    StaxUtils.toNextElement(dxr);
    assertEquals(XMLConstants.NS_XML_FORMAT, dxr.getNamespaceURI());
    assertEquals(XMLFault.XML_FAULT_ROOT, dxr.getLocalName());
    dxr.nextTag();
    StaxUtils.toNextElement(dxr);
    assertEquals(XMLFault.XML_FAULT_STRING, dxr.getLocalName());
    assertEquals(fault.toString(), dxr.getElementText());
    dxr.nextTag();
    StaxUtils.toNextElement(dxr);
    assertEquals(XMLFault.XML_FAULT_DETAIL, dxr.getLocalName());
    dxr.nextTag();
    StaxUtils.toNextElement(dxr);
    assertEquals("faultDetail", dxr.getLocalName());
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) Marshaller(javax.xml.bind.Marshaller) XMLStreamReader(javax.xml.stream.XMLStreamReader) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) XMLFault(org.apache.cxf.binding.xml.XMLFault) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) FaultDetail(org.apache.hello_world_doc_lit.types.FaultDetail) Element(org.w3c.dom.Element) OutputStream(java.io.OutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) XMLFault(org.apache.cxf.binding.xml.XMLFault) Fault(org.apache.cxf.interceptor.Fault) PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) JAXBContext(javax.xml.bind.JAXBContext) ByteArrayOutputStream(java.io.ByteArrayOutputStream) DepthXMLStreamReader(org.apache.cxf.staxutils.DepthXMLStreamReader) Test(org.junit.Test)

Example 5 with FaultDetail

use of org.apache.hello_world_doc_lit.types.FaultDetail in project cxf by apache.

the class GreeterImplDocBase method pingMe.

public void pingMe() throws PingMeFault {
    FaultDetail faultDetail = new FaultDetail();
    faultDetail.setMajor((short) 2);
    faultDetail.setMinor((short) 1);
    throw new PingMeFault("PingMeFault raised by server", faultDetail);
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) FaultDetail(org.apache.hello_world_doc_lit.types.FaultDetail)

Aggregations

FaultDetail (org.apache.hello_world_doc_lit.types.FaultDetail)5 PingMeFault (org.apache.hello_world_doc_lit.PingMeFault)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 OutputStream (java.io.OutputStream)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 XMLFault (org.apache.cxf.binding.xml.XMLFault)1 Fault (org.apache.cxf.interceptor.Fault)1 DepthXMLStreamReader (org.apache.cxf.staxutils.DepthXMLStreamReader)1 Test (org.junit.Test)1 Element (org.w3c.dom.Element)1