Friday, July 27, 2007

SOAP and WSDL mistakes using .NET: the missing input

Sometimes in your WSDL are present web service inputs whose minOccur and maxOccur attributes are not specified.
I found the .NET framework assumes an element defined that way is optional.
Let me better explain: if you don't specify a value for such an element (you usually provides or not this value when you are invoking the web service proxy, generated by using wsdl.exe) the .NET runtime skips inserting that element in the SOAP request.
Now, if the destination web service requires the element... BIG-MISTAKKO: I spend 10 hours debugging such a troublesome behavior... Grrrrr!

Solution 1: always provide minOccur and maxOccur attributes or use required="true"
Solution 2: always provide non-empty and consistent values for every web service input

In my case Solution 2 worked pretty well (actually it was the only one suitable because I didn't have the possibility of modifying the web service).

No comments:

Post a Comment