Null Response From Web Service

Photo by Ben Hershey on Unsplash

Null Response From Web Service

I’m currently working on a pretty big project where we have to consume a number of web services. These service was written in Java and the guys who wrote them use soapUI in order to test.

Personally, I like soapUI. It is a very powerful tool to test your web services with. Unfortunately as is the nature of web service development, when you send a request and get a response back, you’re happy. I’ve run into a scenario where I build a request send it via the service client and always get a null response object back. Null as in Object Reference Not Set null.

Debugging it is very tricky as the client code generated by WSDL.exe cannot tell you much. Yes, in this case we had to use old style WSDL web services, no WCF 🙁

Eventually after some time trying to figure out what the heck is happening, I installed tcpmon, a nice free Java utility to monitor data flow on a TCP connection. This allowed me to trap the XML for both the request and response. Within this XML I saw that the namespaces for the request and response was different. Once the guys fixed it, the code worked brilliantly.

To get tcpmon working, setup the connection like so:

image.png

In your code, point your service to http://127.0.0.1:7080. If all goes well, you should see the traffic in the Port Tab.

So next time you get an unexplained Null response, remember to check the namespaces!