Solved

Posting to a WCF Service via HTTP

Posted on 2011-03-25
2
462 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sending E-mail ASP.Net 3 55
LINQ - C# to VB convertion 12 45
C# Single Form 8 26
Entity Framework 7 27
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

930 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

13 Experts available now in Live!

Get 1:1 Help Now