Search in sources :

Example 6 with PingMeFault

use of org.apache.hello_world_doc_lit.PingMeFault 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)

Example 7 with PingMeFault

use of org.apache.hello_world_doc_lit.PingMeFault in project cxf by apache.

the class JMSClientServerTest method testDocBasicConnection.

@Test
public void testDocBasicConnection() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService2");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort2");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService2 service = new SOAPService2(wsdl, serviceName);
    String response1 = new String("Hello Milestone-");
    String response2 = new String("Bonjour");
    Greeter greeter = service.getPort(portName, Greeter.class);
    Client client = ClientProxy.getClient(greeter);
    client.getEndpoint().getOutInterceptors().add(new TibcoSoapActionInterceptor());
    client.getOutInterceptors().add(new LoggingOutInterceptor());
    client.getInInterceptors().add(new LoggingInInterceptor());
    for (int idx = 0; idx < 5; idx++) {
        greeter.greetMeOneWay("test String");
        String greeting = greeter.greetMe("Milestone-" + idx);
        assertNotNull("no response received from service", greeting);
        String exResponse = response1 + idx;
        assertEquals(exResponse, greeting);
        String reply = greeter.sayHi();
        assertNotNull("no response received from service", reply);
        assertEquals(response2, reply);
        try {
            greeter.pingMe();
            fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            assertNotNull(ex.getFaultInfo());
        }
    }
    ((java.io.Closeable) greeter).close();
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) QName(javax.xml.namespace.QName) Closeable(java.io.Closeable) SOAPService2(org.apache.hello_world_doc_lit.SOAPService2) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) Greeter(org.apache.hello_world_doc_lit.Greeter) TibcoSoapActionInterceptor(org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Client(org.apache.cxf.endpoint.Client) Test(org.junit.Test)

Example 8 with PingMeFault

use of org.apache.hello_world_doc_lit.PingMeFault in project cxf by apache.

the class JMSClientServerTest method docBasicJmsDestinationTest.

@Test
public void docBasicJmsDestinationTest() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService6");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort6");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService2 service = new SOAPService2(wsdl, serviceName);
    Greeter greeter = service.getPort(portName, Greeter.class);
    for (int idx = 0; idx < 5; idx++) {
        greeter.greetMeOneWay("test String");
        String greeting = greeter.greetMe("Milestone-" + idx);
        assertEquals("Hello Milestone-" + idx, greeting);
        String reply = greeter.sayHi();
        assertEquals("Bonjour", reply);
        try {
            greeter.pingMe();
            fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            assertNotNull(ex.getFaultInfo());
        }
    }
    ((java.io.Closeable) greeter).close();
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) QName(javax.xml.namespace.QName) Greeter(org.apache.hello_world_doc_lit.Greeter) Closeable(java.io.Closeable) SOAPService2(org.apache.hello_world_doc_lit.SOAPService2) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Aggregations

PingMeFault (org.apache.hello_world_doc_lit.PingMeFault)8 Test (org.junit.Test)6 URL (java.net.URL)5 QName (javax.xml.namespace.QName)5 Greeter (org.apache.hello_world_doc_lit.Greeter)5 SOAPService2 (org.apache.hello_world_doc_lit.SOAPService2)4 Endpoint (javax.xml.ws.Endpoint)3 FaultDetail (org.apache.hello_world_doc_lit.types.FaultDetail)3 Closeable (java.io.Closeable)2 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 AddressingFeature (javax.xml.ws.soap.AddressingFeature)1 TibcoSoapActionInterceptor (org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor)1 XMLFault (org.apache.cxf.binding.xml.XMLFault)1 Client (org.apache.cxf.endpoint.Client)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1