TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
vignan galla
NA
8
1.9k
How do I know the link to be given for the WCF rest service
Nov 21 2014 12:48 AM
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
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("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
response.Append("<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
response.Append("<plist version=\"1.0\">");
response.Append("<dict>");
response.Append("</dict>");
response.Append("</plist>");
XmlDocument xmlDoc = new XmlDocument();
return xmlDoc;
}
}
}
3.below is my web.config
Collapse | Copy Code
<system.serviceModel>
<services>
<service
name="MDMService.Service1"
behaviorConfiguration="MDMService.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:58673/"/>
</baseAddresses>
</host>
<endpoint address=""
binding="webHttpBinding"
contract="MDMService.IService1" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MDMService.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
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?
Reply
Answers (
2
)
Create a WCF service application using HTTP PUT
Wcf service