C#SOAP:无法识别指定的类型:名称=';arrayList';
我在C#中有一个客户端应用程序,它正在从外部SOAP服务调用一些方法。为了使用这个服务,我从服务WSDL生成了代理类。 除了一次手术外,一切正常。 当我试图调用此操作时,它会向我抛出带有以下消息的通信异常:C#SOAP:无法识别指定的类型:名称=';arrayList';,c#,java,web-services,soap,wsdl,C#,Java,Web Services,Soap,Wsdl,我在C#中有一个客户端应用程序,它正在从外部SOAP服务调用一些方法。为了使用这个服务,我从服务WSDL生成了代理类。 除了一次手术外,一切正常。 当我试图调用此操作时,它会向我抛出带有以下消息的通信异常: Error in deserializing body of reply message for operation 'my-operation-name' InnerException如下所示: The specified type was not recognized: name='a
Error in deserializing body of reply message for operation 'my-operation-name'
InnerException如下所示:
The specified type was not recognized: name='arrayList',
namespace='http://www.oracle.com/webservices/internal/literal', at <validationErrors
xmlns='http://view.label.com/types/'>.
无法识别指定的类型:name='arrayList',
名称空间=http://www.oracle.com/webservices/internal/literal",在。
我在WSDL文件中找到了此元素的描述:
<element name="validationErrors" type="ns1:list" nillable="true" />
但是我看不到对arrayList数据类型的任何引用
这是来自服务的响应:
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="http://view.label.com/"
xmlns:ns1="http://view.label.com/types/"
xmlns:ns2="http://www.oracle.com/webservices/internal/literal">
<env:Body>
<ns0:getLabelResponseElement>
<ns0:result>
<ns1:statusMessage>Error while reading xml label request.</ns1:statusMessage>
<ns1:requestId/>
<ns1:payload/>
<ns1:labelId/>
<ns1:status>Error</ns1:status>
<ns1:validationErrors
xsi:type="ns2:list"
xsi:nil="1"/>
<ns1:statusCode>LabelAssembler_03</ns1:statusCode>
</ns0:result>
</ns0:getLabelResponseElement>
</env:Body>
</env:Envelope>
读取xml标签请求时出错。
错误
Labelasembler_03
你能告诉我这个问题的可能来源吗?如果这是我的客户机应用程序部分的问题,或者是因为服务是用Java编写的,而我的客户机应用程序是用C#编写的,所以兼容性问题?
提前谢谢 我找到了解决方案-使用svcutil.exe生成的代理类为响应对象的一个成员生成奇怪类型:
private list validationErrorsField;
即:
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.oracle.com/webservices/internal/literal")]
public partial class list : collection
{
}
收集资料如下:
/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(list))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.oracle.com/webservices/internal/literal")]
public partial class collection
{
private object[] itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("item", Order=0)]
public object[] item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
}
//
[System.Xml.Serialization.xmlcludeAttribute(typeof(list))]
[System.CodeDom.Compiler.GeneratedCodeAttribute(“svcutil”,“4.0.30319.17929”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(命名空间=”http://www.oracle.com/webservices/internal/literal")]
公共部分类集合
{
私有对象[]项字段;
///
[System.Xml.Serialization.XmlElementAttribute(“项”,顺序=0)]
公共对象[]项
{
得到
{
返回此.itemField;
}
设置
{
this.itemField=值;
}
}
}
因此,我刚刚将这个有问题的类型更改为string[],现在一切都正常了。您能从Web服务提供SOAP响应吗?我添加了响应示例。