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


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

Exposing data contract without passing as input or output parameter for any operation contract

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net
 

I have a method in  wcf which returns stream of custom object. I need to deserialize this stream at client side, but my custom class which is exposed as data contract is not visible through client proxy. When I add a dummy operation contract which returns the custome object I am able to get this custom class. I dont want to write this dummy method as there are many such custom classes.

Is there any way to expose data contract without writing any operation contract that returns or accepts data contract type object?




View Complete Post


More Related Resource Links

Exposing data contract without passing as input or output parameter for any operation contract

  

I have a method in  wcf which returns stream of custom object. I need to deserialize this stream at client side, but my custom class which is exposed as data contract is not visible through client proxy. When I add a dummy operation contract which returns the custome object I am able to get this custom class. I dont want to write this dummy method as there are many such custom classes.

Is there any way to expose data contract without writing any operation contract that returns or accepts data contract type object?

Example:

[

 

ServiceContract]

data contract code generation for large/complex schema (HR-XML/OAGIS) - is there an alternative?

  
Hello, and thank you for reading.I am implementing a Service based on a predefined specification (HR-XML 3.0). As such, I am starting with the schema, and working my way back to code. There are a number of large Schema documents (which import yet more Schema documents) related to my implementation, provided by this specification.I am able to generate code using xsd.exe, by supplying the "main" and "supporting" xsd files as arguments. But there are several issues, and I am wondering if this is the right approach.- there are litterally hundreds of classes - the code file is half a meg in size- duplicate classes (ex. Type, Type1 - which both represent the same type)- there are classes declared as inheriting from a base class, but that base class is not generated/definedI understand that there are limitations to the types of Schema supported by svcutil.exe/xsd.exe when targeting the DataContractSerializer and even XmlSerializer. My question is two-fold:1. Are code generation "issues" fairly common when dealing with larger, modular xsd files? Has anyone had success with generating data contracts from OAGIS or HR-XML schema?2. Given the above issues, are there better approaches to this task, avoiding generating code and working with concrete objects? Does it make better sence to read and compose a SOAP message directly, while sti

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

SvcUtil-generated code or shared interface/data contract assembly?

  
If you control both service and client is there any benefit in using svcutil.exe to generate client proxies? Or is it better to share interface/data contract assembly between client and service?

Expose data contract used in two services as a single type on client side?

  

I have a .dll that contains my data contracts and I reference this dll in two different services.

Now, on the client side I don't want to add this dll because I need both WPF-clients and Silverlight clients. So, what I want is to be able to use a single data contract on the client side and not with different namespaces for the different services. As I understand this should be possible but I don't know how.

Can someone explain how I can generate a single data contract on client side that can be used for calls to both services?

Thanks for help!


WCF Serialization internals during operation contract invocation

  

Hi

Please consider the following Operation contract, using the DataContract Serializer

Foo(int myVar, byte[] myArray, string myString);

During invocation the parameters are initialized to:

myVar equals 1
myArray references a 100 byte array
myString reference “ABCD”

My understanding is that regardless of the binding used, the invocation will be serialized into a Message object (which is actually a SOAP Message representation using .net objects) and will ultimately be encoded by one of the three encoding schemes when reaching the channel layer.

My question is how is the serialized information represented in the WCF Client/Dispatch runtime after serialization? In other words does the Message object hold references to the passed-in objects or are they copied and transformed to some new string or object representation? So assuming for simplicity sake that variable payload is 4 + 100 + 8 (Unicode) = 112 bytes, what is the memory allocation overhead for such an invocation?

Thanks,

-Itai


Beginner question: Passing the output of one Activity to the Input of another

  

Hi, I am brand new to WF so forgive what might be a simple question.

I am creating multiple activities which will execute in a sequence and pass data down the chain.  I know that one way to do this is to set a context variable in the parent Sequence from Activity A, and then read this value in Activity B (thus the output of A is effectively the input of B).

I'm fine using this technique, but if there is a way to directly declare that the input of Activity B should be the output of Activity A, I'd prefer this.  I'm intrigued by this comment in the new Activity template:

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.

What is the point of returning a value from an Activity?  Can this return value be read somehow by the next Activity in the sequence?  I'd like to set the input of Activity B to the return value (output) of Activity A.  How would I do this?

Thanks,

Mike Vargas


Passing a user defined type property to WCF contract

  

Hi,

i have a class with a user defined type as follow.

