use of javax.xml.ws.handler.PortInfo in project Payara by payara.
the class HandlerResolverImpl method getHandlerChain.
public List<Handler> getHandlerChain(PortInfo info) {
Iterator<PortInfo> piSet = chainMap.keySet().iterator();
List<Handler> chain = null;
while (piSet.hasNext()) {
PortInfo next = piSet.next();
PortInfoImpl tmp = new PortInfoImpl(BindingID.parse(info.getBindingID()), info.getPortName(), info.getServiceName());
if (tmp.equals(next)) {
chain = chainMap.get(next);
break;
}
}
if (chain == null) {
chain = new ArrayList<Handler>();
}
return chain;
}
use of javax.xml.ws.handler.PortInfo in project cxf by apache.
the class ServiceImplTest method testHandlerResolver.
@Test
public void testHandlerResolver() {
URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
assertNotNull(wsdl1);
ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
TestHandlerResolver resolver = new TestHandlerResolver();
assertNull(resolver.getPortInfo());
service.setHandlerResolver(resolver);
CalculatorPortType cal = service.getPort(PORT_1, CalculatorPortType.class);
assertNotNull(cal);
PortInfo info = resolver.getPortInfo();
assertNotNull(info);
assertEquals(SERVICE_1, info.getServiceName());
assertEquals(PORT_1, info.getPortName());
assertEquals(SOAPBinding.SOAP12HTTP_BINDING, info.getBindingID());
}
use of javax.xml.ws.handler.PortInfo in project OpenOLAT by OpenOLAT.
the class ViteroManager method checkConnection.
public boolean checkConnection(final String url, final String login, final String password, final int customerId) throws VmsNotAvailableException {
try {
LicenceService ss = new LicenceService();
ss.setHandlerResolver(new HandlerResolver() {
@SuppressWarnings("rawtypes")
@Override
public List<Handler> getHandlerChain(PortInfo portInfo) {
List<Handler> handlerList = new ArrayList<Handler>();
handlerList.add(new ViteroSecurityHandler(login, password));
return handlerList;
}
});
Licence port = ss.getLicenceSoap11();
String endPoint = UriBuilder.fromUri(url).path("services").path("LicenseService").build().toString();
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
GetModulesForCustomerRequest request = new GetModulesForCustomerRequest();
request.setCustomerid(customerId);
Modulestype modulesType = port.getModulesForCustomer(request);
return modulesType != null;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case unsufficientRights:
log.error("Unsufficient rights", f);
break;
default:
logAxisError("Cannot check connection", f);
}
return false;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.warn("Error checking connection", e);
return false;
}
}
use of javax.xml.ws.handler.PortInfo in project cloudstack by apache.
the class VmwareClient method pbmConnect.
private void pbmConnect(String url, String cookieValue) throws Exception {
URI uri = new URI(url);
String pbmurl = "https://" + uri.getHost() + "/pbm";
String[] tokens = cookieValue.split("=");
String extractedCookie = tokens[1];
HandlerResolver soapHandlerResolver = new HandlerResolver() {
@Override
public List<Handler> getHandlerChain(PortInfo portInfo) {
VcenterSessionHandler VcSessionHandler = new VcenterSessionHandler(extractedCookie);
List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.add((Handler) VcSessionHandler);
return handlerChain;
}
};
pbmService.setHandlerResolver(soapHandlerResolver);
pbmSvcInstRef.setType(PBM_SERVICE_INSTANCE_TYPE);
pbmSvcInstRef.setValue(PBM_SERVICE_INSTANCE_VALUE);
pbmPort = pbmService.getPbmPort();
Map<String, Object> pbmCtxt = ((BindingProvider) pbmPort).getRequestContext();
pbmCtxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
pbmCtxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, pbmurl);
}
Aggregations