簡體   English   中英

請求中的SOAP Action標頭錯誤。為什么?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM