C# 为什么响应对象中的所有项都为空?

C# 为什么响应对象中的所有项都为空?,c#,wcf,wcf-client,C#,Wcf,Wcf Client,我目前编写了一个与SOAP Web服务交互的WCF客户机。 我的问题是我的响应对象总是保持零,即使是简单的类型。 没有例外 WSDL位置: THX 4帮助 App.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.diagnostics> <sources> <source name="System.Se

我目前编写了一个与SOAP Web服务交互的WCF客户机。 我的问题是我的响应对象总是保持零,即使是简单的类型。 没有例外

WSDL位置:

THX 4帮助

App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.diagnostics>
        <sources>
            <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
                <listeners>
                    <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                        <filter type="" />
                    </add>
                    <add name="BillSAFESServiceMessageLoggingListener">
                        <filter type="" />
                    </add>
                </listeners>
            </source>
        </sources>
        <sharedListeners>
            <add initializeData="BillSAFE.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                name="BillSAFESServiceMessageLoggingListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
                <filter type="" />
            </add>
        </sharedListeners>
    </system.diagnostics>
    <system.serviceModel>
        <behaviors>
            <endpointBehaviors>
                <behavior name="BillSAFEServiceBehavior">
                    <callbackDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </endpointBehaviors>
        </behaviors>
        <bindings>
            <customBinding>
                <binding name="BillSAFEServiceBinding" receiveTimeout="00:01:00">
                    <textMessageEncoding messageVersion="Soap11" />
                    <httpsTransport />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="https://sandbox-soap.billsafe.de/V209" behaviorConfiguration="BillSAFEServiceBehavior"
                binding="customBinding" bindingConfiguration="BillSAFEServiceBinding"
                contract="BillSAFE.V209.IBillSAFEService" name="BillSAFEServiceSandbox"
                kind="" endpointConfiguration="" />
        </client>
        <diagnostics performanceCounters="Default">
            <messageLogging logEntireMessage="true" logKnownPii="true" logMalformedMessages="true"
                logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
        </diagnostics>
    </system.serviceModel>
</configuration>
GetAgreedHandlingChargesResponse.cs

[MessageContract(WrapperName = "getAgreedHandlingChargesResponse", WrapperNamespace = "urn:BillSAFE", IsWrapped = true)]
public class GetAgreedHandlingChargesResponse : Response
{
    [MessageBodyMember(Name = "agreedCharge", Namespace = "urn:BillSAFE")]
    public ICollection<AgreedHandlingCharge> AgreedCharge { get; set; }

    public GetAgreedHandlingChargesResponse()
    {
        this.AgreedCharge = new List<AgreedHandlingCharge>();
    }
}
[MessageContract(WrapperNamespace = "urn:BillSAFE", IsWrapped = true)]
public abstract class Response
{
    [MessageBodyMember(Name = "ack")]
    public string Ack { get; set; }

    [MessageBodyMember(Name = "errorList")]
    public ICollection<Error> ErrorList { get; set; }

    protected Response()
    {
        //this.Ack = V209.Ack.Error;
        this.ErrorList = new List<Error>();
    }
}
E2ETraceEvent(请求)

