Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7025555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:59:24+00:00 2026-05-27T23:59:24+00:00

I have some knowledge on using WCF, but I don’t know how to construct

  • 0

I have some knowledge on using WCF, but I don’t know how to construct it and be able to receive data from HTML-POST.
Inside my sample Html is this:

<html>
<body>
    <form method="POST" action="#">
        Name:   <input type="text" id="txtName" value="" /><br />
        Age:    <input type="text" id="txtAge" value="" /><br />
        Address:<input type="text" id="txtAddress" value="" /><br />
        <input type="submit" value="Send" />
    </form>
</body
</html>  

And inside my WCF is:

namespace WCF
{
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class User
    {
        WebInvoke(UriTemplate = "", Method = "POST")]
        public DataFromHTMLPost(UserData instance)
        {
            throw new NotImplementedException();
        }
    }
}

Can anyone give some suggestion on how could I pass the data from HTML-POST to webservice?
Or give me some links as reference. Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:59:24+00:00Added an answer on May 27, 2026 at 11:59 pm

    You will need to grab the data from code behind and then pass it through to the web service.

    You can either add runat=”server” to each of those input fields and get the data directly by going

    txtName.Text
    

    or you can get all the posted data by

    NameValueCollection nvc = Request.Form; 
    
    String name = nvc["txtName"];
    

    Then just call the web service which I would assume you have added as a Service Reference in your project?

    UPDATE (Since learning its a PHP client accessing .NET WCF)

    For getting post data do this:

    $item = $_POST['item'];
    

    item is the name of the input field.

    PHP code to connect to WCF (using JSON)

      /**
        * @param $service name of JSON service to call
        * @return string url in string
        */
      function request_Url( $service )
    {
    
    return 'http://api.domain.com/api.svc'.'/'.$service
    
    }
    
    /**
     * 
     * @return array|false Contest List or false on failure
     */
    function get_contestList() {
    
        $jsonStr = json_decode(file_get_contents($this->request_Url('MethodName')), TRUE);
    
        return $jsonStr;
    }
    

    In the WCF you will need to change your method signatures to

    [OperationContract]    
    [WebGet(ResponseFormat = WebMessageFormat.Json, 
            RequestFormat = WebMessageFormat.Json,               
            UriTemplate = "/MethodName")]
    public String MethodName()
    {
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some time I’ve seen employers demanding Sharepoint knowledge from programmers, but I have
I have some knowledge in C/C++ but only using the Console. I'd like to
I just started C++ but have some prior knowledge to other languages (vb awhile
I'm new with C#, I have some basic knowledge in Java but I can't
I have some basic knowledge of Entity Framework 4.1 Code First, but haven't used
I am new to C++ but I have some basic memory allocation knowledge in
I have some knowledge about Human computer interaction and some basic knowledge programming scripts
I just started to read about this new technology... Does someone have some knowledge
I have some UI in VB 2005 that looks great in XP Style, but
We have some input data that sometimes appears with &nbsp characters on the end.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.