简体   繁体   中英

How to create WSDL file given SOAP WSDL operations

I haven't had any experience with web service related development. So, any ideas will be greatly appreciated.

Suppose, I have a file listing draft specification of WSDL operations. Following is one example. How would I go about creating the WSDL file. Is notepad sufficient or do I need to have WSDL editor?

getHostSystemInfo

Returns detailed information about host systems specified via given IDs.

  • input HostSystemIdCollection(Collection of Strings)
  • Output HostSystemInfoCollection
    • HostSystemInfo
      • Id: mandatory
      • Properties: Following properties should be provided for host systems
        • HostSystemName
        • HostSystemProperty1
        • HostSystemProperty2
        • 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. However, writing syntactically correct XML by hand is pretty dull, and error prone. So I would recommend using WSDL aware tooling for example an Eclipse editor

An alternative is to write some Java which expresses the interface, and from it generate the WSDL. There are many ways of doing this, including starting with an EJB and annotating it accordingly. 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. Larger scale projects benfit from considered designs starting at the WSDL.

coding WSDL by hand is a big pain! i used a XML editor for creation of and then generated the stubs with JAXWS . It is important to understand and differences of the WSDL styles, which is not trivial (have a look at WSDL styles ). a good help is to import the WSDL schema to your IDE (eclipse, idea) and then work with autocompletion.

just for interest, why are you using WSDL + SOAP. if you have a choice and you use anyway HTTP, have a look at REST. It can make implementation of web-api a LOT easier, both on server side and for api-clients.

If you haven't done any web services before, I would strongly recommend a WSDL Editor. The Netbeans has a plugin that should help.

The other way of doing it, which may be easier is by using the Java annotations defined in JSR 181.

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). 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. Personally, I prefer the WSDL-first approach, the Java-first approach is just a suggestion to get you started.

您可以使用Axis2为您创建。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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