.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to add XML documentation to generated Schema for a RESTful service

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :WCF
I'm using the RESTful Starter Kit which automatically generates a Service help page. For each method there is a link to a Request Schema. How can I add documentation/comments for each DataMember in the DataContracts so that the description/comment shows up in the generated xml schema?

View Complete Post

More Related Resource Links

Service Station: Building RESTful Clients


This column how to build clients applications based on the REST architecture using HTTP AP1s. The article describes how to address the question of autogenerated types and code.

Jon Flanders

MSDN Magazine October 2009

Service Station: An Introduction To RESTful Services With WCF


We discuss some of the basic tenets of REST as well as present an implementation of a RESTful service using WCF.

Jon Flanders

MSDN Magazine January 2009

Design: Place XML Message Design Ahead of Schema Planning to Improve Web Service Interoperability


Web Services are all about exchanging data in the form of XML messages. If you were about to design a database schema, you probably wouldn't let your tool do it for you. You'd hand-tool it yourself to ensure maximum efficiency. In this article, the author maintains that designing a Web Service should be no different. You should know what kind of data will be returned by Web Service requests and use the structure of that data to design the most efficient message format. Here you'll learn how to make that determination and how to build your Web Service around the message structure.

Yasser Shohoud

MSDN Magazine December 2002

Documentation on impersonation of Windows LiveID with data service?

Hi There, I'm not finding any documentation on impersonating a Windows LiveID over a WCF data service. I can find documentation on Windows Auth. For example, this article is great, but its first step is "Configure Your Service to Use Windows Authentication": http://geekswithblogs.net/manesh/archive/2009/04/23/setting-up-wcf-to-impersonate-client-credentials.aspx. I'm not sure how to do this when I'm working with the LIVEID. Alternatively, and even preferably, if there's a way I can manipulate the connection string the data service is using from the WCF endpoint, that would be ideal. I need to grab some info about the user in the Silverlight app that's using the data service, and somehow impersonate that user. The user is a Windows LiveID, which is what I have hard-coded in my connection string in my web.config. Thanks!  Web: http://invoc.net

RESTful WCF Workflow Service

