- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试通过 PHP 访问网络服务。 Web 服务返回一个带有 jpeg 图像的字节数组,然后显示在网页上。
今天服务是通过 C# 调用访问的,就像这样
ImgService i = new ImgService();
凭据设置如下:
i.Credentials = new System.Net.NetworkCredential(username, password, domain);
访问网络服务:
byte[] result = null;
result = i.GetThumbNail(raceId, startNum, seasonId, height, width, true);
Response.ContentType = "image/jpeg";
Response.BinaryWrite(result);
该服务在 C# 中运行良好,但现在我需要通过 PHP 访问它,我得到的唯一图像是“missing.jpg”。我不确定这是否意味着凭据错误或其他问题,但我对凭据部分感到非常不确定。
这是没有任何凭据的 PHP 代码:
$client = new SoapClient("http://www.example.com/imgService.asmx?WSDL");
$result = $client->GetThumbNail($args['race'], $args['startnumber'], $args['year'], 0, 0, true);
$image_data = $result->GetThumbNailResult;
echo '<img src="data:image/jpeg;base64,'.base64_encode($image_data).'">';
我也尝试过这样调用:
$headers = array(
'username' => 'user',
'password' => 'pass',
'domain' => 'domain'
);
$header = new SoapHeader("http://tempuri.org/", 'UserCredentials', $headers, false);
$client->__setSoapHeaders($header);
$result = $client->GetThumbNail(parameters);
两个版本都给我相同的 missing.jpg 并且没有错误消息。如果服务不接受调用,我觉得我会出错?
最佳答案
旧的 web 服务无法解决这个问题,所以我最终创建了一个新的 HttpHandler 来做旧服务所做的同样的事情。好吧……
关于PHP 中的 C# NetworkCredential,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30347769/
我正在编写一些代码来利用第三方组件,当我开始使用它时,我需要提供一个实现ICredentials的对象。 如果我写以下内容... var credential = new NetworkCredent
我将要在我的 C#/WPF 应用程序中创建一个身份验证模块。要验证用户身份,我想使用 NetworkCredential存储凭据。 Credential = new NetworkCredential
在 C# 代码中,我们使用网络身份验证: req = HttpWebRequest.Create(Url) req.Method = "POST" req.Headers.Add(HttpReques
我需要将包含当前模拟用户凭据的 NetworkCredential 对象从 asp.net 应用程序传递到 Web 服务。 我的代码如下所示: WindowsIdentity windowsIdent
虽然我目前正在我们的 Sharepoint 服务器上开发这个 WinForms 应用程序,但我希望完成的程序能够在域上的任何计算机上运行。我正在使用 WSS 网络服务获取我从 Sharepoint 使
我正在尝试使用 HttpClient 为 HTTP Post 或 HTTP Get 编写客户端。在谷歌搜索时,我遇到了在 HttpClient 对象中设置这些身份验证的这些方法。一个使用 Networ
我正在尝试通过 PHP 访问网络服务。 Web 服务返回一个带有 jpeg 图像的字节数组,然后显示在网页上。 今天服务是通过 C# 调用访问的,就像这样 ImgService i = new Img
访问web服务时是否需要设置networkCredential域? var service = new service1.SoapEx(); service.Credentials = new Net
我们很久以前写了一个代码来调用具有域凭据的服务。现在域已更改并计划使用默认 Windows 帐户 所以我正在尝试通过配置重置 asmx 网络服务的网络凭据。我创建了一个 SoapExtentsion
我正在尝试从控制台应用程序调用 Web 服务,我需要为客户端提供 System.Net.NetworkCredential 对象。 是否可以为启动应用程序的用户创建一个 NetworkCredenti
我有一个 WCF 服务,它使用 Windows 身份验证来查看服务契约(Contract),并且服务中的特定方法配置为仅由特定用户 UserX 访问。 [PrincipalPermission(Sec
是否可以将网络凭证(或变体)转换为 PSCredential? 我想透明地使用当前用户的凭据,但不想提示他们。 最佳答案 $cred = new-object PSCredential($nc.Use
这很可能是一个关于 NetworkCredential 类的非常幼稚的问题。请原谅我的经验不足... 我使用用户名、密码和域创建 NetworkCredential。然后我使用 HttpWebRequ
我们如何将 WindowsIdentity 转换为 NetworkCredential?我正在测试我的 WCF 服务以验证匿名调用者是否被阻止。为此,我想做类似的事情: myProxy.ClientC
我喜欢使用 Microsoft.Exchange.WebService API: C# 工作正常 ExchangeService service = new ExchangeService(userD
我有一个带有此代码的 c# .net 客户端: using(WebClient client = new WebClient()) { string serialisedData = "";
我必须实现以下场景:ASP .NET 网络应用程序1.用户登录2. 使用登录用户的凭据,我必须从 Sharepoint 站点下载一些文件; 环境:- 现在 web.config 设置为模拟和 Wind
出于某种原因,我过去使用 DefaultCredentials 工作的 WebClient 应用程序现在给我一个 401 Unauthorized。使用具有完全相同 ID 和 PW 的 Network
我正在使用 asmx 网络服务并且我已经添加了 NetworkCredential: Credentials = new NetworkCredential("Farshad", "HN", "Yaa
我正在尝试使用 NetworkCredential 类通过 ASP.NET 访问网页。但是,我不断收到以下消息的异常 System.Security.Cryptography.Cryptographi
我是一名优秀的程序员,十分优秀!