use of org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SetHeaderResponse in project scout.rt by eclipse.
the class AbstractJaxWsClientTest method testSamePortMultipleTimesSetHeader.
@Test
public void testSamePortMultipleTimesSetHeader() {
JaxWsConsumerTestServicePortType port = BEANS.get(JaxWsConsumerTestClient.class).newInvocationContext().getPort();
// 1. invoke echo without header
EchoRequest echoReq = new EchoRequest();
echoReq.setMessage("test message");
port.echo(echoReq);
assertHttpResponseHeader(port, X_SCOUT_JAX_WS_TEST_HEADER, null);
// 2. set header
final String expectedHeader = "test header value";
SetHeaderRequest req = new SetHeaderRequest();
req.setHeaderName(X_SCOUT_JAX_WS_TEST_HEADER);
req.setHeaderValue(expectedHeader);
SetHeaderResponse resp = port.setHeader(req);
assertNotNull(resp);
assertEquals("ok", resp.getMessage());
assertHttpResponseHeader(port, X_SCOUT_JAX_WS_TEST_HEADER, expectedHeader);
// 3. invoke echo without header
echoReq.setMessage("test message");
port.echo(echoReq);
assertHttpResponseHeader(port, X_SCOUT_JAX_WS_TEST_HEADER, null);
}
use of org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SetHeaderResponse in project scout.rt by eclipse.
the class AbstractJaxWsClientTest method testSetupSetHeader.
@Test
public void testSetupSetHeader() {
final String expectedHeader = "test header value";
SetHeaderRequest req = new SetHeaderRequest();
req.setHeaderName(X_SCOUT_JAX_WS_TEST_HEADER);
req.setHeaderValue(expectedHeader);
JaxWsConsumerTestServicePortType port = BEANS.get(JaxWsConsumerTestClient.class).newInvocationContext().getPort();
SetHeaderResponse resp = port.setHeader(req);
assertNotNull(resp);
assertEquals("ok", resp.getMessage());
assertHttpResponseHeader(port, X_SCOUT_JAX_WS_TEST_HEADER, expectedHeader);
}
use of org.eclipse.scout.jaxws.consumer.jaxwsconsumertestservice.SetHeaderResponse in project scout.rt by eclipse.
the class JaxWsConsumerTestServiceProvider method setHeader.
@Override
public SetHeaderResponse setHeader(SetHeaderRequest parameters) {
Assertions.assertNotNull(parameters);
final String headerName = parameters.getHeaderName();
final String headerValue = parameters.getHeaderValue();
LOG.info("set header ['{}'='{}']", headerName, headerValue);
@SuppressWarnings("unchecked") Map<String, List<String>> httpResonseHeaderMap = (Map<String, List<String>>) m_wsCtx.getMessageContext().get(MessageContext.HTTP_RESPONSE_HEADERS);
if (httpResonseHeaderMap == null) {
httpResonseHeaderMap = new HashMap<>();
m_wsCtx.getMessageContext().put(MessageContext.HTTP_RESPONSE_HEADERS, httpResonseHeaderMap);
}
httpResonseHeaderMap.put(headerName, CollectionUtility.arrayList(headerValue));
SetHeaderResponse resp = new SetHeaderResponse();
resp.setMessage("ok");
return resp;
}
Aggregations