我是一名Workday SOAP API的新手,现在正试图使用SOAPUI发送SOAP请求进行身份验证。
如有建议,将不胜感激。
我是一名Workday SOAP API的新手,现在正试图使用SOAPUI发送SOAP请求进行身份验证。
如有建议,将不胜感激。
Workday APIs使用WS-Security进行身份验证。
请注意,Workday主机是多租户的。因此,您需要使用WSDL端点连接到正确的服务器,并且用户名字段将包含您的用户名和该服务器上的租户。
SOAP身份验证到Workday的用户名格式:
[user-name]@[tenant-name]
例如:youUserName@tenant6
你的Workday帐户还需要加入到Integration Developer's Group中。
您可能需要调整安全性和权限,以允许访问与Web服务相关的某些功能组和域。
如果您正在使用SoapUI,请执行以下操作:
现在,您可以发出请求了。
不确定您具体指的是什么。您是隐式认证-没有单独的请求。 Workday API文档在这里发布。 您应该阅读它。例如,在.NET解决方案中导入WSDL后,它将为您提供访问各种API类的权限。
例如,要从SSIS脚本任务连接到补偿API,我使用以下内容:
// Instantiate and configure compensation client
CompensationPortClient compClient = // I use custom binding - gives me more control
new CompensationPortClient(CompensationObjectFactory.getWorkdayBinding(),
new EndpointAddress(endpointURL));
compClient.ClientCredentials.UserName.UserName = userName;
compClient.ClientCredentials.UserName.Password = password;
我创建了CompensationObjectFactory来实例化所有客户端API对象,因为这个过程有些公式化。然后,您可以使用客户端对象进行API调用,例如查询一次性奖励:
Request_OneTime_Payment_RequestType request =
CompensationObjectFactory.getOneTimePaymentRequest(
CompensationObjectFactory.getBusinessProcessParameters(),
CompensationObjectFactory.getOneTimePaymentData(
planId, currency, amount, effDt, emplID, positionID));
Request_OneTime_Payment_ResponseType response =
compClient.Request_OneTime_Payment(request);
在安装了Wireshark并强制使用HTTP请求后,我通过调试一个可用的SOAP UI示例终于理解了这个问题!
之前发布的头部示例对我来说不起作用,因为它缺少了一些信息。我进一步发现,几个小时后我捕获的头部有效,并且我提出了一个理论,即Workday忽略除用户名和密码以外的所有内容。所以我测试了以下内容,并且它起作用了:
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="bogus">
<wsse:Username>user@tenant</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">[PASSWORD HERE]</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">bogus</wsse:Nonce>
<wsu:Created>2000-10-02T21:12:28.365Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
祝你好运,如果你正在阅读这篇文章。SOAP是一场彻头彻尾的噩梦!
除了这里已经给出的回答,您还需要在SOAP头中添加您的凭据,如下所示:
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="bogus">
<wsse:Username>[user]@[tenant]</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">[PASSWORD HERE]</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">bogus</wsse:Nonce>
<wsu:Created>2000-10-02T21:12:28.365Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>