简体   繁体   English

如何在给定SOAP WSDL操作的情况下创建WSDL文件

[英]How to create WSDL file given SOAP WSDL operations

I haven't had any experience with web service related development. 我没有任何与Web服务相关的开发经验。 So, any ideas will be greatly appreciated. 所以,任何想法将不胜感激。

Suppose, I have a file listing draft specification of WSDL operations. 假设,我有一个文件列出了WSDL操作的草案规范。 Following is one example. 以下是一个例子。 How would I go about creating the WSDL file. 我将如何创建WSDL文件。 Is notepad sufficient or do I need to have WSDL editor? 记事本是否足够,还是需要WSDL编辑器?

getHostSystemInfo

Returns detailed information about host systems specified via given IDs. 返回有关通过给定ID指定的主机系统的详细信息。

  • input HostSystemIdCollection(Collection of Strings) 输入HostSystemIdCollection(字符串集合)
  • Output HostSystemInfoCollection 输出HostSystemInfoCollection
    • HostSystemInfo HostSystemInfo
      • Id: mandatory Id:强制性
      • Properties: Following properties should be provided for host systems 属性:应为主机系统提供以下属性
        • HostSystemName HostSystemName
        • HostSystemProperty1 HostSystemProperty1
        • HostSystemProperty2 HostSystemProperty2
        • HostSystemProperty3 .... .... HostSystemProperty3 ....

If the question is just "how do I create the WSDL" then you could indeed use Notepad and just write it, it's only XML after all. 如果问题只是“我如何创建WSDL”那么你确实可以使用记事本来编写它,它毕竟只是XML。 However, writing syntactically correct XML by hand is pretty dull, and error prone. 但是,手动编写语法正确的XML非常枯燥,容易出错。 So I would recommend using WSDL aware tooling for example an Eclipse editor 所以我建议使用WSDL识别工具,例如Eclipse编辑器

An alternative is to write some Java which expresses the interface, and from it generate the WSDL. 另一种方法是编写表示接口的Java,并从中生成WSDL。 There are many ways of doing this, including starting with an EJB and annotating it accordingly. 有很多方法可以做到这一点,包括从EJB开始并相应地注释它。 A few googles should help you find what you need. 一些谷歌应该可以帮助您找到您需要的东西。

My experience is that simple POC situations tend to work well starting at the Java. 我的经验是,从Java开始,简单的POC情况往往效果很好。 Larger scale projects benfit from considered designs starting at the WSDL. 更大规模的项目从WSDL开始的考虑设计中获益。

coding WSDL by hand is a big pain! 手工编写WSDL是一件很大的痛苦! i used a XML editor for creation of and then generated the stubs with JAXWS . 我使用XML编辑器创建,然后使用JAXWS生成存根。 It is important to understand and differences of the WSDL styles, which is not trivial (have a look at WSDL styles ). 理解和区分WSDL样式很重要,这不是一件容易的事(看看WSDL样式 )。 a good help is to import the WSDL schema to your IDE (eclipse, idea) and then work with autocompletion. 一个很好的帮助是将WSDL架构导入IDE(eclipse,idea),然后使用自动完成。

just for interest, why are you using WSDL + SOAP. 只是为了感兴趣,你为什么要使用WSDL + SOAP。 if you have a choice and you use anyway HTTP, have a look at REST. 如果您有选择并且无论如何使用HTTP,请查看REST。 It can make implementation of web-api a LOT easier, both on server side and for api-clients. 它可以使web-api的实现更容易,无论是在服务器端还是用于api-clients。

If you haven't done any web services before, I would strongly recommend a WSDL Editor. 如果您之前没有做过任何Web服务,我强烈推荐使用WSDL编辑器。 The Netbeans has a plugin that should help. Netbeans有一个应该有用的插件。

The other way of doing it, which may be easier is by using the Java annotations defined in JSR 181. 另一种方法是使用JSR 181中定义的Java注释,这可能更容易。

Of course you could use the worst text editor in the world (!) but I'd seriously consider using any decent XML editor or IDE (Eclipse's WSDL support is pretty decent). 当然你可以使用世界上最糟糕的文本编辑器(!)但我认真考虑使用任何体面的XML编辑器或IDE(Eclipse的WSDL支持相当不错)。 This will save you a lot of pain and suffer. 这将为您节省很多痛苦和痛苦。

Or, if this is an option, you could just annotate a Java class with JAX-WS annotations and have your WSDL dynamically generated from the Java code. 或者,如果这是一个选项,您可以使用JAX-WS注释注释Java类,并使用Java代码动态生成WSDL。 Personally, I prefer the WSDL-first approach, the Java-first approach is just a suggestion to get you started. 就个人而言,我更喜欢WSDL优先方法,Java优先方法只是一个让你入门的建议。

您可以使用Axis2为您创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM