I set up a configured URL endpoint (using wcf and POST method) to be trigged when something happens at my client side. it works well when the content type, for the request, is set to application/json, but it doesn't when it is set to application/json+hal, which my client wants to use. My question is how to deal with this matter and what I have to change. Here is the definition of my method in the interface:
[WebInvoke(Method = "POST", UriTemplate = "/payload", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
string payload(requestpayload jsondata);
I updated my web.config
to take @carlosfigueira suggestion into consideration:
<services>
<service behaviorConfiguration="RestServiceBehavior" name="RestRaw.RestService">
<endpoint address="http://mywebsite.com/RestService.svc" binding="customBinding" bindingConfiguration="RawReceiveCapable" contract="RestRaw.IRestService" behaviorConfiguration="Web">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RestServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="Web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="RawReceiveCapable">
<webMessageEncoding webContentTypeMapperType="RestRaw.JsonHalMapper, RestRaw" />
<httpTransport manualAddressing="true" />
</binding>
</customBinding>
However, I am getting this:
500 System.ServiceModel.ServiceActivationException
any thought please