dispatch = (Dispatch<T>) new BinaryDispatch(endpoint);
} else {
//TODO: cache service/port/dispatch instances?
Bus bus = BusFactory.getThreadDefaultBus();
BusFactory.setThreadDefaultBus(mcf.getBus());
Service svc;
try {
svc = Service.create(svcQname);
} finally {
BusFactory.setThreadDefaultBus(bus);
}
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_WS, MessageLevel.DETAIL)) {
LogManager.logDetail(LogConstants.CTX_WS, "Creating a dispatch with endpoint", endpoint); //$NON-NLS-1$
}
svc.addPort(mcf.getPortQName(), binding, endpoint);
dispatch = svc.createDispatch(mcf.getPortQName(), type, mode);
if (mcf.getSecurityType() == WSManagedConnectionFactory.SecurityType.WSSecurity
&& mcf.getOutInterceptors() != null) {
Client client = ((DispatchImpl)dispatch).getClient();
Endpoint ep = client.getEndpoint();