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

  • SEARCH
  • Home
  • 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 7035201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:16:35+00:00 2026-05-28T01:16:35+00:00

I have to post the value from input fields to my webservice. Searching on

  • 0

I have to post the value from input fields to my webservice. Searching on the net give no luck at all. I am not allowed to use AJAX/JSon to wrap and post the data, Only through WCF. And I’m stuck with that. Hope someone could help.

HTML FILE:
I remove some fields to minimize the space consumption.

<%@ Page Language="C#" AutoEventWireup="ue" CodeBehind="WebForm1.aspx.cs" Inherits="BasePayment.Client.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//D HTML 4.01 ansitional//EN" "http://www.w3.org//html4/loose.d">
<html>
<body>
<form method="POST" name="frmPayment" action="">

Merchant ID
<input type="text" name="merchantId" value="1546" />

Payment Method
<input type="text" name="pMethod" value="VISA" />

Credit card expiry month - 2 digits.
<input type="text" name="epMonth" value="02" />

Credit card expiry year - 4 digits.
<input type="text" name="epYear" value="2012" />

Credit card number.
<input type="text" name="cardNo" value="4918914107195005" />

Credit Card Verification Code
<input type="text" name="securityCode" value="123" />

Credit card holder name
<input type="text" name="cardHolder" value="Juan Dela Cruz" />

Redirect to a URL upon failed ansaction:
<input type="text" name="failUrl" value="http://www.yahoo.com" />

Remark:
<input type="text" name="remark" value="Other Remarks" />

<input type="submit" value="Submit" id="btnSubmit"/>

</form>
</body>
</html>

WCF:

using System;
using System.Runtime.Serialization;
using System.ServiceModel;
using BasePayment.Entities;
using System.ServiceModel.Activation;

namespace BasePayment.WebService
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class PaymentComponent : IPaymentComponent
    {
        public void SendPayment(PaymentInformation payInfo)
        {
            PaymentInformation newPayInfo = new PaymentInformation();

            /*Validation of input goes here ...
             * 
             * 
             *
             * */

            // Then send data.
        }
    }
}  

INTERFACE OF WCF:

using System;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;

using BasePayment.Entities;

namespace BasePayment.WebService
{
    [ServiceContract(Namespace="http://test.com/services/payment")]
    public interface IPaymentComponent
    {
        [OperationContract]
        [WebInvoke(UriTemplate="PaymentInfo", Method="POST")]
        void SendPayment(PaymentInformation payInfo);
    }
}  

ENTITY FOR PAYMENT INFO:
I remove some properties to minimize the space consumption.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BasePayment.Entities
{
    public class PaymentInformation : IPaymentInformation
    {
        public PaymentInformation()
        {
        }

        public int ExpiryMonth
        {
            get;
            set;
        }

        public int ExpiryYear
        {
            get;
            set;
        }

        public int CreditCardVerificationCode
        {
            get;
            set;
        }

        public double Amount
        {
            get;
            set;
        }

        public string Language
        {
            get;
            set;
        }

        public string CardHolderName
        {
            get;
            set;
        }

        public string Remark
        {
            get;
            set;
        }

    }
}  

INTERFACE OF ENTITY:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BasePayment.Entities
{
    interface IPaymentInformation
    {
        long CreditCardNumber { get; set; }
        long OrderReferenceID { get; set; }

        int CurrencyCode { get; set; }
        int MerchantID { get; set; }
        int ExpiryMonth { get; set; }
        int ExpiryYear { get; set; }
        int CreditCardVerificationCode { get; set; }

        double Amount { get; set; }

        string Language { get; set; }
        string CardHolderName { get; set; }
        string URLUponFailed { get; set; }
        string URLUponSuccess { get; set; }
        string URLUponError { get; set; }
        string Remark { get; set; }

        PaymentMethod PaymentMethod { get; set; }
    }
}  

AND HERE IS THE PREVIEW OF MY PROJECT:

enter image description here

Thanks in advance !!!

  • 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-28T01:16:36+00:00Added an answer on May 28, 2026 at 1:16 am

    What you could do is post the inputs back to the server side code which in this case would be WebForm1.aspx.cs, what you need to do is set the inputs to runat=”server” or use aspx controls like the following:

        <asp:TextBox runat="server" id="merchantId" value="1546" />
    

    You would need to do this for all the inputs.
    Then in the Page load method you could go:

        protected void Page_Load(object sender, EventArgs e)
        {
            if(this.IsPostBack)
            {
                PaymentInformation newPayInfo = new PaymentInformation();
                newPayInfo.MerchantID = merchantId.Text; // to get text
                /* Validation of input goes here ... */
                // Then send data.
            }
        }
    

    That means you dont need to use WCF you can just use the page.

    Hope this makes sense

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JPA domain entity that I'm updating from user input. Depending on
I have two logical groups of input fields I need to validate separately using
I have 2 sets of 4 input fields in my HTML Form. I expect
I have a form with several input fields for a User to add their
I have ExtJS post data from a combofield to CodeIgniter. CodeIgniter reads the posted
I have a form that generates new input fields via JavaScript on click. the
Have a page where there are multiple input fields of the same thing, Posts.
I have two html text input fields and two buttons. The first button saves
i have this problem to find a particular xml node l have post this
http://demo.thethemefoundry.com/traction/#post-183 Which wordpress plugin is this, to have post image on the left side

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.