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

The following examples show how to use org.apache.cxf.phase.Phase#MARSHAL . 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
Source File: JAXWSEnvironmentTest.java    From dropwizard-jaxws with Apache License 2.0 5 votes vote down vote up
@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
Source File: XMLFaultOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public XMLFaultOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 3
Source File: JAXWSEnvironmentTest.java    From dropwizard-jaxws with Apache License 2.0 4 votes vote down vote up
@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));
}
 
Example 4
Source File: CustomHandler.java    From tomee with Apache License 2.0 4 votes vote down vote up
public CustomHandler() {
    super(Phase.MARSHAL);
    addBefore(JAXRSOutInterceptor.class.getName());
}
 
Example 5
Source File: WrappedOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public WrappedOutInterceptor() {
    this(Phase.MARSHAL);
}
 
Example 6
Source File: BareOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public BareOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 7
Source File: RPCOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public RPCOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 8
Source File: Soap11FaultOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
Soap11FaultOutInterceptorInternal() {
    super(Phase.MARSHAL);
}
 
Example 9
Source File: Soap12FaultOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
Soap12FaultOutInterceptorInternal() {
    super(Phase.MARSHAL);
}
 
Example 10
Source File: XMLMessageOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public XMLMessageOutInterceptor() {
    this(Phase.MARSHAL);
}
 
Example 11
Source File: SonosFaultInterceptor.java    From airsonic-advanced with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor, setting the phase to Marshal. This happens before the default Fault Interceptor
 */
public SonosFaultInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 12
Source File: CorbaStreamFaultOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public CorbaStreamFaultOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 13
Source File: ProtobufMessageOutInterceptor.java    From fuchsia with Apache License 2.0 4 votes vote down vote up
/**
 *
 */
public ProtobufMessageOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 14
Source File: JAXRSOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public JAXRSOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 15
Source File: JAXRSDefaultFaultOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public JAXRSDefaultFaultOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 16
Source File: CustomOutInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public CustomOutInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 17
Source File: CommonInterceptor.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CommonInterceptor() {
   super(Phase.MARSHAL);
}
 
Example 18
Source File: AllowOriginProvider.java    From openmeetings with Apache License 2.0 4 votes vote down vote up
public AllowOriginProvider() {
	super(Phase.MARSHAL);
}
 
Example 19
Source File: SonosFaultInterceptor.java    From subsonic with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor, setting the phase to Marshal.  This happens before the default Fault Interceptor
 */
public SonosFaultInterceptor() {
    super(Phase.MARSHAL);
}
 
Example 20
Source File: SonosFaultInterceptor.java    From airsonic with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor, setting the phase to Marshal.  This happens before the default Fault Interceptor
 */
public SonosFaultInterceptor() {
    super(Phase.MARSHAL);
}