I am using CXF and the wsdl2java tool to generate the classes. The process
works nicely.
However the services are protected by basic authentication and unfortunately
its a customer requirement.
The wsdls are not protected by basic authentication.
What I would like to do is pass in credentials in my bindings.xml file for
the client to use for all connections . However I am unable to find a
method to do this.
I debated adding the credentials as follows
@Autowired
com.myClass.gen.myCodePort remote
@RequestMapping(value=/test)
public String getResult(){
// Cast the proxy to a BindingProvider
BindingProvider portMod= (BindingProvider) remote;
portMod.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "un");
portMod.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pw");
String myResult = remote.getServerStatus();
}
however this resulted in continued "Cannot retry due to server
authentication, in retry mode" errors.
When I review the logs of the web server that is hosting the service, I see
one request with credentials and 1 without . I cannot find where the
un-credentialed second request is coming from but it has the same target as
the first ( which is accepted ) .
Since I have many services that I need to generate from ( one of the reasons
I chose CXF ) i would really rather not manually edit the generated code (
even if that was a good idea ) .
so I need a method to add the credentials to the service at generation time
.
Anyone have any suggestions ? Does CXF support such a thing ?
thanks
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-with-basic-authentication-with-wsdl2java-tp4452439p4452439.html
Sent from the cxf-user mailing list archive at Nabble.com.