我遵循了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'};
没有任何帮助。我刚收到一堆错误。
使用callSoapService时出错(第147行)
未指定的错误:SOAP Fault:服务器无法处理请求 ---&GT;参数化查询
'(@uid nvarchar(99))SELECT PassW FROM UserData WHERE UserId = @'需要参数'@uid',这是未提供的。
我浏览了自动为我创建的所有文件,并且没有授权而不是 ArrayOfString 的定义。我猜它是服务器定义的东西,因为我在MatLab文档中没有点击。
答案 0 :(得分:0)
如上所述:
SOAP身份验证通过SOAP Header而不是SOAP Body进行。这个链接可能会让您了解SOAP XML在身份验证时的外观: