2

我有以下代码,它通过 web 服务调用对 ServiceNow 中的注册用户进行身份验证。

HttpTransportProperties.Authenticator basicAuthentication = new   HttpTransportProperties.Authenticator();
           basicAuthentication.setUsername("username");
           basicAuthentication.setPassword("password");
options.setProperty(
                    org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
                    basicAuthentication);
options.setProperty(
                    org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
                    Boolean.FALSE);

但它不会对用户进行身份验证,而是收到一个异常,上面写着“创建新记录的权限不足”。即使在现在服务的社区页面中也找不到解决方案。我正在使用的代码或 ServiceNow 实例可能有问题吗?任何帮助表示赞赏。

谢谢

注意:除了上面的代码,我什至还有创建事件的代码,这里没有提到。

4

2 回答 2

1

The message you're seeing is not telling you that authentication failed, just that the user as whom you are authenticating lacks sufficient privilege to do what you're trying to do.

The solution depends on the configuration of the instance hosting the direct web service you're consuming. This wiki article overviews all of the potential causes of your insufficient access.

If your user can create records interactively (in the UI), my guess is that your user lacks the special SOAP roles which allow SOAP activity. From the referenced wiki: 5 Web Service User Roles

5 Web Service User Roles

When basic authentication is required for web services, enabling the glide.soap.strict_security property validates the authenticated SOAP user with Contextual Security as well as validates the SOAP action with the user assigned roles. The following roles are available for securing any inbound SOAP requests:

The roles table is here, give yourself the soap role in the ServiceNow instance, and you should be good.

于 2014-05-29T17:05:25.667 回答
0

我在现在的服务社区中也找不到这个问题的答案。最终我不得不开始使用另一个实例。因此,我认为这是现在服务的问题。让这对遇到此问题的任何人都有用。

于 2014-07-15T10:12:32.763 回答