[DataContract(Namespace = "a.com")]
  public class Order : IOrderDescription, INotifyPropertyChanged
  {
    public static OrderLimitations OrderLimits { get; set; }
    public OrderLimitations ThisOrderLimits { get; set; }
   
    [DataMember]
    public OrderAlgorithmDescription AlgoDescription { get; set; }
}


 [DataContract(Namespace = "a.com")]
  public class OrderAlgorithmDescription
  {
    [DataMember]
    public OrderAlgorithmName AlgorithmName { get; set; }
    [DataMember]
    public DateTime UTCStartTime { get; s

About Data Contract in WCF (consume by Sliverlight Application)

  

Hi team;

I have a lot  confusion on data contract .I think Data contract will create according to the Service contract and Data Base Table.

For Example Let say i have service contract and i have three table product,order,customer

[ServiceContract]
    public interface IMembersService
    {
        [OperationContract]
        void insertProductDetails(clsProduct objProduct);

      //What about the return type can we make it bool

        [OperationContract]
        List<clsProduct> getproductInfoByID(int id);

        [OperationContract]
        List<clsProduct> getproductInfo();

 

//========================================

[OperationContract]
        void insertOrderDetails(clsOrder objOrder);

      //What about the return type can we make it bool

        [OperationContract]
        List<clsOrder> getOrderInfoByID(int id);

 &nbs

Design Data Contract for User Create/Update/Delete REST API using WCF 3.5 & JSON

  

Hi,

I'm using REST with WCF .NET 3.5. I've design the class structure with below JSON struvture of input & output.

API 1: Create User: POST /id & request body is as shown below:

{
  "userList" :
   [
    {
       "name" : "<name>",
       "email" : "<email>",
       "dataId" : <dataId>,
       "country" : "<country code>",
    },
    {
       "name" : "<name>",
       "email" : "<email>",
       "dataId" : <dataId>,
       "country" : "<country code>",
    }
   ]
}

The response object should be as shwon below:

{
  "userCreateResults" :
   [
    {
       "email" : "<email>",
       "userId" : <userId>,
       "password" : "<password>",
       "result" : <result code>
    },
    {
       "email" : "<email>",
       "userId" : <userId>,
       "password" : "<password>",
       "result" : <result code>
    }
   ]
}

API 2: Update User: PUT /id & request body is as shwon below:

{
  "userList" :
   [
    {
       "userI

Using WCF Data Contract Known Types by Example

  
What is a Known Type in WCF? What are different ways to use a Known Types in WCF?

Understanding Data Contract in WCF

  
In Windows Communication Foundation, Data Contract is an agreement between parties (i.e. a service and a client) that describes what type of data will be exchanged between them? We can control the contents (i.e. Payload data or message body) of a SOAP message using Data Contract.

Enterprize library 4.1 getting output parameter after adding record in db, plz guide

  

Hi,

I need to get output parameter (flag) from db after saving record in database. I am using Microsoft Enterprise Library 4.1 for DB. I am inserting record using I Data reader.

Please guide

Thanks


An endpoint configuration section for contract 'xxx' could not be loaded because more than one end

  

Hello,

I'm trying to test calling a webservice, I've found several free ones on http://webserviceshare.com, but none of them work for me.  Some of them give example calling code in C# which I've translated to VB.NET, they're typically just two to four lines, I don't think I've translated them incorrectly.

On that I've tried is US Zip Validator.  I added a Service Reference to http://www.webservicemart.com/uszip.asmx?WSDL, called ZipService.

I then call it like so:



            Dim myZipService As ZipService.USZipSoapClient = New ZipService.USZipSoapClient()
            Dim myCity As String = myZipService.ValidateZip("27707")


I get the following error on the first line of code:

"An endpoint configuration section for contract 'ZipService.USZipSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name."


A page with information on this web service (including C# source code) is at:

http://webser

Could not find default endpoint element that references contract 'CurrencyProxy.CurrencyServiceSoap

  

Hi,

I created 2 projects in my solution:

  1. Classic asp.net web service (asmx)
  2. Class library project which references service
  3. web site project which references class library project
  4. Windows app project which references service.

Both projects were created in 3.5 framework and in Visual Studio 2008 Beta 2.

I added web service reference to Class library project. When it asked for namespace I typed "CurrencyProxy". Projects build ok, but when I run web app, Class library throws an error: Could not find default endpoint element that references contract 'CurrencyProxy.CurrencyServiceSoap' 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.

I believe it has something to do with app.config in Class library project. Here is part from app.config:

 <system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="CurrencyServiceSoap" closeTimeout=

Passing Data to a Cell in Excel

  

Hello,

I have a webpage that is created in Visual Studio 2008 and programmed in C#.

I have a web form that prompts the user to enter a value into a text box.  For now, I do not have any validation on that field (I will be adding that later).

I need to pass the value that the user has entered to cell C1 of the excel spreadsheet (user_info.xls).

I understand that using excel is not ideal, but unforutnately need to try to make this work with the excel spreadsheet.

I do not have any code for this yet, because I honestly do not know how to begin.

The action of poulating the excel spreadsheet will be intialized from the On Click event of a Submit button.

Any suggestions would be much appreciated.

Thank you in advance for your assistance,


Allison




Input Validation: Enforcing Complex Business Data Rules with WPF

  

Windows Presentation Foundation has a rich data binding system that includes flexible support for business data validation. We take a look at implementing some complex data input validation scenarios that include customized data errors for users.

Brian Noyes

MSDN Magazine June 2010


Categories: 
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