.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

WCF - Service Contract Namespace

Posted By:      Posted Date: October 03, 2010    Points: 0   Category :WCF


When we are defining a service contract type it will already be specified in a well defined namespace in code.Then why namespace property in service contract attrib ?

What is the purpose of using namespace property in service contract ? When and how we can see the benefit of it ?


Many Thanks



Vijaykishan | http://v2attechhorizon.blogspot.com

View Complete Post

More Related Resource Links

Service Station: Techniques for Contract-First Development


In my May 2005 column, I discussed contract-first development and appropriate times to use it (see Service Station: Contract-First Service Development). In this second part, I'm going to focus on some techniques for contract-first development within the ASMX framework.

Aaron Skonnard

MSDN Magazine June 2005

Service Station: Contract-First Service Development


In one of my previous columns on Service Orientation (SO), I introduced the concept of "contract-first" service development (see Service Station: SOA: More Integration, Less Renovation). Over the next two installments of this column, I'm going to cover the topic in depth.

Aaron Skonnard

MSDN Magazine May 2005

Error Consuming Web Service - Unable to import binding xxx from namespace ...


In VS2008 / C# / ASP.NET 3.5, I wrote a test web service app. Here is an extract from the code:

namespace emed.MathWebService
    /// <summary>
    /// Sample Math Services For Learning Web Services Deployment
    /// </summary>
    [WebService(Namespace = " http://localhost/MathService")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MathService
        public float Add(float a, float b)
            return a + b;


I have published this to an IIS virtual directory named MathService, and when I try to launch it with the URL http://localhost/mathservice/MathService.asmx is works fine and displays all the operations (Add, Subtract etc) in the service.

I then created a test web application in VS2008 (named WebSvcTe

WCF Needs? How to Communicate Multiple Contract via Single Service?

why it needs.   i have many business objects how could i serve to my web application via single service.   i have nearly 500 different business objects. how could contract implement into client web applicatoin.    

Error Build: Type or namespace could not be found, when referencing a web service

Hello, I'm new in writing C# application in Visual Studio 2008. I'm currently writing a web application for CRM 4.0 Reporting Service rendering. I reference my web application to our Reporting Service web service http://reportservername /ReportServer/ReportExecution2005.asmx and name it 'RSWebReference'. Then I want to reference it in my code: Using RSWebReference; Not sure why, but I cannot build my solution, saying "The type or namespace name 'RSWebReference' could not be found (are you missing a using directive or an assembly reference?)". I read this thread in http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/74f70e30-83e8-4817-b5e0-7729450730a1 that the website probably is using .net 1.1, and I should change it to .net 2.0. However, I think the website is already using 2.0. Is it probably because I'm using VS 2008? How can I tell and change if the website is using 1.1 or 2.0? Or could I be doing something wrong? Thanks in advanced for your help! -Elizabeth K.

separating service level data from business data in servcie contract

Hi I have read that service level data (like requestId, client name etc. required for tracing/auditing) should be separated from business data(required for actual business operation) ie. differencing "Message Header" from "message payload". When we say 'separation", does that mean service level data should not be defined/declared in my contract class. If so how clients will know what header info they have to pass? I can't enforce header info as part of my contract. i think http://blogs.microsoft.co.il/blogs/bursteg/archive/2006/04/23/141.aspx this is based on assumption that clients are aware what they have to pass in header. Regardssinghhome

Single class with service and callback contract

Can a single class implement service and callback contract. Thanks-= JL =-

Workflow - Same Contract used in two service - Conversion problem

Hello, I'm trying at the moment to use WF to create a basic Workflow, and face a conversion problem. Here's the setup : Service 1 : Create objects based on a defined Data Contract Service 2 : Apply an operation on objects of type defined in service 1. Service 1 is imported as Service reference. I created a simple Workflow which imports both services. It first call Service one to get an object, and then send it to Service 2 to apply the operation. But when I try to do this I receive an error of type : 'WF.Service1.Entity' cannot be converted to 'WF.Service2.Entity'. The Contract used is only defined in the Service 1 and reused in Service 2, so it's the same object. The only difference is in the proxy client generated which creates both definitions, each one in it's specific namespace (Service1 and Service2). Do you see any solution to this situation ? Except creating an activity that copy every property from one object to another :-) P.S. : I uploaded the basic setup here : http://www.mediafire.com/?e6j9c2dv4rvcdoh

Getting error "The XML element 'EnableTheming' from namespace...." When running Web service


Hi everybody i am getting an error

The XML element 'EnableTheming' from namespace 'http://tempuri.org/' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.

when i am running my webservice There is no error at build time its build up successfully.

I an getting this error when i return an asp.net pannel from my web method.. but when i am returning simple string its work fine..

Thnks in advance,


svcutil /metadata - how to export metadata for service contract that has generic type



I am using svcutil /metadata to get metadata for a WCF service project assembly, the service class implements the IChildServiceContract below, and the IChildServiceContract interface implements a base interface which accept a generic type.

public interface IChildServiceContract : IServiceBaseContract<string>

I can generate metadata for IChildServiceContract , I am curious and also want to try generate meta data for base interface, an error come up which seems have problem with the generic based contract:

There was an error exporting the contract loaded from the type: xxx.xxx.xxx.IServiceBaseContract`1

Is it possible to generate metadata in this situation?


Thanks in advanced


Verifying GRANT permissions on Service Broker CONTRACT and Queue


I am setting up SqlDependency and wish to verify that the permissions have been applied correctly.

One of the commands that should be run to grant permissions is to grant references on a contract for the user:

GRANT REFERENCES on CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification]  to [sql_dependency_subscriber]

How can I check whether the user e.g. 'databaseUser' has this REFERENCES granted on this contract? Which view/stored proc. to use?

The other command is similar (also required for SqlDependency) but grants permission "RECEIVE":

GRANT RECEIVE ON QueryNotificationErrorsQueue TO [sql_dependency_subscriber]

How could I verify that the RECEIVE permission has been granted?


I have currently used this command:

sys.database_permissions AS prmssn
INNER JOIN sys.database_principals AS grantee_principal
ON grantee_principal.principal_id = prmssn.grantee_principal_id
WHERE prmssn.class = 0

With this command I can see some permissions (such as CREATE PROCEDURE, CREATE QUEUE, etc.) but the above permissions related to  the contract and queue do not seem to show in the results from sys.database_permissions.

Thankful for any advice!


How to create a "Contracted Services" Dimension - the intersection of Customer, Contract and Service


Can some give me some guidance on how to create a 'Contracted Services' Dimension?

I have the following working Dimensions:

Customers and Services

And a Fact_Service_Usage. Fact_Service_Usage has a CustomerKey and a ServiceKey. This creates a proper intersection of Services_Usage, Customer and Service.

However, in our business we need to ensure we only report on 'Contracted Services'.

So I need to create a Dimension that properly enumerates only those services for which the Customer is contracted. I have a table called DimContractedServices that holds the CustomerKey and the ServiceKey for those services for which they are contracted.

In the Data Source View I create the relationships between the respective Keys and use the Dimension Building Wizard to create the Contracted Services Dimension.

This Dimension is not working correctly.

Could someone help walk me through an example of how they would approach building this ContractedServices Dimension correctly? Perhaps someone has built a similar Dimension and can give me some hints on how to structure this so that it allows the enumeration of the .MEMBERS for only ContractedServices.

Thanks very much for the assistance.




New public class in namespace (web service, asmx)



I have a working web service written in C#.NET that was set up by my predecessor, and have been able to successfully modify it in the past. It works without problems in production.

Basically, the service takes XML code and sends it to a postURL with an outside vendor API. They send back an XML document that we then parse out.

My issue is that I need to connect to another vendor API concurrently with the existing one.

Method 1) Should I create an entirely new Web Service for the new vendor? I tried this but there seemed to be an issue with the ports, having them run at the same time. Should I try again? Any port secrets?

Getting stuck on Method 1, I'm on to Method 2 now....

Method 2) Modifying the exiting web service by adding a new public class to the namespace. I also modified the wsdl, disco and discomap files for the new service. It did compile, but something is missing.

Service1 = exisiting, working web service

https://servername/Service1.asmx - works beautifully and lists all my API calls

https://servername/Service1.aspm?wsdl - shows my wsdl file

Service2 = new, copied web service

How to access methods in one service contract with different bindings?



Here i explain my exact problem. I have one service contract.

 public interface IParcel
 ParcelList GetAllParcelData(string countyId, string year, string parcelId);
 ParcelList GetParcelDataByParcelId(string parcelId);
 [WebInvoke(UriTemplate = "/Search/", RequestFormat = WebMessageFormat.Json,
  ResponseFormat = WebMessageFormat.Json)]
 SearchParcelList GetSearchParcelDetails(SearchParcel parcelNumbers);

My requirement is, i have to make "GetAllParcelData" method access by using wsHttpBinding,  "GetParcelDataByParcelId" using some other binding like net.tcp.binding and "GetSearchParcelDetails" using webHttpBinding. This one i have to make restful method.

means the methods inside one service contact have to used different bindings to access.

finally, i need to know is this type secnario possible. if yes explained with example.

Thanks in advance.......

Is it possible to convert WSDL file back to Service Contract Interface for hosting? (WCF)


Hi there,

I would like to convert WSDL file to Service Contract Interface for hosting purposes. I know there is an option  to create proxy classes for clients using SVCUtil.exe or WSDL.exe. But this is not i would like to do.

I have a situation where, one of our clients have already hosted webservice. And I need to host a similar webservice. so to do it I must hand craft whole service contract Interface from the scratch. So without writing from the start can I use the existing WSDL to create the service contract Interface and the implementation class automatically with some tool?



adding a service reference throws a contract error



I added a service reference via the add service reference method. I can see all of its services in the intellisense but when I run the project and it executes the line where I instantiate the service : MyProjectName.ServiceReferenceName.IServiceReferenceClient  client = new  MyProjectName.ServiceReferenceName.ServiceReferenceClient;

it throws this error:

Could not find default endpoint element that references contract 'ServiceReferenceName.IServiceReferenceClient' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.


Now this within my class library and I have added the service reference in my class library project.

Kind Regards


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.
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