Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用C语言进行workdayweb服务身份验证#_C#_Web Services_Soap_Workday Api - Fatal编程技术网

C# 使用C语言进行workdayweb服务身份验证#

C# 使用C语言进行workdayweb服务身份验证#,c#,web-services,soap,workday-api,C#,Web Services,Soap,Workday Api,我希望使用Workday WebService v30.0 我试图复制一个例子 我不断收到“无效的用户名和密码”。我知道用户名和密码是正确的,因为它在SOAPUI中工作 这是我的密码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using GetWor

我希望使用Workday WebService v30.0

我试图复制一个例子 我不断收到“无效的用户名和密码”。我知道用户名和密码是正确的,因为它在SOAPUI中工作

这是我的密码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;

using GetWorkerSample.HumanResources;

namespace GetWorkerSample
{
    class Program
    {
        static void Main(string[] args)
        {
            //Instantiate an instance of WCF generated proxy and set the Endpoint
            Human_ResourcesPortClient hr = new Human_ResourcesPortClient();
            hr.Endpoint.Address = new EndpointAddress(args[0]);


            //Configure Port
            hr.ClientCredentials.UserName.UserName = "user@tenant";
            hr.ClientCredentials.UserName.Password = "password";

            //Instantiate Header for the request
            //Confiure Header
            Workday_Common_HeaderType header = new Workday_Common_HeaderType();
            header.Include_Reference_Descriptors_In_Response = false;
            header.Include_Reference_Descriptors_In_ResponseSpecified = false;


            //Setting up filter to get data for 5 workers
            //Response Filter
            Response_FilterType responseFilter = new Response_FilterType();
            responseFilter.Count = 5;
            responseFilter.Page = 1;
            responseFilter.PageSpecified = true;
            responseFilter.CountSpecified = true;


            //Configure Criteria
            Worker_Request_CriteriaType requestCriteria = new Worker_Request_CriteriaType();
            requestCriteria.Exclude_Inactive_Workers = true;
            requestCriteria.Exclude_Inactive_WorkersSpecified = true;


            // Formating response to contain Personal information, Employment information and Compensation
            //Configure Response Group
            Worker_Response_GroupType responseGroup = new Worker_Response_GroupType();
            responseGroup.Include_Reference = true;
            responseGroup.Include_Personal_Information = true;
            responseGroup.Include_Compensation = true;
            responseGroup.Include_Employment_Information = true;
            responseGroup.Include_ReferenceSpecified = true;
            responseGroup.Include_Personal_InformationSpecified = true;
            responseGroup.Include_CompensationSpecified = true;
            responseGroup.Include_Employment_InformationSpecified = true;
            responseGroup.Include_Organizations = true;
            responseGroup.Include_OrganizationsSpecified = true;

            //updating preferences for the request
            //Configure Request
            Get_Workers_RequestType request = new Get_Workers_RequestType();
            request.Request_Criteria = requestCriteria;
            request.Response_Filter = responseFilter;
            request.Response_Group = responseGroup;
            request.version = "v30.0";

            //Invoke HR getworker api via Proxy
            try
            {
                var Testtworker = hr.Get_Workers(header, request).Response_Data;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.Read();

        }
    }
}
hr.Get\u工作人员失败,错误为:

堆栈跟踪是

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at GetWorkerSample.HumanResources.Human_ResourcesPort.Get_Workers(Get_WorkersInput request)
   at GetWorkerSample.HumanResources.Human_ResourcesPortClient.GetWorkerSample.HumanResources.Human_ResourcesPort.Get_Workers(Get_WorkersInput request) in C:\temp\Projects\WorkDayProjects\GetWorkerSample\GetWorkerSample\GetWorkerSample\Service References\HumanResources\Reference.cs:line 136983
   at GetWorkerSample.HumanResources.Human_ResourcesPortClient.Get_Workers(Workday_Common_HeaderType Workday_Common_Header, Get_Workers_RequestType Get_Workers_Request) in C:\temp\Projects\WorkDayProjects\GetWorkerSample\GetWorkerSample\GetWorkerSample\Service References\HumanResources\Reference.cs:line 136990
   at GetWorkerSample.Program.Main(String[] args) in C:\temp\Projects\WorkDayProjects\GetWorkerSample\GetWorkerSample\GetWorkerSample\GetWorkerSample.cs:line 93

有什么想法或建议吗?谢谢大家。

我不得不将CustomBinding与authenticationMode=“UserNameOverTransport”一起使用,我不再有身份验证问题

(如果任何人在Workday API中遇到相同问题,请发布此消息)


我必须将CustomBinding与authenticationMode=“UserNameOverTransport”一起使用,我不再有身份验证问题

(如果任何人在Workday API中遇到相同问题,请发布此消息)


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
    <system.serviceModel>
      <bindings>
        <customBinding>
          <binding name="customHRBinding" sendTimeout="00:05:00" receiveTimeout="00:05:00">
            <security enableUnsecuredResponse="true" authenticationMode="UserNameOverTransport" />
            <textMessageEncoding messageVersion="Soap11" />
            <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
          </binding>
        </customBinding>
      </bindings>
        <client>
            <endpoint address="https://wd2-impl-services1.workday.com/ccx/service/tenant7/Human_Resources/v30.0"
                binding="customBinding" bindingConfiguration="customHRBinding"
                contract="HumanResources.Human_ResourcesPort" name="Human_Resources" />
        </client>
    </system.serviceModel>
</configuration>