I need to associate with the soap header to install using json body.
I created the contract as follows:
[ServiceContract(Namespace = "http://tourico.com/webservices/hotelv3")]
public interface IHotelMobileFlow
{
[OperationContract, WebInvoke(
BodyStyle = WebMessageBodyStyle.Wrapped,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
SearchResultMobile SearchHotels(SearchRequestMobile request);
A service like this:
[AuthenticationRequired(typeof(HotelFlow), typeof(DefaultClientAuthenticationHandler))]
public class HotelMobileFlow : IHotelMobileFlow
{
for the attribute 'AuthenticationRequired' I need to send a soap header
<soapenv:Header>
<aut:AuthenticationHeader>
<aut:LoginName>host</aut:LoginName>
<aut:Password>password</aut:Password>
<aut:Culture>en_US</aut:Culture>
<aut:Version>8</aut:Version>
</aut:AuthenticationHeader>
</soapenv:Header>
I created the query as follows:
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
request.Method = "POST";
request.ContentType = "application/json; charset=utf-8";
SearchRequestMobile sr = new SearchRequestMobile();
Is it possible to add soap header to json request? Is there any other way to redirect the header to the service?
Thanks Michal
source
share