Solved

Posting to a WCF Service via HTTP

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

810 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