简体   繁体   中英

org.apache.cxf.interceptor.Fault: Could not send Message. Caused by: java.io.IOException: IOException invoking Service: Authentication failure

I am getting the following error when I try to call my service

WARNING: Interceptor for {http://schemas.microsoft.com/dynamics/2008/01/services}CustomerService#{http://schemas.microsoft.com/dynamics/2008/01/services}read has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:535)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:465)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:368)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:321)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
    at $Proxy32.read(Unknown Source)
    at com.attunix.axclientcxf.AXTestCustomerService.ReadCustomer(AXTestCustomerService.java:210)
    at com.attunix.axclientcxf.AXTestCustomerService.Read(AXTestCustomerService.java:105)
    at com.attunix.axclientcxf.AXTestCustomerService.Read(AXTestCustomerService.java:116)
    at com.attunix.axclientcxf.TestAXClientCXF.Read(TestAXClientCXF.java:94)
    at com.attunix.axclientcxf.TestAXClientCXF.main(TestAXClientCXF.java:74)
Caused by: java.io.IOException: IOException invoking http://daxuataif1.int.fusionio.com/MicrosoftDynamicsAXAif50/customerservice.svc: Authentication failure
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1431)
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1416)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:649)
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
    ... 13 more
Caused by: java.io.IOException: Authentication failure
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1296)

I verified the username and password and they seem to be correct. I am clueless about why it returns an authentication failure. Any leads would be helpful.Thanks.

Check if the time out is enough for the connection. Set it to 0.

HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(0);
//and or 
policy.setConnectionTimeout(0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM