Java Code Examples for org.apache.cxf.phase.Phase#MARSHAL

The following examples show how to use org.apache.cxf.phase.Phase#MARSHAL . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Test
public void publishEndpointWithCxfInterceptors() throws Exception {

    TestInterceptor inInterceptor = new TestInterceptor(Phase.UNMARSHAL);
    TestInterceptor inInterceptor2 = new TestInterceptor(Phase.PRE_INVOKE);
    TestInterceptor outInterceptor = new TestInterceptor(Phase.MARSHAL);

    jaxwsEnvironment.publishEndpoint(
            new EndpointBuilder("local://path", service)
                    .cxfInInterceptors(inInterceptor, inInterceptor2)
                    .cxfOutInterceptors(outInterceptor));

    verify(mockInvokerBuilder).create(any(), any(Invoker.class));

    Node soapResponse = testutils.invoke("local://path",
            LocalTransportFactory.TRANSPORT_ID, soapRequest.getBytes());

    verify(mockInvoker).invoke(any(Exchange.class), any());
    assertThat(inInterceptor.getInvocationCount(), equalTo(1));
    assertThat(inInterceptor2.getInvocationCount(), equalTo(1));
    assertThat(outInterceptor.getInvocationCount(), equalTo(1));

    testutils.assertValid("/soap:Envelope/soap:Body/a:fooResponse", soapResponse);

    soapResponse = testutils.invoke("local://path",
            LocalTransportFactory.TRANSPORT_ID, soapRequest.getBytes());

    verify(mockInvoker, times(2)).invoke(any(Exchange.class), any());
    assertThat(inInterceptor.getInvocationCount(), equalTo(2));
    assertThat(inInterceptor2.getInvocationCount(), equalTo(2));
    assertThat(outInterceptor.getInvocationCount(), equalTo(2));

    testutils.assertValid("/soap:Envelope/soap:Body/a:fooResponse", soapResponse);
}
 
Example 2
/**
 * Constructor, setting the phase to Marshal. This happens before the default Fault Interceptor
 */
public SonosFaultInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 3
/**
 * Constructor, setting the phase to Marshal.  This happens before the default Fault Interceptor
 */
public SonosFaultInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 4
/**
 * Constructor, setting the phase to Marshal.  This happens before the default Fault Interceptor
 */
public SonosFaultInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 5
public AllowOriginProvider() {
	super(Phase.MARSHAL);
}
 
Example 6
public CommonInterceptor() {
   super(Phase.MARSHAL);
}
 
Example 7
Source Project: cxf   File: CustomOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public CustomOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 8
public JAXRSDefaultFaultOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 9
Source Project: cxf   File: JAXRSOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public JAXRSOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 10
/**
 *
 */
public ProtobufMessageOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 11
public CorbaStreamFaultOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 12
Source Project: cxf   File: XMLFaultOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public XMLFaultOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 13
Source Project: cxf   File: XMLMessageOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public XMLMessageOutInterceptor() {
    this(Phase.MARSHAL);
}
 
Example 14
Source Project: cxf   File: Soap12FaultOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
Soap12FaultOutInterceptorInternal() {
    super(Phase.MARSHAL);
}
 
Example 15
Source Project: cxf   File: Soap11FaultOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
Soap11FaultOutInterceptorInternal() {
    super(Phase.MARSHAL);
}
 
Example 16
Source Project: cxf   File: RPCOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public RPCOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 17
Source Project: cxf   File: BareOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public BareOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 18
Source Project: cxf   File: WrappedOutInterceptor.java    License: Apache License 2.0 4 votes vote down vote up
public WrappedOutInterceptor() {
    this(Phase.MARSHAL);
}
 
Example 19
Source Project: tomee   File: CustomHandler.java    License: Apache License 2.0 4 votes vote down vote up
public CustomHandler() {
    super(Phase.MARSHAL);
    addBefore(JAXRSOutInterceptor.class.getName());
}
 
Example 20
@Test
public void getClient() {

    String address = "http://address";
    Handler handler = mock(Handler.class);

    // simple
    DummyInterface clientProxy = jaxwsEnvironment.getClient(
            new ClientBuilder<>(DummyInterface.class, address)
    );
    assertThat(clientProxy, is(instanceOf(Proxy.class)));

    Client c = ClientProxy.getClient(clientProxy);
    assertThat(c.getEndpoint().getEndpointInfo().getAddress(), equalTo(address));
    assertThat(c.getEndpoint().getService().get("endpoint.class").equals(DummyInterface.class), equalTo(true));
    assertThat(((BindingProvider)clientProxy).getBinding() .getHandlerChain().size(), equalTo(0));

    HTTPClientPolicy httpclient = ((HTTPConduit)c.getConduit()).getClient();
    assertThat(httpclient.getConnectionTimeout(), equalTo(500L));
    assertThat(httpclient.getReceiveTimeout(), equalTo(2000L));

    // with timeouts, handlers, interceptors, properties and MTOM

    TestInterceptor inInterceptor = new TestInterceptor(Phase.UNMARSHAL);
    TestInterceptor inInterceptor2 = new TestInterceptor(Phase.PRE_INVOKE);
    TestInterceptor outInterceptor = new TestInterceptor(Phase.MARSHAL);

    clientProxy = jaxwsEnvironment.getClient(
            new ClientBuilder<>(DummyInterface.class, address)
                    .connectTimeout(123)
                    .receiveTimeout(456)
                    .handlers(handler)
                    .bindingId(SoapBindingFactory.SOAP_12_BINDING)
                    .cxfInInterceptors(inInterceptor, inInterceptor2)
                    .cxfOutInterceptors(outInterceptor)
                    .enableMtom());
    c = ClientProxy.getClient(clientProxy);
    assertThat(((BindingProvider) clientProxy).getBinding().getBindingID(), equalTo("http://www.w3.org/2003/05/soap/bindings/HTTP/"));
    assertThat(c.getEndpoint().getEndpointInfo().getAddress(), equalTo(address));
    assertThat(c.getEndpoint().getService().get("endpoint.class").equals(DummyInterface.class), equalTo(true));

    httpclient = ((HTTPConduit)c.getConduit()).getClient();
    assertThat(httpclient.getConnectionTimeout(), equalTo(123L));
    assertThat(httpclient.getReceiveTimeout(), equalTo(456L));

    assertThat(((BindingProvider)clientProxy).getBinding().getHandlerChain(), contains(handler));

    BindingProvider bp = (BindingProvider)clientProxy;
    SOAPBinding binding = (SOAPBinding)bp.getBinding();
    assertThat(binding.isMTOMEnabled(), equalTo(true));
}