C# 这个PHP web服务调用的.NET等价物是什么?

C# 这个PHP web服务调用的.NET等价物是什么?,c#,php,web-services,wcf,service-reference,C#,Php,Web Services,Wcf,Service Reference,我正在尝试使用API,提供商只能提供一个PHP示例,我总结如下(删除敏感数据): 代码执行时不会抛出异常,但响应为null。如果我将用户名或密码更改为无效,我会得到一个异常,表明凭据方面的工作正常 如果有人能给我指出正确的方向,我将不胜感激 进一步的信息,如果我把它作为一个网络参考,它会起作用,这让我现在开始行动,尽管我仍然想知道如何在第一时间让它起作用。使用web引用的代码: WebReference.customerV4Service svc = new WebReference.custo

我正在尝试使用API,提供商只能提供一个PHP示例,我总结如下(删除敏感数据):

代码执行时不会抛出异常,但响应为null。如果我将用户名或密码更改为无效,我会得到一个异常,表明凭据方面的工作正常

如果有人能给我指出正确的方向,我将不胜感激

进一步的信息,如果我把它作为一个网络参考,它会起作用,这让我现在开始行动,尽管我仍然想知道如何在第一时间让它起作用。使用web引用的代码:

WebReference.customerV4Service svc = new WebReference.customerV4Service();
svc.Credentials = new System.Net.NetworkCredential("myusername", "mypassword");
WebReference.GetDataResponse resp = svc.getData(new string[] { "12345" });

这是什么
API.portClient
?这是visual studio在我添加服务引用时生成的代理客户端我不明白它为什么会关闭。这是什么
API.portClient
?这是visual studio在我添加服务引用时生成的代理客户端我不明白它为什么会关闭
<system.serviceModel>
    <bindings>
      <basicHttpBinding>
            <binding name="mybinding">
              <security mode="Transport">
                <transport clientCredentialType="Basic"/>                  
              </security>

            </binding>
            <binding name="mybinding1" />
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://supplierurl/ws"
            binding="basicHttpBinding" bindingConfiguration="mybinding"
            contract="API.portType" name="API.port" />
    </client>
</system.serviceModel>
API.portClient client = new API.portClient();           
client.ClientCredentials.UserName.UserName = "myusername";
client.ClientCredentials.UserName.Password = "mypassword";
API.GetDataResponse response = client.getData(new string[] { "12345" });
WebReference.customerV4Service svc = new WebReference.customerV4Service();
svc.Credentials = new System.Net.NetworkCredential("myusername", "mypassword");
WebReference.GetDataResponse resp = svc.getData(new string[] { "12345" });