Folks,   I'm in the middle of building a service (.xamlx) that is basically going to support a document submission workflow. Via the web service, I want clients to be able to POST a big ol' XML file into my system. This is going to kick off a big, long-running, persistable, AppFabric-managed workflow. Clients will be able to poll this (or another) service to get the status of the document processing.   My issue right now is that it appears as though, out of the box, what I get is straight-up WSDL-style services that use standard web service tactics. I was wondering if there was something I could do, either via web.config or via the workflow designer, that would allow me to have my WCF-hosted workflow AND have the endpoint be a RESTful (or even REST-ish... i'm not picky) one. In other words, I want to be able to POST an arbitrary blob of XML to my workflow service (complete with authentication tokens in custom HTTP headers). Is this possible? If so, how?The .NET Addict - http://dotnetaddict.dotnetdevelopersjournal.com

Need help with Restful WCF service and tester

Greetings,  I need a simple restful service to upload an image.   I am new to restful services and this is my attempt to create a simple service and tester.  I cannot get this to work.  Like I said I am new and I would appreciate any help.  Thanks. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Net; using System.ServiceModel; using System.ServiceModel.Web; namespace ImageTester { [ServiceContract] public interface IImageTestService { [OperationContract, WebInvoke(Method = "POST",UriTemplate = "File/{fileName}")] bool UploadFile(string fileName, Stream fileContents); } [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class ImageTestService : IImageTestService { public bool UploadFile(string fileName, Stream fileContents) { return true; } } class Program { static void Main() { Uri baseAddress = new Uri("http://localhost:8889/TestImage"); WebServiceHost host = new WebServiceHost(typeof(ImageTestService), baseAddress); try { host.Open(); Console.WriteLine(host.BaseAddresses[0].AbsoluteUri + " running.\n"); Console.WriteLine("hit a key to send image&quo

schema path while validating XML in WCF service


hi all,

i have a WCF service where I am validating an XML path against an XSD.

I am getting the schema as follows:

XmlSchemaCollection xsc = new XmlSchemaCollection();

xsc.Add(null, "c:/MyDownloads/Doc1.xsd");

But i want to include the Doc1.xsd in my application and specify the path from there.

How to do that?

RESTful WCF Service endpoint not being found by client


I created a RESTful WCF service which I plan to call from a client app (a custom toolpart in a Sharepoint web part), but while I can access everything just fine from a browser the client throws this error:

EndpointNotFoundException: There was no endpoint listening at http://mymachine:3217/Services/CtmsService.svc that could accept the
message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
---> System.Net.WebException: The remote server returned an error: (404) Not Found.

My service's contract looks like this:

public interface ICtmsService
  [WebGet(UriTemplate = "/GetAllSites")]
  Dictionary<string, int?> GetAllSites();
...and the configuration looks like this: (which is more complicated due to needing dependency injection via Spring.NET to work)


Issue with Proxy code when generated for WCF service



There is an issue I am going through when generating Proxy code for my WCF services. Whenever I generate Proxy code for services with methods having VALUE Type parameters, additional BOOL parameter <parameter>Specified is added to the generate Proxy Code.

So if I have method - Employee GetEmployee(int Id), the respective proxy code for this method will be - Employee GetEmployee(int Id, bool IdSpecified).

Moreover, if you do not set this bool parameter value to TRUE, no value will be passed to the End service.

I can understand this can come handy when handling Null inputs, but that will not be always the case.

After doing some R&D, I found that if I add Data Format attribute of type RPC to my Method contract, these parameters are removed. Like if I add: 

[DataContractFormat(Style = OperationFormatStyle.Rpc)] , the generated proxy code reflects all value type parameters as is.

I am not an expert in WCF, and for the same reason I don't have much idea on what significance this attribute plays for the service methods. Can adding this attribute introduce problems when consuming these methods by application in .NET 1.1 or in JAVA?


Can anyone help me in getting ride of this additional parameter in the proxy?

Thanks in Advance.




how to convert a byte[] to a xsd:hexBinary in the WSDL generated of a WCF service


Hi, i always see a byte[] type in the contract gets converted into a base64Binary type. What should i do in my WCF service contract so that the date type in the WSDL comes out to hexBinary ?

Will appreciate your help.


How to enable windows authentication for a RESTFul web service which is not hosted in IIS


I have created a WCF RESTFul webservice by following http://msdn.microsoft.com/en-us/library/dd203052.aspx. I am hosting my RESTful webservice in a window service (and not IIS) using the WebServiceHost class. 

Now I am struggling to get user's windows credentials in my web service methods. I looked at various code samples in forums for this. Almost all of them are hosting the service in IIS plus configuring  the service's settings using <system.serviceModel> tag.

I don't want to host my service in IIS plus as of now I haven't overridden any EndPoints, Behaviours etc in .config file.

I tried with below code in my window service's onstart method

WebServiceHost host = new WebServiceHost(typeof(MyService), new Uri(_serviceUrl));

ServiceAuthorizationBehavior myServiceBehavior = host.Description.Behaviors.Find<ServiceAuthorizationBehavior>();
myServiceBehavior.PrincipalPermissionMode = PrincipalPermissionMode.UseWindowsGroups;


After putting above code I queried ServiceSecurityContext.Current and System.Threading.Thread.CurrentPrincipal  my RESTFul's method but they are showing no sign of return

Restful Wcf Service and Mtom with large xml stream


Hi there,

I created one Restful service that accepts Xml stream as a input.

Now i need to send more than 280 mb of data.

While i upload on client side it gives system outofmemory exception.

How can acheive this task using mtom encdoing on the service side and upload more than 280

mb of data through clinet. Also we need the interoperability between client and server.




C# reading Java/Php/SOAP service, WSDL generated file missing some namespace information

I'm trying to use a Web Service, which I believe is Java/php/SOAP, using C#.
I can connect and send fine, but the results, which are an array of information,
is null. The return is not instant, and I can get back errors.
I believe the problem is in the WSDL translation. The actual response coming back
does not line up with the WSDL generated code in reguards to namespaces. In
perticular, 'getCategoryTreeResponse' & 'getCategoryTreeResult' do not show up 
in the generated file.
I'm quite sure the WSDL file provided is poorly written but I have no control
over it. WSDL.exe only works when I pass a saved copy of the web service's
provided WSDL information due to the way it is called.

WCF Service (Please respect the schema)


I have a WCF Self-hosted service with many web methods. One method, "GetSomeData(myOuterType)" requires a parameter of type MyOuterType.MyOuterType has a property of type MyInnerType.  MyInnerType was generated using XSD from a schema. It all works very well until a java client comes along and points out that when it tries to call the service using valid schema instance xml, the service chokes. Using WCF logs, I can pull out the XML that gets generated by my .Net client. It clearly does not conform to the Xml defined in the schema. The order of elements are all messed up even though the schema defines the elements to be in a sequence. Other than the order of the elements, I think it seems ok.

I'm a little embarrassed that the new client cannot send a valid schema instance in their SOAP envelope since I am supposed to be conforming to the schema. I sent them a copy of the SOAP envelope my .Net client generates and if they use the same order, their java client works fine.

I'd like to learn why my service is not requiring or accepting properly formatted xml within the SOAP envel

XMLSerializer: Losing data from a generated web service proxy using svcutil


I generated a proxy using svcutil with the option ser:XmlSerializer.  When trying to serialize the object I am losing data.  The wsdl came from a .asmx web service.

Can we expect WCF 4 RESTful service enhancements any time soon?

Does anyone know of any future plans for WCF REST enhancements? I tried using WCF 4 REST, but found that it was coming up short on security and didn't support x-www-form-urlencoded mimeTypes. As a consequence, I was forced to use the WCF Rest Contrib library as it has support for multiple formatters plus custom validation. Unfortunately, it turned out that it does NOT support autogenerated help pages, which was very useful considering there is no equivilient to WSDL that can be used for generating custom interfaces. It would be really helpful if there was an out-of-the-box version of WCF that supported features available in WCF Rest Contrib PLUS autogenerated help pages.

WCF WSDL generated paths for xsd:schema, wsdl:import, soap:address wrong for WCF behind a firewall.


My WCF server is behind a firewall
but the schema locations are incorrect in the wsdl

   <xsd:schema targetNamespace="http://www.myserver.net/Imports">
      <xsd:import schemaLocation="" namespace="http://www.myserver.net" />
      <xsd:import schemaLocation="" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
      <xsd:import schemaLocation="

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend