【发布时间】:2023-05-28 14:43:01
【问题描述】:
我创建了一个包含表、数据/服务合同类以及服务和服务组的测试项目,如下所示:
部署后,我什至可以使用 .Net 控制台应用程序访问和查看 GetEntityList 数据
ServiceReference1.
EntityServiceClient _Client = new ServiceReference1.EntityServiceClient();
ServiceReference1.
CallContext _CallContext = new ServiceReference1.CallContext();
_CallContext.Company =
"dat";
ServiceReference1.
CustomEntityDataContract[] _entityList = _Client.GetEntityList(_CallContext);
// ColorServiceGroup.ColorDC _Dc ;
foreach (ServiceReference1.CustomEntityDataContract _Dc in _entityList)
{
Console.WriteLine(_Dc.EntityName);
}
Console.ReadKey();
问题是我需要使用 SOAP 客户端访问它,尝试创建大量 SOAP 信封消息但无法查看服务数据。 我认为我可能缺少的是 SOAP 标头中正确的身份验证标签,我不知道,请指定。
到目前为止我尝试过的标题是这样的:
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.microsoft.com/dynamics/2008/01/services/EntityService/GetEntityList</a:Action>
<h:CallContext i:nil="true" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://schemas.microsoft.com/dynamics/2010/01/datacontracts" />
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
</s:Header>
<s:Body>
<EntityServiceGetEntityListRequest xmlns="http://tempuri.org" />
</s:Body>
</s:Envelope>
更新: 正如我提到的,我可以使用 .Net 控制台应用程序访问 Web 服务,但是当我执行 Visual Studio 命令行工具 > WCFTestClient > 添加服务时它也不起作用。它不允许在那里添加服务并给出以下错误:
类型或命名空间名称“应用程序”不存在于 命名空间“Microsoft.Dynamics.Ax”(您是否缺少程序集 参考
任何帮助将不胜感激。
【问题讨论】:
-
如果你尝试它会发生什么?你有例外吗?它说什么?
-
用 Firefox SOA 客户端尝试过,它返回的 WSDL 文档与我只点击 url(没有请求正文)得到的相同
-
@MartinDráb 您能否确认所有呼叫都需要身份验证?我没有在控制台应用程序中提供任何身份验证详细信息,它正在工作并返回 ax 表中的实体列表。
标签: wcf axapta soap-client dynamics-ax-2012 aif