使用 C# 中的 VS2008 解决方案使用 Axis 生成的 Web 服务

发布于 2024-08-06 16:44:05 字数 1081 浏览 5 评论 0 原文

我正在尝试将对外部 Axis 生成的 Web 服务的 Web 引用添加到 Visual Studio 2008 解决方案中。 我收到的 url 指向我可以通过浏览器成功访问的 WSDL,并且我可以看到所有 WService 详细信息。使用的 Axis 版本是 1.4。

但是,如果我运行 wsdl.exe 或者当我在 VS2008 中添加引用时,我可以看到左侧的方法列表,但我收到一条错误消息:


The document at the url http://............?wsdl 未被识别为已知文档类型。

每种已知类型的错误消息可能会帮助您解决问题:

  • Report from 'DISCO Document' is 'Discovery document at the URL http://.........?wsdl 无法找到。'。
    • 无法识别文档格式。
  • “WSDL 文档”的报告是“XML 文档中存在错误 (510, 62)。”。
    • 未定义命名空间前缀“impl:urn”。
  • 来自“XML Schema”的报告是“W3C XML Schema 的根元素应该是,其命名空间应该是” http://www.w3.org/2001/XMLSchema'.'。”

我无法继续。我在这里看到了其他帖子,但所有这些帖子都指的是网络参考已经存在的情况提前

非常感谢!

编辑

: 谢谢大家,实际上我设法“手动”解决了这个问题,就像 dovholuk 所建议的那样:我捕获了 wsdl,将其保存在本地文件系统中,然后我手动修改它,直到 wsdl.exe 能够生成课程。然后我在项目中添加了该类,并成功调用了Web服务。

再见 安德里亚

I'm trying to add a web reference to an external Axis - generated web service to a Visual Studio 2008 solution.
The url I received points to a WSDL that I can successfully access through a browser, and I see all the WService details. The Axis version used was 1.4.

But if I run wsdl.exe or when I add the reference in VS2008 I can see the methods list on the left, but I get an error stating that:


The document at the url http://............?wsdl was not recognized as a known document type.

The error message from each known type may help you fix the problem:

  • Report from 'DISCO Document' is 'Discovery document at the URL http://.........?wsdl could not be found.'.
    • The document format is not recognized.
  • Report from 'WSDL Document' is 'There is an error in XML document (510, 62).'.
    • Namespace prefix 'impl:urn' is not defined.
  • Report from 'XML Schema' is 'The root element of a W3C XML Schema should be and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'."

And I cannot proceed. I saw other posts here on SO but all of them are referring to a situation in which the web reference is already added.

Many thanks in advance!

A.

EDIT:
Thanks guys, actually I managed to solve the issue "by hand" as in some way was suggested by dovholuk: I capured the wsdl, saved it loccally in file system, then I modified it by hand, until wsdl.exe was able to generate the classes. Then I added the class in the project, and managed to call the web service.

Ciao
Andrea

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风和你 2024-08-13 16:44:05

这是我在使用axis 1.4时遇到的常见问题。我个人总是手动编写我的 wsdl 和 xsd 代码,而不是出于这个原因和其他原因使用发射功能...

如果你打开你的 ?wsdl 并开始解析,我敢打赌你那里有一些“空”的枚举。像这样的事情:

<xs:simpleType name="MyType">
</xs:simpleType>

我真的只是在这里猜测,因为您没有发布 wsdl (不确定是否可以?),但是当我编写 wsdl/xsd 并对简单类型有限制时,我得到了这个确切的行为......例如:(

<xs:simpleType name="IpAddress">
  <xs:restriction base="xs:string">
    <xs:pattern value="\d*"> (note this is not 'correct' i'm just 'for instancing')
  </xs:restriction>
</xs:simpleType>

如果这是无效的,请不要杀了我 xsd - 我只是从记忆中...:) )

Axis 会吸收它,创建对象,但是当它使用 ?wsdl 发出时,它会显示“无效”...所以

我的建议是梳理该 wsdl - 特别是“不完整”模式定义的类型部分...将它们从 java 中取出并“重试”直到它在 c# 中工作...

不知道是否如此不管有没有帮助 - 但如果您需要任何其他想法,请回帖......

This is a common problem that I experience when using axis 1.4. I personally always code my wsdl and xsd by hand instead of using the emitting capability for this - and other reasons...

If you open your ?wsdl and start parsing through I would bet that you have some enumeration in there which is "empty". Something like:

<xs:simpleType name="MyType">
</xs:simpleType>

i'm really just guessing here because you didn't post the wsdl (not sure if you can?) but I get this exact behavior when I write my wsdl/xsd and have restrictions on simple types... such as:

<xs:simpleType name="IpAddress">
  <xs:restriction base="xs:string">
    <xs:pattern value="\d*"> (note this is not 'correct' i'm just 'for instancing')
  </xs:restriction>
</xs:simpleType>

( don't kill me if that's invalid xsd - i'm just going from memory... :) )

Axis will suck this in, create objects but when it gets emitting using ?wsdl it comes out 'invalid'....

So my advice is to comb through that wsdl - particularly the types section for 'incomplete' schema definitions... Take them out of your java and 'try again' until it works in c#....

Don't know if that helps or not - but if you need any other ideas, post back...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文