.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

REST and SOAP headers problem

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :WCF
Hi!   I'm trying to expose a service and, particularly, an operation that has an input that has been "tagged" as [MessageHeader]. When I try to run the service, I'm given an InvalidOperationException.    The full message is: Operation 'X' in contract 'Y' uses a MessageContract that has SOAP headers. SOAP headers are not supported by the None MessageVersion.   Unfortunately that MessageContract has to use headers so I haven't got the possibility to "dispose" the headers altogether. Does anyone know how I can correctly expose my service to both a SOAP and Web client (btw, I've already tried the "How to: Expose a Contract to SOAP and Web Clients" in the MSDN documentation) under these circumstances?   Thanks in advance!

View Complete Post

More Related Resource Links

How to Add Custom SOAP Headers Into The Server Response Message in WSE3.0?

Hi Dear All, Assuming I am the service provider, may i know how many ways are there to insert a custom header into the server response message? So far I tried several ways, and it can be done in custom SoapFilters (by playing with SOAPEnvelope object), and SoapExtension (SOAPMessage object). Just wondering if this could be done at web service class by specifying a SOAPHeader attribute, just like adding a SOAPHeader into the SOAP request message at consumer side? If can, it might be much smarter than SoapFilter and SoapExtension.   Thanks in advance!   Best Regards, Charles

Database Access Using SOAP and REST Web services

Hi Guys, Can anyone post the links regarding DATABASE ACCESS USING BOTH WEB SERVICES. How to query the database using the web service. Suppose i have SQL statement like " Select empID,empName,CName from employee,company where empID=CID;".  How to  send this sql query to database server using REST and SOAP web Services?  Thank You

Soap exception problem

Hello, I'm having a problem with the web service soap exception that im facing. In my if else statement, the web service keeps on throwing soap exception when name was not found. SoapException was caught A user with the account name test.name could not be found --> User Not Found: Could not load profile data from the database. My question is.. Is it possible to handle that in if else statement? Basically the web service returns profile data (ex. name, age, address, in xml format) What i want is if just like this.. If _result isnot nothing then _str = _result else 'do nothing end if Is that possible?    Ã‚®Â©T½¼

problem with calling soap service written (most probably in java)

Hi evebody, I'm experiencing problem calling third-party service written in java (mostprobably). When i call service i get following response: <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Header></env:Header> <env:Body> <env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <faultcode>env:Server</faultcode> <faultstring>Content root name does not match element name: {http://foo.bar/}arg0 != arg0</faultstring> </env:Fault> </env:Body> </env:Envelope> I've used command line java utility provided by service provider and found following difference: soap request, generated by wcf (similar results with webservices)   <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <baz xmlns="http://foo.bar/"> <arg0 xmlns="">string value</arg0> <arg1 xmlns="">string value</arg1> <arg2 xmlns="">string value</arg2> </baz> </s:Body> </s:Envelope> request, generated by java utility: <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:baz xmlns:ns2="http://foo.bar/"> <arg0>string value</arg0> <arg

How to change the ReplyTo and FaultTo of SOAP Message Headers in WCF ?

Hi All, How to change the ReplyTo and FaultTo of SOAP Message Headers in WCF ? I will test routing SOAP MEssage using WCF, Thanks.  Frank Xu Lei--????,???? ???.NET????????????????????? Focus on Distributed Applications Development and EAI based on .NET   ???????:http://www.frankxulei.com/ ???????:http://www.cnblogs.com/frank_xl/ ??WCF?????? ??WCF??????

Problem with create SOAP clinet...



I have problem with create soap client. I get WebApi documentation and find example in PHP:

