使用 SAP Web 服务时数组不工作
Arrays not working when consuming SAP Webservices
我目前正在使用 SAP Web 服务,但唯一 return 带有值的对象是那些没有子项的对象。
我对 SAP Web 服务的设置方式没有影响,所以不知道它是否正确,他们只是向我发送了看起来不错的 link 和 XML。
我不得不进入 Reference.cs 并修改 class,因为 属性 被命名为系统,如下所示,但由于该功能似乎有效,我不认为这是与问题有任何关系:
[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、通用列表。
不起作用的 classes 看起来像这样:
[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");
}
}
有效的 class 看起来像这样:
[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 classes 应该都有项目,但我只是得到了一堆空数组和 HandShake class 以及 return 消息值。
有什么想法吗?
因此,SAP 团队在我打电话时发送给我的 XML 看起来不错,但任何 class 都需要项目,即
[System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
只是行不通。 classes 已创建,但它们没有任何项目。
所以我今天早上来测试了 Web-services,嘿,它现在可以用了。
我没有做任何更改,所以我问 SAP 人员他们是否有解释,就是这样:
Yesterday I made changes to RFC like structure type to get the result into the table too using web service.
我不确定这是否对任何事情都有用...我很高兴它终于起作用了!
我目前正在使用 SAP Web 服务,但唯一 return 带有值的对象是那些没有子项的对象。
我对 SAP Web 服务的设置方式没有影响,所以不知道它是否正确,他们只是向我发送了看起来不错的 link 和 XML。
我不得不进入 Reference.cs 并修改 class,因为 属性 被命名为系统,如下所示,但由于该功能似乎有效,我不认为这是与问题有任何关系:
[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、通用列表。
不起作用的 classes 看起来像这样:
[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");
}
}
有效的 class 看起来像这样:
[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 classes 应该都有项目,但我只是得到了一堆空数组和 HandShake class 以及 return 消息值。
有什么想法吗?
因此,SAP 团队在我打电话时发送给我的 XML 看起来不错,但任何 class 都需要项目,即
[System.Xml.Serialization.XmlArrayItemAttribute("item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
只是行不通。 classes 已创建,但它们没有任何项目。
所以我今天早上来测试了 Web-services,嘿,它现在可以用了。
我没有做任何更改,所以我问 SAP 人员他们是否有解释,就是这样:
Yesterday I made changes to RFC like structure type to get the result into the table too using web service.
我不确定这是否对任何事情都有用...我很高兴它终于起作用了!