2

我创建了一个简单的 Net WebSvc 客户端,它接收 Sap WebSvc 的最新参考。它需要一个字符串和四个通过引用发送的元素:三个自定义对象数组和任何集合结构之外的另一个自定义对象(我在参考页面中有它们的格式)

当调用执行操作的请求时,我在调用行上收到 SoapException“反序列化失败”。(在底部我写:我的代码摘录,我调用的 Reference.cs 方法和错误,尽我所能。

通过网络调查,我发现这个Thread of a SAP forum 有人回答显示此错误的常见问题是成员变量名称中未更新的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

未处理

Message="反序列化失败"

源="系统.Web.服务"

演员=""Lang="en"节点=""

角色=“”堆栈跟踪:

   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage

消息、WebResponse 响应、流

responseStream,布尔异步调用)

   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String

方法名,对象 [] 参数)

   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

文档\Visual Studio

2005\项目\Desarrollo

SCM\scm.manager\SCM.Manager\Web

参考文献\mx.com.hylsamex.hmxwasd1\Reference.cs:第 85 行

   at SCM.Manager.SAPDataMockUp.SendOTs() in

D:\Documents and Settings\apacay\My

文档\Visual Studio

2005\项目\Desarrollo

SCM\scm.manager\SCM.Manager\SAPDataMockUp.cs:第 164 行

   at SCM.Manager.Threads.HandleSap.Send()

在 D:\Documents and Settings\apacay\My

文档\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

文档\Visual Studio

2005\项目\Desarrollo

SCM\scm.manager\SCM.Manager\Front.cs:第 170 行

   at System.AppDomain._nExecuteAssembly(Assembly

程序集,字符串 [] 参数)

   at System.AppDomain.ExecuteAssembly(String

汇编文件,证据

装配安全,字符串 [] 参数)

   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

   at System.Threading.ExecutionContext.Run(ExecutionContext

执行上下文,上下文回调

回调,对象状态)

   at System.Threading.ThreadHelper.ThreadStart()
4

0 回答 0