I had very interesting problem recently. Our webservice was written on cold fusion and client was on .Net. The webserivice was working alright and returning the output whatever we were expecting. But when we tried referring the same service from .Net, the client was throwing error.
org.xml.sax.SAXParseException: Document root element is missing
It seemed to be common problem while parsing xml so I was thinking it would be problem with soap body which is not able to convert the data from cold fusion to format that was expected from .Net. The return from the webservice was a string and I tried creating a test method which does not accept any data and return some test value. Even that simple webservice method had the same problem. Here is my coldfusion webservice method..
When I did some more analysis, the error message was something like this
The remote server returned an error: (500) Internal Server Error.
Error was internal server error from IIS. I tried calling the same method from one of my cold fusion page and that worked fine.
Here is what I found, when the method was invoked from cold fusion page, it was invoking with GET method by default. When I referred the same service from .Net client, it was invoking with POST. I found this from IIS log. All the log entries with POST method for this service had 500 Internal errors. So I had option to fix the webservice to get it working with POST method or change the client to request webservice using GET. I am not an expert in cold fusion so I opeted for second option of invoking webservice with GET method.
When the client code changed to invoke the webservice using GET method, the output came out right and all the functionalities worked very well. I still think making change on the webservice to fix this problem is better but I may have to spend some more time to do that..
No comments:
Post a Comment