eLogisticWS.LogisticWsService ws = new eLogisticWS.LogisticWsService();
eLogisticWS.AToken objToken = new eLogisticWS.AToken();
objToken = ws.authenticate("username", "password");
แต่ปรากฏว่ามันแสดง errror ว่า
Code
System.InvalidOperationException was unhandled by user code
Message="There is an error in XML document (2, 659)."
Source="System.Xml"
StackTrace:
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at eLogisticWS.LogisticWsService.authenticate(String username, String password) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\demobangkokservex\ad7f678e\dcf5747e\App_WebReferences._cghamuo.0.cs:line 123
at _Default.Page_Load(Object sender, EventArgs e) in c:\Users\xxxx\Documents\Visual Studio 2008\WebSites\xxProject\Default.aspx.cs:line 28
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: System.InvalidCastException
Message="Cannot assign object of type System.Xml.XmlNode[] to an object of type eLogisticWS.AToken."
Source="kb-yxdg-"
StackTrace:
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderLogisticWsService.Read21_authenticateResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer23.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
InnerException: