我正在使用第三方XML SOAP Web服务,使用svcutil.exe生成.net代理类,但在调用方法时未在响应对象中填充数组。
我使用了一些网络HTTP嗅探器来获取XML响应,我注意到XML中的数组是正常的,但它们在响应对象中是空的,我试图编辑服务的WSDL文件来解决问题但它没有成功。
编辑: 编辑了WSDL并将其放在我自己的主机上并添加了VS的服务引用,但留下了端点的URL以引用主要的第三方服务。
任何人都可以帮助我在WSDL中进行正确的更改,以满足我从外部Web服务获得的响应吗?
我使用SmartSniff获得的响应XML是:
.
.
.
.
<Summary>
<ID xsi:type="xsd:string">1</ID>
<Name xsi:type="xsd:string">AAA</Name>
<Errors>
<Error>
<Service xsi:type="xsd:string">Orders</Service>
<Details xsi:type="xsd:string">Orders is not OK</Details></Error>
<Error>
<Service xsi:type="xsd:string">Details</Service>
<Details xsi:type="xsd:string">The Details service was selected but but you do not have access to this service</Details>
</Error>
</Errors>
</Summary>
.
.
.
.
WSDL是:
.
.
.
.
<element name="Summary" type="tns:SummaryPart" minOccurs="1" maxOccurs="1"/>
.
.
.
.
<complexType name="SummaryPart">
<sequence>
<element name="ID" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<element name="Name" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<element name="Errors" type="tns:ErrorArray" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
<complexType name="ErrorArray">
<sequence>
<element name="Error" type="tns:ErrorPart" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="ErrorPart">
<sequence>
<element name="Service" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<element name="Details" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
.
.
.
.
我有这些替代方案,但没有成功:
1 -
.
.
.
.
<element name="Summary" type="tns:SummaryPart" minOccurs="1" maxOccurs="1"/>
.
.
.
.
<complexType name="SummaryPart">
<sequence>
<element name="ID" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<element name="Name" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<element name="Errors" type="tns:Errors" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
**<complexType name="Errors">
<sequence>
<element name="Error" type="tns:Error" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="Error">
<sequence>
<element name="Service" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<element name="Details" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>**
.
.
.
.
2 -
.
.
.
.
<element name="Summary" type="tns:SummaryPart" minOccurs="1" maxOccurs="1"/>
.
.
.
.
<complexType name="SummaryPart">
<sequence>
<element name="ID" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<element name="Name" type="xsd:string" minOccurs="0" maxOccurs="1"/>
**<element name="Errors" type="tns:Error" minOccurs="0" maxOccurs="unbounded"/>**
</sequence>
</complexType>
<complexType name="Error">
<sequence>
<element name="Service" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<element name="Details" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
.
.
.
.
有什么建议吗?