Java 如何修复未经授权的错误401。我在注入凭据后出错
我有一个配置服务端点和安全凭据的单例类(见下文) 它将相同的内容注入到标识头中Java 如何修复未经授权的错误401。我在注入凭据后出错,java,service,xmlhttprequest,http-headers,soapui,Java,Service,Xmlhttprequest,Http Headers,Soapui,我有一个配置服务端点和安全凭据的单例类(见下文) 它将相同的内容注入到标识头中 private RepositoryContent() { ServiceControlHelper.configureEndPoint(contextRegistryControl, "endpoint"); credentials = ServiceControlHelper.configureEndPoint(queryServiceControl, "endpoint");
private RepositoryContent() {
ServiceControlHelper.configureEndPoint(contextRegistryControl, "endpoint");
credentials = ServiceControlHelper.configureEndPoint(queryServiceControl, "endpoint");
ServiceControlHelper.configureEndPoint(objectServiceControl, "endpoint");
}
我在SOAPUI中测试了该服务,当我们添加标头时,它不工作
授权。这与工具有什么关系?我刚刚测试了是否可以使用soap ui连接到端点
private RepositoryContent() {
ServiceControlHelper.configureEndPoint(contextRegistryControl, "endpoint");
credentials = ServiceControlHelper.configureEndPoint(queryServiceControl, "endpoint");
ServiceControlHelper.configureEndPoint(objectServiceControl, "endpoint");
}
RepositoryIdentity[] identities = new RepositoryIdentity[1];
identities[0] = new RepositoryIdentity(credentials.getUsername(), credentials.getPassword(),
resource.getRepository().toString().toLowerCase(), "");
ServiceContext context = new ServiceContext();
context.setIdentities(identities);