try {
// access key to WebAPI
$accessKey = "ABSDFB34FI651N4MJAXY564F";
// create client object Soap
$soapClient = new SoapClient("http://beta.otodom.pl/webapi2/?wsdl");
// login to WebAPI.  Method  doLogin returned session key
$sessionKey = $soapClient->doLogin($accessKey,"twojemail@domena.pl","twojehaslo" );
echo "Login OK. Session key : $sessionKey.\n";
} catch (SoapFault $fault) {
echo "login is not success. Error code: [{$fault->faultcode}]

how to translate it in ASP.NET to C# ????



Creating SOAP or REST Data Sources in SharePoint 2010 Designer while using Forefront Server


When I create a REST data source to access a sharepoint list, I have permission issues because of the Forefront sever in front of my SharePoint 2010 server.  I've tested in an environment without the Forefront server and it works as expected.

1.  Tested in browser and works fine againsted forefront server (https://myforefrontserver.com/site/sub/_vti_bin/ListData.svc/MyList)

2.  Added this to web.config

      <proxy autoDetect="true" />

3. Created Rest Data Source in SharePoinbt designer pointing to https://myforefrontserver.com/site/sub/_vti_bin/ListData.svc/MyList and tried all logon options with no sucess.

Out of ideas

Problem in Gridview - Only first row updated, Rest not updated.


Dear All,


I have detailsview [dtlviewRecommendation], bounded with Linq DataSource [LinqDataSourceRecommendation]. In the Item Template and Edit Template in the DetailsView, I have a GridView[gvItemRecommendation] bounded with LinqDatasource[LinqDataSourceRecommendation].

When I'm editing[For Updation] the data in the gridview [Edit mode of the DetailsView], all the data are not updated in the DB except the first row.

Only Precisely, first GridViewrow is updated. Rest of Gridview row are not updated in the database.

void LinqDataSourceRecommendation_Updating  -> Hitted once.

Any can one suggest the solution for this.



Inexplicable problem with behavior extension in a WCF REST service


Not sure what happened, but behavior extensions that are necessary to support a WCF REST capability suddenly seem to not be registering. The problem is with the webAuthentication extension. In the Visual Studio 2010 IDE, is is blue underlined and the message states:

"The element 'behavior' has invalid child element "webAuthentication'."

I tried running it in Fiddler, and get the following HTTP 500 response:

"An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'webAuthentication' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions"

The config file looks fine and has been working up until now. I haven't got a clue as to why this extension is not being recognized in the behavior.

Does anyone have any ideas on how to debug this?

My config code is:  

     <add name = "webAuthentication" type = "WcfRestContrib.ServiceModel.Configuration.WebAuthentication.ConfigurationBehaviorElement, WcfRestContrib, Version=, Culture = neutral, PublicKeyToken=89183999a8dc93b5"/>

WCF client, svcutil and SOAP array problem


Hi, everyone. I hope someone will be able to help me about this issue:
I am trying to generate WCF client by issuing following command:
svcutil testingWsdl.wsdl /ser:XmlSerializer (/ser option has nothing with problem, I've just tried with it also)
I am getting following error:

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The datatype 'http://schemas.xmlsoap.org/soap/encoding/:Array' is missing.

Here is complete WSDL:

<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" 
<import namespace="soap" location="http://schemas.xmlsoap.org/wsdl/soap/"/>
 <portType name="SoapInPort">
 <operation name="SoapIn">


What is the difference between SOAP and REST

Soap cs code from WSDL encoding response problem


I have created a client proxy from a WSDL file with WSDL.exe

i can both send and recieve data fine.

The xmlfile i recieve contains Nordic char data (i see that in fiddler).

ex: <mydata>øæå</mydata>

The problem occurs when the data goes into my client proxy. It looks like they are in utf-8 format (and that will not work with nordic chars).

so the nordic chars are just scrambled.

any way to override this ?

 object[] response = this.Invoke("Query", new object[] { message });
 message = ((elements)(response[1]));
 return (string)(response[0]);




Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Tooltip for GridView Column Headers (ASP.Net)

I just wanted to add auto tooltips for my GridView headers. There are couple of ways but I don't want to use javascript and wanted to use simple 'title' attribute. It took couple of hours to get the working code supporting sortable columns. I thought it will be very useful for others. Here's the code and logic behind it.

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

Hi friend,

you can use this thread to solving problem and solutions.

Scrollable GridView with fixed headers in asp.net C# vb.net

In this example i am going to show how to create scrollable GridView with fixed headers which don''t get scrolled with records and stay on the top in asp.net using css, I''ve tested this code on IE7 and Firefox 2.0 , 3.5.

For this we need to add css to headers of gridview to keep them on the top.

First of all place a Panel on the aspx page from thetoolbox. Set height to 200px and width to 200px
and scrollbars to Vertical.
Now add a gridview inside this Panel and set the datasource to populate gridview.
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