tags:

views:

341

answers:

2

Hi, 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!

A: 

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 :)

skaffman
+1  A: 

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.

Martin v. Löwis