无论是WSDL还是wsimport和wsdl(单声道)都被严重破坏

编辑我从下面给出的例子开始,但我现在有:

  • 尝试了W3C规范的例子。 在修复另一个错误(绑定在一个地方被称为StockQuoteSoapBinding ,另一个被称为StockQuoteSoapBinding )之后,它会产生同样的问题。
  • 试过单声道生成器wsdl来看看wsimport是否应该受到指责。 它给出了一个等价的错误。

所以在我看来,尽管有关于SOAP的所有宣传,它实际上并没有起作用 – 至少不像宣传的那样。 我无法相信没有人通过这些生成器运行最可见的wsdl示例。

原始问题

wsimport在以下wsdl上失败:

                                               

附:

 parsing WSDL... [ERROR] Schema descriptor {http://example/schema/OrdersService}GetOrders in message part "parameters" is not defined and could not be bound to Java. Perhaps the schema descriptor {http://example/schema/OrdersService}GetOrders is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch. line 35 of file:test.wsdl 

虽然问题相当陈旧,但这是一个有效的WSDL:

                                                   

我改变的事情:

  • xmlns:xsd设置为http://www.w3.org/2001/XMLSchema而不是http://www.w3.org/1999/XMLSchema版本已经过时了)

  • 从架构元素中删除的名称空间( GetOrders而不是o:GetOrdersGetOrdersResponse而不是os:GetOrdersResponse )(在元素或类型定义的name属性中不允许使用name空间限定符)

  • 为子元素criteriaorders使用了正确的类型: xsd:string而不是string


我同意,WSDL在开始时可能很难,但是,一旦掌握了它,没有比明确定义的界面更好的了。 如果我有一个选择,我宁愿选择wsdl而不是json-REST-API。 但我猜这是一个品味问题;-)

如果我没记错的话,wsimport需要导入外部名称空间才能在WSDL文件中使用它们的元素。 在你的情况下: