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

Top 5 Contributors of the Month
Post New Web Links

Keeping the same given schema to generate Service

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :WCF


I have to develop a service that will use types specified in a given XSD Schema (let's called this ACME.xsd) and I am wondering if anyone can help me with my problem of using this XSD right through including producing the WSDL.

I can generate C# classes from this ACME.exe using xsd.exe because its XML syntax is beyond the capability of SvcUtil.exe. With these classes, I can develop the ServiceContract and the service. All is fine.

I can produce the Service Contract WSDL and companion XSD Schema using SvcUtil.exe and I also noticed that it generates a schema containing the types I used that came from ACME.xsd. However, the content of this xsd and that in ACME.xsd are somewhat different.

The most noticeable differences are the targetNamespace and most of the xsd specification like restrictions and annotations are lost in this regenerated XSD.

My Questions:

1) Is it possible to instruct WCF to keep that XSD with it including the generation of WSDL? My Service Contract has to use these types in ACME.xsd because of interoperability issue.

2) I know if I do Contract-First approach, I most likely I can achieve what I want. But is it possible to achieve what I want by using WCF as an aid?

Thanks. Is there any smart way of doing this?


View Complete Post

More Related Resource Links

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

Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che


A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

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

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?

How do I generate service reference activities in my rehosted designer

My desginer is used to create lots of xamlx workflows.  These are hosted in app fabric. From Visual Studio I can add a service reference that points to my workflows, and it generates activities in my toolbar that I can use to call my service from another workflow. I'd like to do the same thing from my rehosted designer.  I figured it would be something like calling svcutil.exe, but couldn't find any information on this. Does anybody know how to create xaml activities by pointing at a service for a workflow designer rehost?   CheersJason Bolstad

How to generate service reference for Workflow service from command line?

Is there a way to generate service reference for Workflow service from command line using just dll file (without metadata, without wsdl). I tried using svcutil but i didn't succeed. just error without any meaningful message. udione

Not able to generate proxy for the service hosted on IIS, but working on Dev Web Server?

Hi, I have tried to host WCF on the IIS, it browsed sucessfully using the path http://localhost/WCF/Service1.svc but when tried to generate proxy using SvcUtil, it generated the following message. Bus the same when tried from the development server is working file. c:\Program Files\Microsoft Visual Studio 9.0\VC>svcutil.exe http://localhost/WCF /Service1.svc?wsdl Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] Copyright (c) Microsoft Corporation.  All rights reserved. Attempting to download metadata from 'http://localhost/WCF/Service1.svc?wsdl' us ing WS-Metadata Exchange or DISCO. Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] Copyright (c) Microsoft Corporation.  All rights reserved. Error: Cannot obtain Metadata from http://localhost/WCF/Service1.svc?wsdl If this is a Windows (R) Communication Foundation service to which you have acce ss, please check that you have enabled metadata publishing at the specified addr ess.  For help enabling metadata publishing, please refer to the MSDN documentat ion at http://go.microsoft.com/fwlink/?LinkId=65455. WS-Metadata Exchange Error     URI: http://localhost/WCF/Service1.svc?wsdl     Metadata contains a reference that cannot be resolved: 'http:

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?

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

Web service taking XML doc as argument, how to reference/include XSD schema (describing document) in


Hi All,

Apologies if the question has been asked before but I've done a search and wasn't able to find an answer.

Our web application (hosted in IIS) exposes a WCF web service which takes an XML document as an argument, that document should confirm to a (public) XSD schema already defined in our application.

Current the contract looks as follows

void LoadData(string identifier, byte[] xmlData)

We've got a MEX (meta-data exchange) endpoint set up so that clients can use something like svcutil.exe or WcfTestClient to discover the service details.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempurg.org/WebServices/LoadService</Action>
  <LoadData xmlns="http://tempurg.org/WebServices/LoadService/LoadData">
   <identifier d4p1:nil="true" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance" />

However, this doesn't give the client a clue as to what the XML document (byte[]) should look like/conform to. What app

Adding Report to VS 2005 Project will generate .xsd schema


Hi All,

I am working on reporting project using SQL Reporting Services 2005 .

When i add new item Report it creates a .rdlc file. In left pane when i add data source , it creates new schema in .xsd format ..but it won't start any wizard so that i can select data source.


Right Clicking o schema also not show any open to define data souce..

Pls advise on this..

-- Kind Regards Sandeep

how to stop ScriptTransfer from generate "Create User" "Create Schema" sql statement?



I am using the following code to generate scripts, but no matter how i configure the options, it always generate create user statement




// Connection to Server
        Server srv = new Server(ConfigurationManager.AppSettings["Server"]);

        srv.ConnectionContext.LoginSecure = false;

3 Ways to generate proxy for WCF Service

A Proxy in Windows Communication Foundation is a class that enables client applications to communicate with a service by sending and receiving messages. It actually encapsulates a number of service details like service path, service implementation technology, platform being used, communication protocol etc. as well as all the methods (signature only) of the Service Contract.

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Realizing a Service-Oriented Architecture with .NET

This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.

The Potential of Web Services

Web Service for uploading documents into SharePoint

WS UploadService is a web service written for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 and is meant for uploading documents into SharePoint. I have just uploaded the zip file to GotDotNet.com so it will take some time before the zip file appears in the list of downloads. For the time being, you can download the zip file from the following location

Generate thumbnails on the fly

There are many posts how to generate thumbnails using ASP.NET. Some good some less. Be sure to get distance from the versions that use Image.GetThumbnailImage method.
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