[英]Wrong SOAP Action header in request. Why?
我正在尝试从CRM插件中连接到MS CRM部署服务(即我无法使用app.config
配置文件)。
问题是用源代码替换“配置魔术”真的很困难。
我正在使用以下配置文件(在控制台应用程序中本地测试):
<client>
<endpoint address="http://server/XRMDeployment/2011/Deployment.svc"
binding="customBinding" bindingConfiguration="CustomBinding_IDeploymentService"
contract="DeploymentService.IDeploymentService" name="CustomBinding_IDeploymentService">
<identity>
<userPrincipalName value="DOMAIN\DYNAMICS_CRM" />
</identity>
</endpoint>
...
</client>
一切都很好,但是当我试图用我正面对的代码替换配置时。 在生成的SOAP消息而不是预期的标头中:
<a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IDeploymentService/Retrieve</a:Action>
我看到一些奇怪的事:
<a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</a:Action>
有谁知道如何覆盖Action Header以及配置中的哪个语句会使WCF魔术变得有效?
我认为你应该使用类似下面的配置
[ServiceContract(Name = "DeploymentService",
Namespace = "http://schemas.microsoft.com/xrm/2011/Contracts/Services/")]
public interface IDeploymentService
{
[OperationContract(Action="uri://<your service URI>/Retrieve")]
void Retrieve();
}
您可以在服务接口类中自定义soap操作,
[ServiceContract]
public interface IMyService
{
[OperationContract(
Action = "MySoapAction" ]
Message ServiceFunction(Message input);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.