Search in sources :

Example 1 with BadRecordLitFault

use of org.apache.intfault.BadRecordLitFault in project cxf by apache.

the class GreeterImpl method testDocLitFault.

public BareDocumentResponse testDocLitFault(String in) throws BadRecordLitFault {
    // System.out.println("Executing testDocLitFault sayHi\n");
    List<Header> headers = new ArrayList<>();
    Header header = null;
    try {
        header = new Header(new QName("http://test", "test"), new String("test"), new JAXBDataBinding(String.class));
    } catch (JAXBException e) {
        e.printStackTrace();
    }
    headers.add(header);
    context.getMessageContext().put(Header.HEADER_LIST, headers);
    throw new BadRecordLitFault("int fault", 5);
}
Also used : BadRecordLitFault(org.apache.intfault.BadRecordLitFault) Header(org.apache.cxf.headers.Header) QName(javax.xml.namespace.QName) JAXBException(javax.xml.bind.JAXBException) ArrayList(java.util.ArrayList) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding)

Example 2 with BadRecordLitFault

use of org.apache.intfault.BadRecordLitFault in project cxf by apache.

the class IntFaultClientServerTest method testBasicConnection.

@Test
public void testBasicConnection() throws Exception {
    URL wsdl = getClass().getResource("/wsdl/hello_world_fault.wsdl");
    assertNotNull("WSDL is null", wsdl);
    SOAPService service = new SOAPService(wsdl, serviceName);
    assertNotNull("Service is null", service);
    Greeter greeter = service.getSoapPort();
    ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
    ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
    updateAddressPort(greeter, PORT);
    try {
        greeter.testDocLitFault("fault");
    } catch (BadRecordLitFault e) {
        assertEquals(5, e.getFaultInfo());
        assertSoapHeader((BindingProvider) greeter);
    }
}
Also used : SOAPService(org.apache.intfault.SOAPService) BadRecordLitFault(org.apache.intfault.BadRecordLitFault) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) Greeter(org.apache.intfault.Greeter) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) BindingProvider(javax.xml.ws.BindingProvider) URL(java.net.URL) Test(org.junit.Test)

Aggregations

BadRecordLitFault (org.apache.intfault.BadRecordLitFault)2 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 JAXBException (javax.xml.bind.JAXBException)1 QName (javax.xml.namespace.QName)1 BindingProvider (javax.xml.ws.BindingProvider)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)1 Header (org.apache.cxf.headers.Header)1 JAXBDataBinding (org.apache.cxf.jaxb.JAXBDataBinding)1 Greeter (org.apache.intfault.Greeter)1 SOAPService (org.apache.intfault.SOAPService)1 Test (org.junit.Test)1