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

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

schema path while validating XML in WCF service

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :WCF

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?

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

How to Find out Windows service application path from Code ?

Dear frnds, Could you please help me to find out the path of  windows serivce exe ( application path ) from code?   Regards. Sajid P K  

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?

validating csv file with xsd schema


Hi, i have to validata a csv file using xsd schemas that is provided with the file to validate.

I was thinking to validate the file with datatable but the problem is that datatable doesn't accept some restrictions like minLegth and facets that i need to control some values.

Is saw xmlSchemaSet but it validates xml files and i don't know if it's possible to validate single records that are provided to the validation module as an array with the elements inside, to say if i have a record with 4 fields the validation module will take as input an array of 4 strings.

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

Http connection and WSDLFile path for a web service task - SSIS 2005



I'm trying to create a SSIS 2005 pkg with a web service task. I need to create a Http connection, specifying an Url, and a WDSLFile Path. About these, two questions, please:

a) as URL for the Http connection, can I write f.e. http://mysite/mywebservices/mytestwebservice?wsdl=mytestwebservice.wsdl;

b) has the WDSLFile path to be a local path on my machine?

Many thanks for your suggests.

Error: Sys.InvalidOperationException: The path to the web service has not been set.


My website (VWD 2008 Express) has been running for some time with no error.  Something has become corrupted, I am getting the error message "Error: Sys.InvalidOperationException: The path to the web service has not been set." when attempting to use the default authentication message.  Nothing has changed in the script manager specification on the page.

I installed VWD 2010 but before I opened it, I attempted to run my project on VWD 2008.  Thats when I got the message.  I uninstalled VWD 2010 and still get the message.  Any suggestions how I can get my project to work back on VWD 2008?


The path to the web service has not been set.


My website (VWD 2008 Express) has been running for some time with no error.  Something has become corrupted, I am getting the error message "Error: Sys.InvalidOperationException: The path to the web service has not been set." when attempting to use the default authentication message.  Nothing has changed in the script manager specification on the page.
I installed VWD 2010 but before I opened it, I attempted to run my project on VWD 2008.  Thats when I got the message.  I uninstalled VWD 2010 and still get the message.  Any suggestions how I can get my project to work back on VWD 2008?

Also, a possibly related problem that showed up at the same time.  When I open the website on VWD 2005 a message is displayed: "An error occurred processing the local data file: Element not found (Exception from HRESULT:0x8002802B(TYPE_E_ELEMENTNOTFOUND).
Any one have any ideas?
Sorry about the cross-post.  I mistakenly posted it on General.

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

Keeping the same given schema to generate Service



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?


Validating a SAML token at WCF Data Service level


I  have a WPF client which request a SAML token from the STS. After receiving the SAML token the WPF client sends the SAML token as part of the request header to the WCF data service. At the WCF data service level the request is interpreted by the Authorisation manager. I wanted to know is there any way to parse and authenticate this SAML token at the service level that its a valid saml token.

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

Creating and Using an ASP.NET Web Service in Visual Web Developer

In addition to letting you create Web pages, Microsoft Visual Studio also lets you create Web services that use ASP.NET XML. Creating a Web service in Visual Studio is similar to creating a Web page. You can also use the Microsoft Visual Web Developer Web development tool to reference and use Web services that are in a Visual Web Developer solution, on your local computer or in a local or external UDDI directory. In this walkthrough, you will create the Web service in one solution and use it in another.

Tasks illustrated in this walkthrough include:

Creating a simple XML Web service in Visual Web Developer.

Creating a separate Web site that uses the Web service.

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http
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