收到SOAP xml响应但未填充响应对象
我向供应商基于Java的Web服务添加了“服务引用”,我无法控制。
我有这个简单的客户端代码:
Client myClient = new Client(); CapabilitiesType response = client.GetCapabilities(new GetCapabilitiesType1()); myClient.Close(); litCapabilities.Text = response.version;
这会生成以下SOAP信封:
到目前为止很好,上面我从Trace Viewer得到了。 使用SoapUI和Trace Viewer,我可以validation我得到了正确的响应:
EarthObservation ebRIM Catalogue A web-based catalogue service that implements the CSW-ebRIM profile of the OGC Catalogue 2.0 specification, and the EO Extension Package registry catalogue ebRIM earth observation urn:ogc:service:catalogue:csw-ebrim 2.0.2 NONE ServiceIdentification ServiceProvider OperationsMetadata Filter_Capabilities ServiceProperties 2.0.2 application/xml hits results application/xml urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0 1 10 rim:RegistryObject rim:Association rim:Classification rim:ClassificationNode rim:ClassificationScheme urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOProduct urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOAcquisitionPlatform urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOBrowseInformation urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOArchivingInformation brief summary full FILTER FALSE application/xml urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0 brief summary full rim:RegistryObject rim:Association rim:Classification rim:ClassificationNode rim:ClassificationScheme urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOProduct urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOAcquisitionPlatform urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOBrowseInformation urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOArchivingInformation application/xml http://www.w3.org/TR/xmlschema-1 CSW 2.0.2 urn:ogc:def:EOP:xxx-GSI:RSAT2_SEGMENTS gml:Envelope gml:Point gml:LineString gml:Polygon LessThan GreaterThan LessThanEqualTo GreaterThanEqualTo EqualTo NotEqualTo urn:ogc:specification:csw-ebrim:ext-pkg:Basic urn:x-ogc:specification:csw-ebrim:package:EOProducts http://www.opengis.net/ogc http://www.w3.org/TR/xpath application/xml urn:ogc:def:trs:ISO-8601:2000 urn:ogc:def:crs:EPSG:6.3:4326 EarthObservation ebRIM Catalogue A web-based catalogue service that implements the CSW-ebRIM profile of the OGC Catalogue 2.0 specification, and the EO Extension Package registry catalogue ebRIM earth observation urn:ogc:service:catalogue:csw-ebrim 2.0.2 NONE ServiceIdentification ServiceProvider OperationsMetadata Filter_Capabilities ServiceProperties 2.0.2 application/xml hits results application/xml urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0 1 10 rim:RegistryObject rim:Association rim:Classification rim:ClassificationNode rim:ClassificationScheme urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOProduct urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOAcquisitionPlatform urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOBrowseInformation urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOArchivingInformation brief summary full FILTER FALSE application/xml urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0 brief summary full rim:RegistryObject rim:Association rim:Classification rim:ClassificationNode rim:ClassificationScheme urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOProduct urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOAcquisitionPlatform urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOBrowseInformation urn:x-ogc:specification:csw-ebrim:ObjectType:EO:EOArchivingInformation application/xml http://www.w3.org/TR/xmlschema-1 CSW 2.0.2 urn:ogc:def:EOP:xxx-GSI:RSAT2_SEGMENTS gml:Envelope gml:Point gml:LineString gml:Polygon LessThan GreaterThan LessThanEqualTo GreaterThanEqualTo EqualTo NotEqualTo urn:ogc:specification:csw-ebrim:ext-pkg:Basic urn:x-ogc:specification:csw-ebrim:package:EOProducts http://www.opengis.net/ogc http://www.w3.org/TR/xpath application/xml urn:ogc:def:trs:ISO-8601:2000 urn:ogc:def:crs:EPSG:6.3:4326
但不知何故,这些数据并没有让它回到我的客户端代码。 响应对象中的大多数属性都是NULL。
基于SOAP响应,响应对象的非属性的一个属性是错误的(response.version)它应该是“2.0.2”而不是“1.0.0”
任何人都知道我错过了什么,或者这里有什么不妥?
或者什么可以帮我解决这个问题?
我能够弄清楚我的问题:命名空间不匹配。
请求肥皂信封的正文包含:
在我得到的回复中(仅限顶级相关人物):
请注意REQUEST中的OWS模式命名空间如何指向http://www.opengis.net/ows
虽然回复指向http://www.opengeospatial.net/ows
.NET的两个名称空间必须相同才能反序列化数据。 所以你可以让响应响应正确的命名空间。 在我的情况下,由于我无法控制Java Web服务, 我不得不修改自动生成的代理类并将“xmlns:ows = http://www.opengis.net/ows”的所有实例替换为“xmlns” :OWS = HTTP://www.opengeospatial.net/ows”
也许您可能尝试使用SvcUtil生成客户端代理,而不是使用服务引用。 我不知道他们是否会生成相同的客户端代码,但你还是可以尝试一下。
svcutil /target:code http://www.xyz.com/webService.wsdl /out:XYZWebServzice.cs