Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSDL - no input - best practice

Tags:

soap

wsdl

I'm developing a SOAP web service. One of the functions is isAlive(). It has no input parameters. What's best practice for the WSDL? I tried...

<wsdl:operation name="isAlive">
    <wsdl:output message="tns1:isAliveMessage"/>
</wsdl:operation>

...but got a parse error in one of my tools because of the missing input. I found a couple of examples where an input and a message was defined and the corresponding type definition was empty, i.e. <xsd:complexType name="somename"/>. Is this better?

Thanks!

like image 383
Jörg Avatar asked Jul 10 '09 10:07

Jörg


People also ask

Does SOAP require WSDL?

The WSDL Generator component is not essential for using SOAP. Administrators can still write service calls to Content Server in SOAP if needed. The WSDL Generator provides flexibility in altering existing client applications.

Why do we need a WSDL file?

WSDL, or Web Service Description Language, is an XML based definition language. It's used for describing the functionality of a SOAP based web service. WSDL files are central to testing SOAP-based services. SoapUI uses WSDL files to generate test requests, assertions and mock services.

What is .WSDL file?

WSDL is an XML notation for describing a web service. A WSDL definition tells a client how to compose a web service request and describes the interface that is provided by the web service provider.


2 Answers

You definitely need an input message - how else could the server tell what operation you want to call.

If you use document style (which you should), the input message should be a single element with no content.

like image 110
Martin v. Löwis Avatar answered Oct 21 '22 10:10

Martin v. Löwis


It's good practise to define input and output documents for every operation, even if they turn out to be empty. These "empty" operations have a habit of turning out to be not so empty in the long run, and defining a placeholder document type up front can save you hassle.

For example, consider that the isAlive request might end up containing some indication of what it is you're asking about. It keeps your options open, and as a side effect generates valid WSDL :)

like image 37
skaffman Avatar answered Oct 21 '22 11:10

skaffman