Solved

Posting to a WCF Service via HTTP

Posted on 2011-03-25
2
459 Views
Last Modified: 2012-05-11
Hi Everyone,

I'm having trouble posting data to a WCF Service via HTTP Post and send a redirect response back to the user.

I only get a blank page back from the post. Are there restrictions on HTTP posting from another domain in WCF?

If somebody could point me in the right direction, I'd really appreciate it.

Thanks

Nick
[ServiceContract]
public interface IXXLeadServiceWCF
{
 [WebInvoke(UriTemplate = "invoke")]
 [OperationContract]
 void CreateCallBack(Stream input);
}

[OperationBehavior]
public void CreateCallBack(Stream input)
{
 StreamReader sr = new StreamReader(input); 
 string s = sr.ReadToEnd(); 
 sr.Dispose(); 
 NameValueCollection qs = HttpUtility.ParseQueryString(s); 
 string firstName = qs["firstName"];

WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Redirect;
WebOperationContext.Current.OutgoingResponse.Location = "http://www.test.com";
}

<form method="post" action="http://wcf.xxx.com/LeadService/LeadService.svc"> <input name="firstName" id="firstName" class="txt_input" type="text" value="" /></form>

Open in new window

0
Comment
Question by:nkewney
2 Comments
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 35224553
Can you post the code of the page consuming the web service?
In a wcf web service, you define the host configuration parameters to define your communication, but you do not need to define line 22.
Your page should consume and display your service response, Check:
http://msdn.microsoft.com/en-us/library/bb332338.aspx

Note: If more help required please post host config file/relevant wcf setup code.
0
 
LVL 1

Author Closing Comment

by:nkewney
ID: 35367322
Great - thank you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now