试验方法

    [TestMethod]
    public async Task GetAgreedHandlingChargesAsyncTestMethod()
    {
        using (BillSAFEServiceClient serviceClient = new BillSAFEServiceClient("BillSAFEServiceSandbox"))
        {
            try
            {
                GetAgreedHandlingChargesResponse response = await serviceClient.GetAgreedHandlingChargesAsync(new GetAgreedHandlingChargesRequest()
                {
                    Merchant = this.GetMerchant(),
                    Application = this.GetApplication()
                });

                if (response.Ack == "")
                {

                }
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
@艾伦

[DataContract(Name=“getAgreedHandlingChargesRequest”)]
[MessageContract(WrapperName=“getAgreedHandlingChargesRequest”,WrapperNamespace=“urn:BillSAFE”,IsWrapped=true)]
公共类GetAgreedHandlingChargesRequest:请求
{
}
[DataContract(Name=“getAgreedHandlingChargesResponse”)]
[MessageContract(WrapperName=“getAgreedHandlingChargesResponse”,WrapperNamespace=“urn:BillSAFE”,IsWrapped=true)]
公共类GetAgreedHandlingCharges响应:响应
{
#区域属性
/// 
/// 
/// 
[DataMember(Name=“agreedCharge”)]
[MessageBodyMember(Name=“agreedCharge”,Namespace=“urn:BillSAFE”)]
公共ICollection AgreedCharge{get;set;}
#端区
#区域构造函数
/// 
/// 
/// 
公共GetAgreedHandlingChargesResponse()
{
this.AgreedCharge=新列表();
}
#端区
}
[数据合同]
[MessageContract(WrapperNamespace=“urn:BillSAFE”,IsWrapped=true)]
公共抽象类响应
{
#区域属性
/// 
/// 
/// 
[数据成员(Name=“ack”)]
[MessageBodyMember(Name=“ack”)]
公共字符串Ack{get;set;}
/// 
/// 
/// 
[DataMember(Name=“errorList”)]
[MessageBodyMember(Name=“errorList”)]
公共ICollection错误列表{get;set;}
#端区
#区域构造函数
/// 
/// 
/// 
受保护响应()
{
//this.Ack=V209.Ack.Error;
this.ErrorList=新列表();
}
#端区
}
[数据合同]
[MessageContract(WrapperNamespace=“urn:BillSAFE”,IsWrapped=true)]
公共抽象类请求
{
#区域属性
/// 
/// 
/// 
[DataMember(Name=“商户”)]
[MessageBodyMember(Name=“merchant”,Namespace=“urn:BillSAFE”)]
公共商户{get;set;}
/// 
/// 
/// 
[DataMember(Name=“application”)]
[MessageBodyMember(Name=“application”,Namespace=“urn:BillSAFE”)]
公共应用程序应用程序{get;set;}
#端区
}

关于您的类:商户、应用程序、错误等。在类声明上方添加
[DataContract]
,在所有属性上方添加
[DataMember]
,如:

[DataContract]
public class Merchant
{
    [DataMember] 
    public int SomeVariable { get; set; }

    ...
}

另外,我注意到您的
MessageBodyMember
名称和类名之间存在一些大小写差异,您是否尝试将它们更改为相同的名称?

好的,我刚刚发现错误,我再次查看了xml响应。其中所有属性都没有命名空间。这一点必须明确说明

SOAP响应

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:BillSAFE">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"></s:Header>
<SOAP-ENV:Body>
<ns1:getAgreedHandlingChargesResponse>
<ack xmlns="">ERROR</ack>
<errorList xmlns="">
<code>305</code>
<message>No data to return</message>
</errorList>
</ns1:getAgreedHandlingChargesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
C#

[MessageContract(WrapperNamespace=“urn:BillSAFE”,IsWrapped=true]
公共抽象类响应
{
#区域属性
/// 
/// 
/// 
[MessageBodyMember(Name=“ack”,Namespace=”“)]
公共确认{get;set;}
/// 
/// 
/// 
[MessageBodyMember(Name=“errorList”,Namespace=”“)]
公共ICollection错误列表{get;set;}
#端区
#区域构造函数
/// 
/// 
/// 
受保护响应()
{
this.Ack=V209.Ack.Error;
this.ErrorList=新列表();
}
#端区
}

这不起作用。我已经测试过了吗。Show:甚至response.ACK也为null。有时,如果客户端和服务器之间生成的内容不匹配,命名空间(如C#命名空间)可能会导致问题。如果ServiceContract属性的Namespace属性与服务器上的属性不匹配,则可能会导致类似的问题。确保您的命名空间在客户端和服务器之间全面同步。无论您使用的是哪种属性(ServiceContract、MessageBodyMember等),我现在都有这个问题,最多3天。我已经对名称空间进行了10次测试。也就是说,请求的工作没有问题,只是响应似乎没有被填充。此外,一旦配置属性callbackDebug.includeExceptionDetailInFaults启用,将生成异常。您添加的示例没有显示您如何尝试将[DataContract]等添加到类和属性中。你能用一个这样的例子来替换TestMethod吗?当你在做的时候,移除那些try/catch块
try{…}catch(Exception){throw;}
..
是一回事,但不会浪费那么多时间。
[MessageContract(WrapperNamespace = "urn:BillSAFE", IsWrapped=true)]
public abstract class Request
{
    [MessageBodyMember(Name = "merchant", Namespace = "urn:BillSAFE")]
    public Merchant Merchant { get; set; }

    [MessageBodyMember(Name = "application", Namespace = "urn:BillSAFE")]
    public Application Application { get; set; }
}
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>0</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2013-01-17T20:54:31.1064522Z" />
<Source Name="System.ServiceModel.MessageLogging" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="vstest.executionengine.x86" ProcessID="8812" ThreadID="8" />
<Channel />
<Computer>SEBASTIAN-PC</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<MessageLogTraceRecord Time="2013-01-17T21:54:31.1064522+01:00" Source="TransportSend" Type="System.ServiceModel.Dispatcher.OperationFormatter+OperationFormatterMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
<Addressing>
<Action>urn:BillSAFE/IBillSAFEService/getAgreedHandlingCharges</Action>
<To>https://sandbox-soap.billsafe.de/V209</To>
</Addressing>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo4Y6WSDqKJ5EkZhFjJEu4DAAAAAAs2bp4OEOTEWhpHQOICljk07jg5xHVctBqgCzT6DCuOAACQAA</VsDebuggerCausalityData>
</s:Header>
<s:Body>
<getAgreedHandlingChargesRequest xmlns="urn:BillSAFE">
<application xmlns:a="http://schemas.datacontract.org/2004/07/BillSAFE.V209" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:signature>###########</a:signature>
<a:version>>###########</a:version>
</application>
<merchant xmlns:a="http://schemas.datacontract.org/2004/07/BillSAFE.V209" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:id>>###########</a:id>
<a:license>>###########</a:license>
</merchant>
</getAgreedHandlingChargesRequest>
</s:Body>
</s:Envelope>
</MessageLogTraceRecord>
</DataItem>
</TraceData>
<System.Diagnostics xmlns="http://schemas.microsoft.com/2004/08/System.Diagnostics">
<LogicalOperationStack></LogicalOperationStack>
<Timestamp>752163894457</Timestamp>
<Callstack>
bei System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
bei System.Environment.get_StackTrace()
bei System.Diagnostics.TraceEventCache.get_Callstack()
bei System.Diagnostics.XmlWriterTraceListener.WriteFooter(TraceEventCache eventCache)
bei System.Diagnostics.XmlWriterTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
bei System.Diagnostics.TraceSource.TraceData(TraceEventType eventType, Int32 id, Object data)
bei System.ServiceModel.Diagnostics.MessageLogger.LogInternal(MessageLoggingSource source, Object data)
bei System.ServiceModel.Diagnostics.MessageLogger.LogInternal(MessageLogTraceRecord record)
bei System.ServiceModel.Diagnostics.MessageLogger.LogMessageImpl(Message& message, XmlReader reader, MessageLoggingSource source)
bei System.ServiceModel.Diagnostics.MessageLogger.LogMessage(Message& message, XmlReader reader, MessageLoggingSource source)
bei System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
bei System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)
bei System.ServiceModel.Channels.HttpOutput.SendAsyncResult.SendWithoutChannelBindingToken()
bei System.ServiceModel.Channels.HttpOutput.SendAsyncResult.Send()
bei System.ServiceModel.Channels.HttpOutput.SendAsyncResult..ctor(HttpOutput httpOutput, HttpResponseMessage httpResponseMessage, Boolean suppressEntityBody, TimeSpan timeout, AsyncCallback callback, Object state)
bei System.ServiceModel.Channels.HttpOutput.BeginSendCore(HttpResponseMessage httpResponseMessage, TimeSpan timeout, AsyncCallback callback, Object state)
bei System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.SendWebRequest()
bei System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.BeginSendRequest(Message message, TimeSpan timeout)
bei System.ServiceModel.Channels.RequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
bei System.ServiceModel.Dispatcher.RequestChannelBinder.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, Object state)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartSend(Boolean completedSynchronously)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.FinishEnsureOpen(IAsyncResult result, Boolean completedSynchronously)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartEnsureOpen(Boolean completedSynchronously)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.FinishEnsureInteractiveInit(IAsyncResult result, Boolean completedSynchronously)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.StartEnsureInteractiveInit()
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.Begin()
bei System.ServiceModel.Channels.ServiceChannel.BeginCall(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, TimeSpan timeout, AsyncCallback callback, Object asyncState)
bei System.ServiceModel.Channels.ServiceChannel.BeginCall(ServiceChannel channel, ProxyOperationRuntime operation, Object[] ins, AsyncCallback callback, Object asyncState)
bei System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1,TArg2,TArg3](Func`6 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state, TaskCreationOptions creationOptions)
bei System.Threading.Tasks.TaskFactory`1.FromAsync[TArg1,TArg2,TArg3](Func`6 beginMethod, Func`2 endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, Object state)
bei System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.CreateGenericTask[T](ServiceChannel channel, ProxyOperationRuntime operation, Object[] inputParameters)
bei System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.CreateGenericTask(ServiceChannel channel, ProxyOperationRuntime operation, Object[] inputParameters)
bei System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.CreateTask(ServiceChannel channel, IMethodCallMessage methodCall, ProxyOperationRuntime operation)
bei System.ServiceModel.Channels.ServiceChannelProxy.InvokeTaskService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
bei System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
bei System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
bei BillSAFE.V209.IBillSAFEService.GetAgreedHandlingChargesAsync(GetAgreedHandlingChargesRequest request)
bei BillSAFE.V209.BillSAFEServiceClient.GetAgreedHandlingChargesAsync(GetAgreedHandlingChargesRequest request) in d:\Eigene Dokumente\Visual Studio 2012\Projects\BillSAFEManager\BillSAFE\V209\BillSAFEServiceClient.cs:Zeile 149.
bei BillSAFE.UnitTest.BillSAFEServiceClientUnitTest.<GetAgreedHandlingChargesAsyncTestMethod>d__2.MoveNext() in d:\Eigene Dokumente\Visual Studio 2012\Projects\BillSAFEManager\BillSAFE.UnitTest\BillSAFEServiceClientUnitTest.cs:Zeile 67.
bei System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
bei System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
bei BillSAFE.UnitTest.BillSAFEServiceClientUnitTest.GetAgreedHandlingChargesAsyncTestMethod()
bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
bei System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
bei Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.DefaultTestMethodInvoke(Object[] args)
bei Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.RunTestMethod()
bei Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.ExecuteTest(TestExecutionOutputs testExecutionOutputs)
bei Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.ExecuteInternal(TestExecutionOutputs testExecutionOutputs)
bei Microsoft.VisualStudio.TestPlatform.MSTestFramework.TestMethodRunner.Execute()
bei Microsoft.VisualStudio.TestPlatform.MSTestFramework.UnitTestRunner.RunInternal(TestMethod testMethod, Boolean isDataDriven)
bei Microsoft.VisualStudio.TestPlatform.MSTestFramework.UnitTestRunner.RunSingleTest(String name, String fullClassName, Boolean isAsync)
</Callstack>
</System.Diagnostics>
</ApplicationData>
</E2ETraceEvent>
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>0</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2013-01-17T20:54:31.5263682Z" />
<Source Name="System.ServiceModel.MessageLogging" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="vstest.executionengine.x86" ProcessID="8812" ThreadID="12" />
<Channel />
<Computer>SEBASTIAN-PC</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<MessageLogTraceRecord Time="2013-01-17T21:54:31.5253905+01:00" Source="TransportReceive" Type="System.ServiceModel.Channels.BufferedMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">
<HttpResponse>
<StatusCode>OK</StatusCode>
<StatusDescription>OK</StatusDescription>
<WebHeaders>
<Connection>close</Connection>
<Vary>Accept-Encoding</Vary>
<Content-Encoding></Content-Encoding>
<Content-Length>241</Content-Length>
<Content-Type>text/xml; charset=utf-8</Content-Type>
<Date>Thu, 17 Jan 2013 20:54:31 GMT</Date>
<Server>Apache</Server>
</WebHeaders>
</HttpResponse>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:BillSAFE">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"></s:Header>
<SOAP-ENV:Body>
<ns1:getAgreedHandlingChargesResponse>
<ack xmlns="">ERROR</ack>
<errorList xmlns="">
<code>305</code>
<message>No data to return</message>
</errorList>
</ns1:getAgreedHandlingChargesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</MessageLogTraceRecord>
</DataItem>
</TraceData>
<System.Diagnostics xmlns="http://schemas.microsoft.com/2004/08/System.Diagnostics">
<LogicalOperationStack></LogicalOperationStack>
<Timestamp>752164731996</Timestamp>
<Callstack>
bei System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
bei System.Environment.get_StackTrace()
bei System.Diagnostics.TraceEventCache.get_Callstack()
bei System.Diagnostics.XmlWriterTraceListener.WriteFooter(TraceEventCache eventCache)
bei System.Diagnostics.XmlWriterTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
bei System.Diagnostics.TraceSource.TraceData(TraceEventType eventType, Int32 id, Object data)
bei System.ServiceModel.Diagnostics.MessageLogger.LogInternal(MessageLoggingSource source, Object data)
bei System.ServiceModel.Diagnostics.MessageLogger.LogInternal(MessageLogTraceRecord record)
bei System.ServiceModel.Diagnostics.MessageLogger.LogMessageImpl(Message& message, XmlReader reader, MessageLoggingSource source)
bei System.ServiceModel.Diagnostics.MessageLogger.LogMessage(Message& message, XmlReader reader, MessageLoggingSource source)
bei System.ServiceModel.Channels.HttpInput.ProcessHttpAddressing(Message message)
bei System.ServiceModel.Channels.HttpInput.ParseMessageAsyncResult.BeginParse()
bei System.ServiceModel.Channels.HttpInput.BeginParseIncomingMessage(HttpRequestMessage httpRequestMessage, AsyncCallback callback, Object state)
bei System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.ProcessResponse(HttpWebResponse response, WebException responseException)
bei System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
bei System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.OnGetResponse(IAsyncResult result)
bei System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
bei System.Net.LazyAsyncResult.Complete(IntPtr userToken)
bei System.Net.ContextAwareResult.CompleteCallback(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Net.ContextAwareResult.Complete(IntPtr userToken)
bei System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
bei System.Net.HttpWebRequest.ProcessResponse()
bei System.Net.HttpWebRequest.SetResponse(CoreResponseData coreResponseData)
bei System.Net.HttpWebRequest.SetAndOrProcessResponse(Object responseOrException)
bei System.Net.ConnectionReturnResult.SetResponses(ConnectionReturnResult returnResult)
bei System.Net.Connection.ReadComplete(Int32 bytesRead, WebExceptionStatus errorStatus)
bei System.Net.Connection.ReadCallback(IAsyncResult asyncResult)
bei System.Net.Connection.ReadCallbackWrapper(IAsyncResult asyncResult)
bei System.Net.LazyAsyncResult.Complete(IntPtr userToken)
bei System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
bei System.Net.Security._SslStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
bei System.Net.Security._SslStream.ReadFrameCallback(AsyncProtocolRequest asyncRequest)
bei System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
bei System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
bei System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
bei System.Net.LazyAsyncResult.Complete(IntPtr userToken)
bei System.Net.ContextAwareResult.CompleteCallback(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Net.ContextAwareResult.Complete(IntPtr userToken)
bei System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
bei System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
bei System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</Callstack>
</System.Diagnostics>
</ApplicationData>
</E2ETraceEvent>
    [TestMethod]
    public async Task GetAgreedHandlingChargesAsyncTestMethod()
    {
        using (BillSAFEServiceClient serviceClient = new BillSAFEServiceClient("BillSAFEServiceSandbox"))
        {
            try
            {
                GetAgreedHandlingChargesResponse response = await serviceClient.GetAgreedHandlingChargesAsync(new GetAgreedHandlingChargesRequest()
                {
                    Merchant = this.GetMerchant(),
                    Application = this.GetApplication()
                });

                if (response.Ack == "")
                {

                }
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
[DataContract(Name = "getAgreedHandlingChargesRequest")]
[MessageContract(WrapperName = "getAgreedHandlingChargesRequest", WrapperNamespace = "urn:BillSAFE", IsWrapped = true)]
public class GetAgreedHandlingChargesRequest : Request
{

}

[DataContract(Name = "getAgreedHandlingChargesResponse")]
[MessageContract(WrapperName = "getAgreedHandlingChargesResponse", WrapperNamespace = "urn:BillSAFE", IsWrapped = true)]
public class GetAgreedHandlingChargesResponse : Response
{
    #region Properties

    /// <summary>
    /// 
    /// </summary>
    [DataMember(Name = "agreedCharge")]
    [MessageBodyMember(Name = "agreedCharge", Namespace = "urn:BillSAFE")]
    public ICollection<AgreedHandlingCharge> AgreedCharge { get; set; }

    #endregion

    #region Constructor

    /// <summary>
    /// 
    /// </summary>
    public GetAgreedHandlingChargesResponse()
    {
        this.AgreedCharge = new List<AgreedHandlingCharge>();
    }

    #endregion
}

[DataContract]
[MessageContract(WrapperNamespace = "urn:BillSAFE", IsWrapped = true)]
public abstract class Response
{
    #region Properties

    /// <summary>
    /// 
    /// </summary>
    [DataMember(Name = "ack")]
    [MessageBodyMember(Name = "ack")]
    public string Ack { get; set; }

    /// <summary>
    /// 
    /// </summary>
    [DataMember(Name = "errorList")]
    [MessageBodyMember(Name = "errorList")]
    public ICollection<Error> ErrorList { get; set; }

    #endregion

    #region Constructor

    /// <summary>
    /// 
    /// </summary>
    protected Response()
    {
        //this.Ack = V209.Ack.Error;
        this.ErrorList = new List<Error>();
    }

    #endregion
}

[DataContract]
[MessageContract(WrapperNamespace = "urn:BillSAFE", IsWrapped=true)]
public abstract class Request
{
    #region Properties

    /// <summary>
    /// 
    /// </summary>
    [DataMember(Name = "merchant")]
    [MessageBodyMember(Name = "merchant", Namespace = "urn:BillSAFE")]
    public Merchant Merchant { get; set; }

    /// <summary>
    /// 
    /// </summary>
    [DataMember(Name = "application")]
    [MessageBodyMember(Name = "application", Namespace = "urn:BillSAFE")]
    public Application Application { get; set; }

    #endregion
}
[DataContract]
public class Merchant
{
    [DataMember] 
    public int SomeVariable { get; set; }

    ...
}
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:BillSAFE">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"></s:Header>
<SOAP-ENV:Body>
<ns1:getAgreedHandlingChargesResponse>
<ack xmlns="">ERROR</ack>
<errorList xmlns="">
<code>305</code>
<message>No data to return</message>
</errorList>
</ns1:getAgreedHandlingChargesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
[MessageContract(WrapperNamespace = "urn:BillSAFE", IsWrapped = true)]
public abstract class Response
{
    #region Properties

    /// <summary>
    /// 
    /// </summary>
    [MessageBodyMember(Name = "ack", Namespace = "")]
    public Ack Ack { get; set; }

    /// <summary>
    /// 
    /// </summary>
    [MessageBodyMember(Name = "errorList", Namespace = "")]
    public ICollection<Error> ErrorList { get; set; }

    #endregion

    #region Constructor

    /// <summary>
    /// 
    /// </summary>
    protected Response()
    {
        this.Ack = V209.Ack.Error;
        this.ErrorList = new List<Error>();
    }

    #endregion
}