use of org.apache.axis2.transport.testkit.client.ClientOptions in project carbon-business-process by wso2.
the class AxisServiceUtils method getOperationClient.
public static OperationClient getOperationClient(BPELMessageContext partnerMessageContext, ConfigurationContext clientConfigCtx) throws AxisFault {
AxisService anonymousService = AnonymousServiceFactory.getAnonymousService(partnerMessageContext.getService(), partnerMessageContext.getPort(), clientConfigCtx.getAxisConfiguration(), partnerMessageContext.getCaller());
anonymousService.engageModule(clientConfigCtx.getAxisConfiguration().getModule("UEPModule"));
anonymousService.getParent().addParameter(BPELConstants.HIDDEN_SERVICE_PARAM, "true");
ServiceGroupContext sgc = new ServiceGroupContext(clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);
// get a reference to the DYNAMIC operation of the Anonymous Axis2 service
AxisOperation axisAnonymousOperation = anonymousService.getOperation(partnerMessageContext.isTwoWay() ? ServiceClient.ANON_OUT_IN_OP : ServiceClient.ANON_OUT_ONLY_OP);
Options clientOptions = cloneOptions(partnerMessageContext.getInMessageContext().getOptions());
clientOptions.setExceptionToBeThrownOnSOAPFault(false);
/* This value doesn't overrideend point config. */
clientOptions.setTimeOutInMilliSeconds(60000);
return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
use of org.apache.axis2.transport.testkit.client.ClientOptions in project carbon-business-process by wso2.
the class ServiceUtils method getOperationClient.
private static OperationClient getOperationClient(MessageContext partnerMessageContext, ConfigurationContext clientConfigCtx) throws AxisFault {
AxisService anonymousService = AnonymousServiceFactory.getAnonymousService(Constants.registrationService, Constants.REGISTRATION_PORT, clientConfigCtx.getAxisConfiguration(), Constants.HUMANTASK_COORDINATION_MODULE_NAME);
anonymousService.getParent().addParameter("hiddenService", "true");
ServiceGroupContext sgc = new ServiceGroupContext(clientConfigCtx, (AxisServiceGroup) anonymousService.getParent());
ServiceContext serviceCtx = sgc.getServiceContext(anonymousService);
AxisOperation axisAnonymousOperation = anonymousService.getOperation(ServiceClient.ANON_OUT_IN_OP);
Options clientOptions = cloneOptions(partnerMessageContext.getOptions());
clientOptions.setExceptionToBeThrownOnSOAPFault(false);
/* This value doesn't overrideend point config. */
clientOptions.setTimeOutInMilliSeconds(60000);
return axisAnonymousOperation.createClient(serviceCtx, clientOptions);
}
use of org.apache.axis2.transport.testkit.client.ClientOptions 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.client.ClientOptions in project wso2-axis2-transports by wso2.
the class AxisTestClient method send.
protected MessageContext send(ClientOptions options, AxisMessage message, QName operationQName, boolean block, String resultMessageLabel) throws Exception {
OperationClient mepClient = serviceClient.createClient(operationQName);
MessageContext mc = new MessageContext();
mc.setProperty(Constants.Configuration.MESSAGE_TYPE, message.getMessageType());
mc.setEnvelope(message.getEnvelope());
Attachments attachments = message.getAttachments();
if (attachments != null) {
mc.setAttachmentMap(attachments);
mc.setDoingSwA(true);
mc.setProperty(Constants.Configuration.ENABLE_SWA, true);
}
for (AxisTestClientConfigurator configurator : configurators) {
configurator.setupRequestMessageContext(mc);
}
mc.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, options.getCharset());
mc.setServiceContext(serviceClient.getServiceContext());
if (metrics != null) {
mc.setProperty(BaseConstants.METRICS_COLLECTOR, metrics);
}
mepClient.addMessageContext(mc);
mepClient.execute(block);
// mepClient.complete(mc);
return resultMessageLabel == null ? null : mepClient.getMessageContext(resultMessageLabel);
}
use of org.apache.axis2.transport.testkit.client.ClientOptions 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));
}
Aggregations