Hi, I have created a WCF rest service as below, for receiving and sending XML doc using HTTP Put method.
1. My Iservice1.cs class as below
1. My Iservice1.cs class as below
Collapse | Copy Code
namespace MDMService
{
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "PUT",
UriTemplate = "",
BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Xml,
ResponseFormat = WebMessageFormat.Xml)]
XmlDocument PutRequestXML(Stream xmlData);
}
[DataContract]
public class XmlDocument
{
[DataMember]
public XmlDocument XML
{
get { return XML; }
set { XML = value; }
}
}
}
2. My service1.svc.cs class as below
Collapse | Copy Code
namespace MDMService
{
public class Service1 : IService1
{
public XmlDocument PutRequestXML(Stream xmlData)
{
StringBuilder response = new StringBuilder();
response.Append("");
response.Append("");
response.Append("");
response.Append("");
response.Append("");
response.Append("");
XmlDocument xmlDoc = new XmlDocument();
return xmlDoc;
}
}
}
3.below is my web.config
Collapse | Copy Code
name="MDMService.Service1"
behaviorConfiguration="MDMService.Service1Behavior">
binding="webHttpBinding"
contract="MDMService.IService1" />
I need to know the link of my WCF service for sending HTTP Put request.
Would would be the link?
Is there something else I need to do?
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
vignan gallaPosted Nov 21, 2014, 4:15 AM
Should I give the complete URL in URI template?
Pradeep ShetPosted Nov 21, 2014, 3:13 AM
You can paas the kind of url u want it in URITemplate. While calling if url of service matches with URI template then that service method will get called.
Hope you got it what I want to say. Mark it as answered if it is so.