Help Needed in Adding Web Reference - .net core and .net framework

  • Thread starter Thread starter Born2Achieve
  • Start date Start date
B

Born2Achieve

Guest
Hi, i need to import the soap service in .net core 2.2 and i am able to do it. but the functionalities b/w .net framework import and .net core import differs. even methods also not same. below are the framework and core difference.

WSDL url : https://services.hcsprovider.com/hzwbsvc/services/BalanceInquiryServicePort?wsdl

the following proxy class created using the SVCUtil and the code works in .net framework 4.7.2 and am able to get the result and it has invalid user credentials which is correct

//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

//
// This source code was auto-generated by wsdl, Version=2.0.50727.1432.
//

namespace WiredCommute.Core.PCommuterCheckCard.Biz.ClientProxy
{
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "TCBalanceInquiryHandlerSoapBinding", Namespace = "http://localhost:8080/hcsz/services/TCBalanceInquiryHandler")]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(TCBalanceInquiryDto))]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(TCBalanceInquiryAdapter))]
public partial class TCBalanceInquiryHandlerService : System.Web.Services.Protocols.SoapHttpClientProtocol
{

private System.Threading.SendOrPostCallback processOperationCompleted;

private System.Threading.SendOrPostCallback processStringOperationCompleted;

/// <remarks/>
public TCBalanceInquiryHandlerService()
{
this.Url = "http://localhost:8080/hcsz/services/TCBalanceInquiryHandler";
}

/// <remarks/>
public event processCompletedEventHandler processCompleted;

/// <remarks/>
public event processStringCompletedEventHandler processStringCompleted;

/// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace = "http://localhost:8080/hcsz/services/TCBalanceInquiryHandler", ResponseNamespace = "http://localhost:8080/hcsz/services/TCBalanceInquiryHandler")]
[return: System.Xml.Serialization.SoapElementAttribute("processReturn")]
public TCBalanceInquiryResponse process(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType)
{
object[] results = this.Invoke("process", new object[] {
userID,
password,
requestedBankNumber,
requestedCardNumber,
requestedPurseNumber,
requestedPurseType});
return ((TCBalanceInquiryResponse)(results[0]));
}

/// <remarks/>
public System.IAsyncResult Beginprocess(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("process", new object[] {
userID,
password,
requestedBankNumber,
requestedCardNumber,
requestedPurseNumber,
requestedPurseType}, callback, asyncState);
}

/// <remarks/>
public TCBalanceInquiryResponse Endprocess(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((TCBalanceInquiryResponse)(results[0]));
}

/// <remarks/>
public void processAsync(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType)
{
this.processAsync(userID, password, requestedBankNumber, requestedCardNumber, requestedPurseNumber, requestedPurseType, null);
}

/// <remarks/>
public void processAsync(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType, object userState)
{
if ((this.processOperationCompleted == null))
{
this.processOperationCompleted = new System.Threading.SendOrPostCallback(this.OnprocessOperationCompleted);
}
this.InvokeAsync("process", new object[] {
userID,
password,
requestedBankNumber,
requestedCardNumber,
requestedPurseNumber,
requestedPurseType}, this.processOperationCompleted, userState);
}

private void OnprocessOperationCompleted(object arg)
{
if ((this.processCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.processCompleted(this, new processCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}

/// <remarks/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace = "http://localhost:8080/hcsz/services/TCBalanceInquiryHandler", ResponseNamespace = "http://localhost:8080/hcsz/services/TCBalanceInquiryHandler")]
[return: System.Xml.Serialization.SoapElementAttribute("processStringReturn")]
public string processString(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType)
{
object[] results = this.Invoke("processString", new object[] {
userID,
password,
requestedBankNumber,
requestedCardNumber,
requestedPurseNumber,
requestedPurseType});
return ((string)(results[0]));
}

/// <remarks/>
public System.IAsyncResult BeginprocessString(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("processString", new object[] {
userID,
password,
requestedBankNumber,
requestedCardNumber,
requestedPurseNumber,
requestedPurseType}, callback, asyncState);
}

/// <remarks/>
public string EndprocessString(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}

/// <remarks/>
public void processStringAsync(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType)
{
this.processStringAsync(userID, password, requestedBankNumber, requestedCardNumber, requestedPurseNumber, requestedPurseType, null);
}

/// <remarks/>
public void processStringAsync(string userID, string password, string requestedBankNumber, string requestedCardNumber, string requestedPurseNumber, string requestedPurseType, object userState)
{
if ((this.processStringOperationCompleted == null))
{
this.processStringOperationCompleted = new System.Threading.SendOrPostCallback(this.OnprocessStringOperationCompleted);
}
this.InvokeAsync("processString", new object[] {
userID,
password,
requestedBankNumber,
requestedCardNumber,
requestedPurseNumber,
requestedPurseType}, this.processStringOperationCompleted, userState);
}

private void OnprocessStringOperationCompleted(object arg)
{
if ((this.processStringCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.processStringCompleted(this, new processStringCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}

/// <remarks/>
public new void CancelAsync(object userState)
{
base.CancelAsync(userState);
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace = "urn:BeanService")]
public partial class TCBalanceInquiryResponse
{

private string cardNumberField;

private string employerIDField;

private object[] membersField;

private string organizationNumberField;

private string purseNumberField;

private string purseTypeField;

private string responseCodeField;

private string responseMessageField;

private object[] resultArtifactsField;

private string soapFaultField;

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string cardNumber
{
get
{
return this.cardNumberField;
}
set
{
this.cardNumberField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string employerID
{
get
{
return this.employerIDField;
}
set
{
this.employerIDField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public object[] members
{
get
{
return this.membersField;
}
set
{
this.membersField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string organizationNumber
{
get
{
return this.organizationNumberField;
}
set
{
this.organizationNumberField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string purseNumber
{
get
{
return this.purseNumberField;
}
set
{
this.purseNumberField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string purseType
{
get
{
return this.purseTypeField;
}
set
{
this.purseTypeField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string responseCode
{
get
{
return this.responseCodeField;
}
set
{
this.responseCodeField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string responseMessage
{
get
{
return this.responseMessageField;
}
set
{
this.responseMessageField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public object[] resultArtifacts
{
get
{
return this.resultArtifactsField;
}
set
{
this.resultArtifactsField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string soapFault
{
get
{
return this.soapFaultField;
}
set
{
this.soapFaultField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace = "urn:BeanService")]
public partial class TCBalanceInquiryDto
{

private string purseTypeField;

private string purseNumberField;

private string statusField;

private string descriptionField;

private string purseType1Field;

private string ledgerBalanceField;

private string authorizedBalanceField;

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string purseType
{
get
{
return this.purseTypeField;
}
set
{
this.purseTypeField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string purseNumber
{
get
{
return this.purseNumberField;
}
set
{
this.purseNumberField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string status
{
get
{
return this.statusField;
}
set
{
this.statusField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string description
{
get
{
return this.descriptionField;
}
set
{
this.descriptionField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute("purseType", IsNullable = true)]
public string purseType1
{
get
{
return this.purseType1Field;
}
set
{
this.purseType1Field = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string ledgerBalance
{
get
{
return this.ledgerBalanceField;
}
set
{
this.ledgerBalanceField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string authorizedBalance
{
get
{
return this.authorizedBalanceField;
}
set
{
this.authorizedBalanceField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace = "urn:BeanService")]
public partial class TCBalanceInquiryAdapter
{

private string accountNumberField;

private string accountTypeField;

private object[] artifactListField;

private string bankNumberField;

private string cardNumberField;

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string accountNumber
{
get
{
return this.accountNumberField;
}
set
{
this.accountNumberField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string accountType
{
get
{
return this.accountTypeField;
}
set
{
this.accountTypeField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public object[] artifactList
{
get
{
return this.artifactListField;
}
set
{
this.artifactListField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string bankNumber
{
get
{
return this.bankNumberField;
}
set
{
this.bankNumberField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(IsNullable = true)]
public string cardNumber
{
get
{
return this.cardNumberField;
}
set
{
this.cardNumberField = value;
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void processCompletedEventHandler(object sender, processCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class processCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{

private object[] results;

internal processCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}

/// <remarks/>
public TCBalanceInquiryResponse Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((TCBalanceInquiryResponse)(this.results[0]));
}
}
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
public delegate void processStringCompletedEventHandler(object sender, processStringCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.1432")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class processStringCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{

private object[] results;

internal processStringCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}

/// <remarks/>
public string Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
}



private static void GetBalance-Framework()
{
TCBalanceInquiryHandlerService InquiryService = new TCBalanceInquiryHandlerService();
BalanceInquiryService.Url = "https://www.hcsprovider.com/hcsz/services/TCBalanceInquiryHandler";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
var Response = InquiryService .process("Test1", "Test2", "T22", "5327970200001196", "5759768", "ALL");
}

But i did same adding the web reference in the .net core and the way calling the code is different in .net core.

private static void GetBalance-Core()
{
BalanceInquiryServiceClient balanceInquiryServiceClient =
new BalanceInquiryServiceClient(BalanceInquiryServiceClient.EndpointConfiguration.BalanceInquiryServicePort);

balanceInquiryServiceClient.ClientCredentials.UserName.UserName = "Test1";
balanceInquiryServiceClient.ClientCredentials.UserName.Password = "Test2";
BalanceByCardRequest balanceByCardRequest = new BalanceByCardRequest();
balanceByCardRequest.accountNumber = "5759768";
balanceByCardRequest.accountType = "All";
balanceByCardRequest.cardNumber = "5327970200001196";
balanceByCardRequest.orgId = "T22";

var resp = balanceInquiryServiceClient.GetBalanceByCardAsync(balanceByCardRequest);
}
but am not getting proper response what the .net framework gives. i coudn't figure out what's wrong. can anyone please help me in this. please correct the code if anything wrong.




loving dotnet

Continue reading...
 
Back
Top