Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong SOAP Action header in request. Why?

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?

like image 699
shytikov Avatar asked Feb 25 '14 16:02

shytikov


People also ask

What is SOAP Action header?

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.

How do I add a SOAP Action header in Java?

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!


1 Answers

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();
}
like image 141
Michael Ro Avatar answered Sep 21 '22 14:09

Michael Ro