Get Request Content of PUT method in WCF

222 Views Asked by At

I am trying to fetch "PUT" request content which is VCard via WCF. here is its content,

PUT https://mysite.com/
Host: mysite.com
Content-Type: text/vcard; charset=utf-8
Accept-Encoding: gzip, deflate
Connection: keep-alive
Proxy-Connection: keep-alive
Accept: */*
Content-Length: 280
Accept-Language: en-us

BEGIN:VCARD
VERSION:3.0
N:test;Syeda;;;
FN:Syeda test
item1.EMAIL;type=INTERNET;type=pref:[email protected]
TEL;type=HOME;type=VOICE;type=pref:021 3123456
REV:2013-12-09T13:51:45Z
UID:318D8B19-BBC0-4841-A831-89E224C27A2D
END:VCARD

when i am trying to fetch it it is giving the following error,

Expecting element 'string' from namespace 'http://schemas.microsoft.com/2003/10/Serialization/'.. Encountered 'Element'  with name 'Binary', namespace ''. 

Is there any workaroung anybody knows to access VCard content.

Though, i am able to get those request's content that is in Xml format.

Thanks!

Update:

Previously, i was fetching the request content using this line of code.

operationContext.RequestContext.RequestMessage.ToString()

This work fine until the request is in xml format.But, when request is bringing content given above it returns word "Stream" as a string.

And, when i tried to do something like this,

operationContext.RequestContext.RequestMessage.GetBody<String>();

I am getting error shown above.

0

There are 0 best solutions below