.NET and WSDL -- No Method Arguments?

May 11, 2004 22:25

If you're like me, you've tried implementations of just about every kind of method signature there is when writing your WSDL documents. If you're like me, you've also assumed .NET followed the latest WSDL Note, or that .NET's WSDL parser functioned similarly to a traditional programming language, where it's okay if a function/method/subroutine takes no arguments.

Going along with this thinking, this WSDL should suffice:



Even though this document (with the XML namespaces actually defined) will validate with an editor such as xmlspy® 2004, .NET has a personal problem with it. When dealing with .NET, everything has to be explicitly defined--even if what's being defined is nothing.

To achieve a working WSDL that is .NET friendly that works the way above is intended to work, an empty message must be specified for the input of the operation (in this case, getNum).

Here it is:

Notice the changes, which I have bolded. Assuming you have a real Web service you're pointing to (in this case, http://www.cparker15.com/cgi-bin/exampleService.cgi), and assuming you've actually declared all of the appropriate XML namespaces in the tag, this WSDL document will work beautifully.

I'm not sure if specifying the SOAP encoding details for the input is overkill, or if a simple would work, too, but it's better to be safe than sorry when it comes to .NET...

Security Level: Public

.net, web services, soap, wsdl, programming

Previous post Next post
Up