猿问

使用 SAP Web 服务时数组不工作

我目前正在使用 SAP Web 服务,但唯一返回值的对象是那些没有子项的对象。


我对 SAP Web 服务的设置方式没有影响,所以不知道它是否正确,他们只是向我发送了看起来不错的链接和 XML。


由于如下所示的名为 System 的属性,我不得不进入 Reference.cs 并修改类,但由于该功能似乎有效,我认为这与问题无关:


[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]


[System.Xml.Serialization.XmlElementAttribute(Form=global::System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]

我已经尝试更改网络配置以查看绑定参数是否正在影响它。我已尝试将 Web 服务配置中的集合类型更改为使用 System.Array、通用列表。


不起作用的类如下所示:


[System.Xml.Serialization.XmlArrayAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]

[System.Xml.Serialization.XmlArrayItemAttribute("item", Form= System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]



        public Humans[] People{

            get {

                return this.crowd;

            }

            set {

                this.crowd= value;

                this.RaisePropertyChanged("Humans");

            }

        }

一个有效的类看起来像这样:


[System.Xml.Serialization.XmlElementAttribute( Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]


    public HandShake Return {

        get {

            return this.returnField;

        }

        set {

            this.returnField = value;

            this.RaisePropertyChanged("Return");

        }

    }

XML 如下所示:


<n0:SAPFunction>

  <Humans>

  <item>

     <name>Joe</name>

     <age>13</age>

     <town>The Shire</town>

   </item>

   <item>...</item>

</Humans>

<Return>

     <Id>0</Id>

    <Message>People Found</Message>

    <System/>

 </Return>

 </n0:SAPFunction>

所以基本上 Array 类都应该有项目,但我只得到一堆空数组和带有返回消息值的 HandShake 类。


请问有什么想法吗?


因此,SAP 团队在我打电话时发送给我的 XML 看起来不错,但任何需要项目的类,即


[System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]

只是行不通。类已创建,但它们没有任何项目。


茅侃侃
浏览 111回答 1
1回答

呼如林

所以我今天早上来测试了 Web 服务,嘿,它现在可以正常工作了。我什么都没改变,所以我问 SAP 人员他们是否有解释,就是这样:昨天我对类似结构类型的 RFC 进行了更改,以使用 Web 服务将结果也放入表中。我不确定这是否对任何事情都有用……我很高兴它终于起作用了!
随时随地看视频慕课网APP
我要回答