0

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

Mule Flow looks like this:
flow scheme

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;
4

2 回答 2

0

It seems your error comes from the Mule app your URL is serving, not from the code above. When hitting your webservice, the Mule made a request inside a flow - most likely using the http:request or http:outbound-endpoint component - which caused an error, and this error is being returned by your web service.

Your Mule app is the problem, not the Java code above. See can Mule HTTP out-bound handler redirect requests? for how to solve your Mule issue.

于 2017-11-03T09:28:31.273 回答
0

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"/>

More info https://support.mulesoft.com/s/article/There-are-at-least-2-connectors-matching-protocol-https-when-using-CXF-generated-client

于 2017-12-06T14:07:47.643 回答