10

I'm trying connecting to the MS CRM Deployment Service from within CRM plugin (i.e. I don't have ability to use app.config configuration file).

The issue is it's really difficult to replace 'configuration magic' with source code.

While I'm using following configuration file (testing locally in console application):

<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>

Everything is fine, but when I'm trying to replace configuration with code I'm facing with following. In resulting SOAP message instead of expected header:

<a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IDeploymentService/Retrieve</a:Action>

I see something strange:

<a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</a:Action>

Does anybody knows how can I override Action Header and which statement in configuration turns WCF magic making everything work?

shytikov
  • 9,155
  • 8
  • 56
  • 103
  • [RST/SCT is about secure conversation](http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/ws-secureconversation-1.3-os.html#_Toc162064066). I am guessing your are being challenged to provide credentials or token. – Petar Vučetin Feb 25 '14 at 18:45
  • If you're just attempting to access settings that you'd normally put in the config file, why not create a new ConfigSettings entity within CRM and read your settings from there? – Daryl Feb 25 '14 at 21:45
  • I don't have direct access to CRM installation... – shytikov Feb 26 '14 at 06:31
  • This is caused by a mismatch in configuration. Please post your binding from xml, and the C# you wrote to replace it. I would recommend posting the entirety of the `System.ServiceModel` section of the `app.config` file. – Mitch Mar 25 '14 at 16:06

2 Answers2

1

I think you should use something like following configuration

[ServiceContract(Name = "DeploymentService",
    Namespace = "http://schemas.microsoft.com/xrm/2011/Contracts/Services/")]
public interface IDeploymentService
{
    [OperationContract(Action="uri://<your service URI>/Retrieve")]
    void Retrieve();
}
Michael Ro
  • 62
  • 2
0

you can customize your soap action in the service interface class,

    [ServiceContract]
    public interface IMyService
   {
     [OperationContract(
        Action = "MySoapAction" ]
      Message ServiceFunction(Message input);
   }
SeaChange
  • 3
  • 1