Alkite Odayte

Alkite Odayte

  • NA
  • 51
  • 623

Name Space and Message Formating

Jan 9 2020 4:57 AM
FAST RESPONSE: I create a WCF web service that is expected to give this response.
 

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://tempuri.org/">

   <env:Body>

      <tem:ApplyTransactionResponse xmlns:at="http://cps.huawei.com/cpsinterface/goa/at" xmlns:goa="http://cps.huawei.com/cpsinterface/goa" xmlns:tem="http://tempuri.org/">

         <at:ResponseCode>0</at:ResponseCode>

         <at:ResponseDesc>success</at:ResponseDesc>

         <at:Parameters>

            <goa:Parameter>

               <goa:Key>BillRefNumber</goa:Key>

               <goa:Value>73011</goa:Value>

            </goa:Parameter>

            <goa:Parameter>

               <goa:Key>TransID</goa:Key>

               <<goa:Value>fr34fg567</goa:Value>

            </goa:Parameter>

            <goa:Parameter>

               <goa:Key>UtilityName</goa:Key>

               <goa:Value>GoldenTransport</goa:Value>

            </goa:Parameter>

            <goa:Parameter>

               <goa:Key>CustomerName</goa:Key>

               <goa:Value>Abebe</goa:Value>

            </goa:Parameter>

            <goa:Parameter>

               <goa:Key>Amount</goa:Key>

               <goa:Value>50</goa:Value>

            </goa:Parameter>

         </at:Parameters>

      </tem:ApplyTransactionResponse>

   </env:Body>

</env:Envelope>

 
My Code Returns the format Below: I chnage the soap version to 1.2
 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header />
  <s:Body>
    <C2BPaymentQueryRequestResponse xmlns="http://tempuri.org/">
      <C2BPaymentQueryRequestResult xmlns:a="http://schemas.datacontract.org/2004/07/YaybePayBill" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <a:Amount>200.00</a:Amount>
        <a:BillRefNumber>14233</a:BillRefNumber>
        <a:CustomerName>NA R.N= 481</a:CustomerName>
        <a:ResultCode>0</a:ResultCode>
        <a:ResultDesc>Previous:53m3/Actual:53m3/Cons:0m3/Months:100</a:ResultDesc>
        <a:TransID>BSR309557</a:TransID>
        <a:UtilityName>Adwa Town Water Supply and Sewerage Service</a:UtilityName>
      </C2BPaymentQueryRequestResult>
    </C2BPaymentQueryRequestResponse>
  </s:Body>
</s:Envelope>
 
 My Code Is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Web;
using System.Text;
using System.Data;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;

namespace PayBill
{
    [ServiceContract]
    [DefaultValue(SoapProtocolVersion.Soap12)]   

    interface IPayBillService
    {
        [OperationContract]
        C2BPaymentQueryRequest C2BPaymentQueryRequest(string Password, string ShortCode, string CommandID, string BillRefNumber, C2BPaymentQueryRequest Response);

        [OperationContract]
        C2BPaymentValidationRequest C2BPaymentValidationRequest(string TransType, string TransID, string TransTime, string TransAmount, string BusinessShortCode, string BillRefNumber, string InvoiceNumber, string MSISDN, C2BPaymentValidationRequest Response);

        [OperationContract]
        C2BPaymenConfirmationRequest C2BPaymenConfirmationRequest(string TransType, string TransID, string TransTime, string TransAmount, string BusinessShortCode, string BillRefNumber, string InvoiceNumber, string OrgAccountBalance, string ThirdPartyTransID, string MSISDN, C2BPaymenConfirmationRequest Response);
    }

    [DataContract]
    public class C2BPaymentQueryRequest
    {
        string resultCode;
        string resultDesc;
        string billRefNumber;
        string transID;
        string utilityName;
        string customerName;
        string amount;

        [DataMember]
        public string ResultCode
        {
            get { return resultCode; }
            set { resultCode = value; }
        }
        [DataMember]
        public string ResultDesc
        {
            get { return resultDesc; }
            set { resultDesc = value; }
        }
        [DataMember]
        public string BillRefNumber
        {
            get { return billRefNumber; }
            set { billRefNumber = value; }
        }
        [DataMember]
        public string TransID
        {
            get { return transID; }
            set { transID = value; }
        }
        [DataMember]
        public string UtilityName
        {
            get { return utilityName; }
            set { utilityName = value; }
        }
        [DataMember]
        public string CustomerName
        {
            get { return customerName; }
            set { customerName = value; }
        }
        [DataMember]
        public string Amount
        {
            get { return amount; }
            set { amount = value; }
        }
    }   

    [DataContract]
    public class C2BPaymentValidationRequest
    {
        string resultCode;
        string resultDesc;       
        string thirdPartyTransID;
        [DataMember]
        public string ResultCode
        {
            get { return resultCode; }
            set { resultCode = value; }
        }
        [DataMember]
        public string ResultDesc
        {
            get { return resultDesc; }
            set { resultDesc = value; }
        }
        [DataMember]
        public string ThirdPartyTransID
        {
            get { return thirdPartyTransID; }
            set { thirdPartyTransID = value; }
        }
    }

    [DataContract]
    public class C2BPaymenConfirmationRequest
    {
    }
}
 
Please find the attached Project. Please Help.

Attachment: PayBill.rar