use of org.apache.axis2.transport.testkit.message.IncomingMessage in project wso2-axis2-transports by wso2.
the class RequestResponseTestClientAdapter method sendMessage.
public IncomingMessage<O> sendMessage(ClientOptions options, ContentType contentType, M message) throws Exception {
IncomingMessage<P> response = target.sendMessage(options, encoder.getContentType(options, contentType), encoder.encode(options, message));
ContentType responseContentType = response.getContentType();
return new IncomingMessage<O>(responseContentType, decoder.decode(responseContentType, response.getData()));
}
use of org.apache.axis2.transport.testkit.message.IncomingMessage in project wso2-axis2-transports by wso2.
the class AxisRequestResponseTestClient method sendMessage.
public IncomingMessage<AxisMessage> sendMessage(ClientOptions options, ContentType contentType, AxisMessage message) throws Exception {
MessageContext responseMsgContext = send(options, message, ServiceClient.ANON_OUT_IN_OP, true, WSDLConstants.MESSAGE_LABEL_IN_VALUE);
Assert.assertFalse(responseMsgContext.isServerSide());
for (MessageContextValidator validator : validators) {
validator.validate(responseMsgContext, true);
}
return new IncomingMessage<AxisMessage>(null, new AxisMessage(responseMsgContext));
}
use of org.apache.axis2.transport.testkit.message.IncomingMessage in project wso2-axis2-transports by wso2.
the class JMSRequestResponseClient method sendMessage.
public IncomingMessage<T> sendMessage(ClientOptions options, ContentType contentType, T message) throws Exception {
String correlationId = doSendMessage(options, contentType, message);
MessageConsumer consumer = replySession.createConsumer(replyDestination, "JMSCorrelationID = '" + correlationId + "'");
try {
Message replyMessage = consumer.receive(8000);
return new IncomingMessage<T>(new ContentType(replyMessage.getStringProperty("Content-Type")), jmsMessageFactory.parseMessage(replyMessage));
} finally {
consumer.close();
}
}
use of org.apache.axis2.transport.testkit.message.IncomingMessage in project wso2-synapse by wso2.
the class VFSRequestResponseClient method sendMessage.
public IncomingMessage<byte[]> sendMessage(ClientOptions options, ContentType contentType, byte[] message) throws Exception {
send(message);
File requestFile = getRequestFile();
if (VFSTestUtils.waitForFileDeletion(requestFile, 5000)) {
return new IncomingMessage<byte[]>(contentType, VFSTestUtils.readFile(replyFile));
} else {
requestFile.delete();
return null;
}
}
use of org.apache.axis2.transport.testkit.message.IncomingMessage in project wso2-axis2-transports by wso2.
the class JettyByteArrayAsyncEndpoint method handle.
@Override
protected IncomingMessage<byte[]> handle(HttpRequest request) throws HttpException, IOException {
byte[] data = IOUtils.toByteArray(request.getInputStream());
logRequest(request, data);
ContentType contentType;
try {
contentType = new ContentType(request.getContentType());
} catch (ParseException ex) {
throw new HttpException(500, "Unparsable Content-Type");
}
return new IncomingMessage<byte[]>(contentType, data);
}
Aggregations