gpt4 book ai didi

web-services - 如何在 Web 服务调用中输入凭据(授权对象)?

转载 作者:太空宇宙 更新时间:2023-11-03 20:08:50 26 4
gpt4 key购买 nike

我听从了建议 provided here它就像一个魅力。现在,我正在连接到服务器并调用名为 GetFunctionalityTest 的方法。它的唯一输入是一个字符串,可以在 GetFunctionalityTest.m 文件中看到。到目前为止一切顺利。

然后我尝试调用名为 GetSections 的真实服务,根据文件 GetSections.m 其签名如下。

function GetSectionsResult = GetSections(obj,auth)
% GetSections(obj,auth)
% Input: auth = (Authorize)
% Output: GetSectionsResult = (ArrayOfString)

values = { auth, };
names = { 'auth', };
types = { '{WSPro.HostingWebservice}Authorize', };

soapMessage = createSoapMessage( ...
'WSPro.HostingWebservice', ...
'GetSections', values,names,types,'document');
response = callSoapService( obj.endpoint, ...
'WSPro.HostingWebservice/GetSections', soapMessage);
GetSectionsResult = parseSoapResponse(response);

服务器提供的定义如下。

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=...>
<soap:Body>
<GetSections xmlns="WSPro.HostingWebservice">
<auth>
<uid>string</uid>
<pw>string</pw>
</auth>
</GetSections>
</soap:Body>
</soap:Envelope>

我的问题是我无法在语法方面指定授权。据我所知,它应该由两个字符串以某种方式组成,但我还没有让它工作。我尝试将它们组合如下。

myAuthorization = ['user', 'pass'];
myAuthorization = {'user', 'pass'};
myAuthorization = ['user' 'pass'];
myAuthorization = {'user' 'pass'};

没有任何帮助。我刚收到一堆错误。

Error using callSoapService (line 147)
Unspecified Fault: SOAP Fault: Server was unable to process request.
---> The parameterized query
'(@uid nvarchar(99)) SELECT PassW FROM UserData WHERE UserId = @' expects the parameter '@uid', which was not supplied.

我浏览了所有自动为我创建的文件,没有Authorize 而非ArrayOfString 的定义。我猜这是服务器定义的东西,因为我没有找到 MatLab 文档中的内容。

  1. 如何指定授权凭据?
  2. 我在哪里可以查看 MatLab 如何映射授权

最佳答案

如上所述:

The SOAP Authentication happens through SOAP Header and not SOAP Body.This link might give you an idea of how SOAP XML should look in case of authentication :

Web service soap header authentication

关于web-services - 如何在 Web 服务调用中输入凭据(授权对象)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14848470/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com