我创建了一个简单的Net WebSvc客户端,它接收Sap WebSvc的最新参考。它需要一个String,以及通过引用发送的四个元素:三个自定义对象数组和另一个自定义对象在任何集合结构之外(我在参考页面中有它们的格式)
当调用执行操作的请求时,我在调用行上遇到SoapException“Deserialization failed”。 (在底部我写:我的代码的摘录,我调用的Reference.cs方法,以及错误,尽可能完整。)
通过网络调查,我发现了一个SAP论坛的this主题,有人回答显示此错误的常见问题,未更新wsdl 和下划线成员变量名称,但它们都不是我的情况。事实上,线程仍在继续,但没有对与我有同样问题的人做出任何回应。
无论如何,我猜StackOverflow的人比这更活跃; - )
先谢谢大家!
我的代码摘录:
string destiny = "myDest";
ZICQService ZICQ = new ZICQService();
ZtyEE070[] innerHeadList = HeadLst.ToArray();
ZtyEE071[] innerObjList = ObjLst.ToArray();
Zrequest[] innerTRequest = TRequest.ToArray();
//This is the row of the Deserialization failed
Bapiret2 respnse = svc.ZbcInsertRequest(destiny, ref innerHeadList, ref innerObjList, IClrQst, ref innerTRequest);
这是我的网络服务 Reference.cs附加方法:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute
("", RequestNamespace="urn:sap-com:document:sap:soap:functions:mc-style",
ResponseNamespace="urn:sap-com:document:sap:soap:functions:mc-style",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("Return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public Bapiret2 ZbcInsertRequest(
[System.Xml.Serialization.XmlElementAttribute
(Form=XmlSchemaForm.Unqualified)]
string Destino,
[System.Xml.Serialization.XmlArrayAttribute
(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute
("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
ref ZtyEE070[] EtRequestHeader,
[System.Xml.Serialization.XmlArrayAttribute
(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute
("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
ref ZtyEE071[] EtRequestObj,
[System.Xml.Serialization.XmlElementAttribute
(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
Zclrqstdat IClrqst,
[System.Xml.Serialization.XmlArrayAttribute
(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute
("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
ref Zrequest[] TRequest)
{
object[] results = this.Invoke("ZbcInsertRequest", new object[] {
Destino,
EtRequestHeader,
EtRequestObj,
IClrqst,
TRequest});
EtRequestHeader = ((ZtyEE070[])(results[1]));
EtRequestObj = ((ZtyEE071[])(results[2]));
TRequest = ((Zrequest[])(results[3]));
return ((Bapiret2)(results[0]));
}
错误:
System.Web.Services.Protocols.SoapException
未处理
消息=“反序列化失败”
Source =“System.Web.Services”
Actor =“”Lang =“en”Node =“”
Role =“”StackTrace:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
消息,WebResponse响应,流
responseStream,Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName,Object []参数)
at SCM.Manager.mx.com.hylsamex.hmxwasd1.ZICQService.ZbcInsertRequest(String
Destino,ZtyEE070 []& EtRequestHeader,
ZtyEE071 []&安培; EtRequestObj,Zclrqstdat
IClrqst,Zrequest []&
中的TRequest)D:\ Documents and Settings \ apacay \ My
Documents \ Visual Studio
2005 \项目\ DESARROLLO
SCM \ scm.manager \ SCM.Manager \网络
参考文献\ mx.com.hylsamex.hmxwasd1 \ Reference.cs:第85行
at SCM.Manager.SAPDataMockUp.SendOTs() in
D:\ Documents and Settings \ apacay \ My
Documents \ Visual Studio
2005 \项目\ DESARROLLO
SCM \ scm.manager \ SCM.Manager \ SAPDataMockUp.cs:第164行
at SCM.Manager.Threads.HandleSap.Send()
在D:\ Documents and Settings \ apacay \ My
中Documents \ Visual Studio
2005 \项目\ DESARROLLO
SCM \ scm.manager \ SCM.Manager \ Threads \ HandleSap.cs:第24行
at SCM.Manager.Front.Main(String[] args)
在D:\ Documents and Settings \ apacay \ My
中Documents \ Visual Studio
2005 \项目\ DESARROLLO
SCM \ scm.manager \ SCM.Manager \ Front.cs:第170行
at System.AppDomain._nExecuteAssembly(Assembly
assembly,String [] args)
at System.AppDomain.ExecuteAssembly(String
assemblyFile,Evidence
assemblySecurity,String [] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext,ContextCallback
回调,对象状态)
at System.Threading.ThreadHelper.ThreadStart()