We using a generic client to connect different webservices depending on a
configuration. Now we need to connect to a service that requires
authentication by username and password. Can you tell me if it is possible
to connect to this service by putting the username and password to the
headers? Below a code snippet is shown.

Service service = Service.create(SERVICE_NAME);
service.addPort(portName, soapbinding, url);
Dispatch<Source> dispatch = service.createDispatch(portName, Source.class,
Service.Mode.PAYLOAD);

// adding headers to the request
if (MapUtils.isNotEmpty(headers)) {
            final Map<String, Object> requestCtx =
dispatch.getRequestContext();
            requestCtx.putAll(headers);
}

Regars,

Niek Palm

Reply via email to