I have a webservice client generated from SoapUI and Apache CXF component. When I run it at Mule ESB server I receive the following error:
org.mule.transport.http.HttpClientMessageDispatcher - Received a redirect, but followRedirects=false. Response code: 401 Unauthorized
The interesting fact here is that when I run it locally from Anypoint Studio everything works fine. How can I allow my service client to handle redirections. Is there any other error?
Here is my code:
URL wsdlURL = MPServiceService.WSDL_LOCATION;
MPServiceService ss = new MPServiceService(wsdlURL, SERVICE_NAME);
MPService port = ss.getDomino();
BindingProvider prov = (BindingProvider) port;
prov.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
requestpath);
prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username);
prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
String result = port.webServiceFoo();
return result;
The probem was caused by another application which had the following cxf config:
<cxf:configuration name="CXF_Configuration" initializeStaticBusInstance="true" enableMuleSoapHeaders="false" doc:name="CXF Configuration"/>
We have changed initializeStaticBusInstance="false" so it looks like this:
<cxf:configuration name="CXF_Configuration" initializeStaticBusInstance="false" enableMuleSoapHeaders="false" doc:name="CXF Configuration"/>