Java – preemptive authentication why

Why do I need preemptive authentication?

System. setProperty(“httpclient.authentication.preemptive”,“true”);

I wrote a web service access client program in Java We set the location of user name and password in the calling object, and it works normally

Recently, our service provider made some changes around them. After that, they didn't receive the user name & password in the web service call. Because they didn't receive the user name & passwod, we couldn't connect to their (provider) service

Then I did a Google search and found the preemptive certification When invoking the web service, we set "httpclient. Authentication. Preemptive" to "true" – system setProperty(“httpclient.authentication.preemptive”,“true”);, Then we can receive a reply from the service provider

When we delete system setProperty(“httpclient.authentication.preemptive”,“true”); Then we can't connect to their service

Solution

When we are in client config When changing transport pivot = "Java: org. Apache. Axis. Transport. Http. Httpsender" to transport pivot = "Java: org. Apache. Axis. Transport. Http. Commonshtpsender" in wsdd file There is no need to set system Setproperty ("httpclient. Authentication. Preemptive", "true") can solve this problem

client-config. wsdd –

<?xml version="1.0" encoding="UTF-8"?> 
<deployment 
    name="commonsHTTPConfig" 
    xmlns="http://xml.apache.org/axis/wsdd/" 
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

  <!-- use CommonsHTTPSender instead of the default HTTPSender -->
  <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender" />  

  <transport name="local" pivot = "java:org.apache.axis.transport.local.LocalSender" /> 
  <transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender" /> 
</deployment>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>