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?
The SOAPAction header is a transport protocol header (either HTTP or JMS). It is transmitted with SOAP messages, and provides information about the intention of the web service request, to the service. The WSDL interface for a web service defines the SOAPAction header value used for each operation.
If the headers are part of the wsdl, you can generate the SEI that accept the headers using -XadditionalHeaders. If they are not, you will have to add the header programmatically using SOAPHandler. It is simple though!
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();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With