1

在尝试从此 WebService (http://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl) 生成代理时,我从 svcutil 收到此错误:

错误:无法从 http://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl获取元数据

如果这是您有权访问的 Windows (R) Communication Foundation 服务,请检查您是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅位于 http://go.microsoft.com/fwlink/?LinkId=65455的 MSDN 文档。

WS 元数据交换错误 URI:http ://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl

Metadata contains a reference that cannot be resolved:

'http://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl'。

The content type text/xml; charset=utf-8 of the response message

与绑定的内容类型不匹配 (application/soap+xml; charset=utf-8)。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。响应的前 553 个字节是:'
ns1:Client.NoSOAPAction 没有 SOAPAction 标头!usalwsc01'.

The remote server returned an error: (500) Internal Server Error.

HTTP GET 错误 URI:http ://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl

The document at the url http://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl

未被识别为已知文档类型。每个已知类型的错误消息可能会帮助您解决问题: - 来自“XML Schema”的报告是“W3C XML Schema 的根元素应该是,其命名空间应该是”http://www.w3.org/2001 /XMLSchema'.'. - 来自“DISCO 文档”的报告是“ 无法找到URL http://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl上的发现文档。”。- 无法识别文档格式。- 来自“WSDL 文档”的报告是“XML 文档 (242, 18) 中存在错误。”。

  • 命名空间前缀 'impl:wb' 未定义。

我使用以下参数调用了 svcutil:

svcutil /n: *,WB.Client /et:WB.Client.WSResultObject /o:Client\WBServices /noConfig http://scdemo14.infor.com:9014/axis/services/wb:wsclocks-inbound?wsdl

有谁知道我该怎么做才能生成代理?我无法更改服务器端的服务。

4

1 回答 1

3

问题是该服务使用与 svcutil 不兼容的绑定命名约定。您可以按以下方式解决此问题:

  • 浏览服务的 WSDL URL 并将 WSDL 保存到本地文件。
  • 然后对文件进行以下更改:
  • 从用于 wsdl:binding 的名称中删除名称空间前缀,即更改

    name="wb:wsclocks-inboundSoapBinding"成为

    name="wsclocks-inboundSoapBinding"

  • 将 wsdl:port 属性的 binding 属性更改为匹配,并从 name 属性的值中删除名称空间前缀,因此它只是wsclocks-inbound

然后运行svcutil <wsdl-file-path> /o:Client\WBServices /noConfig

于 2010-12-15T16:37:00.810 回答