I recently asked a question about building a SOAP message using the java provided soap library Changing default soap URI, so that question may end up bleeding into this one a bit depending on what the answer to the last one may be (and in fact, the answer to this question may mean that I don’t have to worry about my other question)
I’ve connected to the device I am communicating with via the java socket library and passed messages back and forth, however today I decided that with all that is available to me from java in the way of SOAP stuff, why not just use its provided SOAP library?
Well, it’s a headache now, but I’m sure it will be beneficial once it is up and running. Either way, when I previously communicated with the device, I simply opened the socket at IP address
port 80, but when I use the
SOAPConnection.call method I get the following error:
Apr 23, 2012 3:47:06 PM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post SEVERE: SAAJ0008: Bad Response; null com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(Unknown Source) at DeviceCommunicator.openConnection(DeviceCommunicator.java:184) at ClientRunner.main(ClientRunner.java:29) Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(Unknown Source) ... 3 more
Here is the call, if that helps:
SOAPConnection sc = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage response = sc.call(sm, "http://xxx.xxx.xxx.xxx");
xxx.xxx.xxx.xxx is obviously the IP address of the device (and I’ve tried calls to the
SOAPConnection.call method where the second argument was
http://xxx.xxx.xxx.xxx:80 without success as well).
After some perusing of stackoverflow and general google searches, I’ve yet to find someone that has had a problem switching from socket communication to soap.
Unfortunately, I haven’t solved the problem, however I did find using Wireshark that the message is being sent correctly and so is the response. I’m pretty perplexed as to why the response would see “null” – any takers?
Thanks in advance,
SAAJ0008: Bad Response; null
This error message states that the server responded with an error message (e.g. HTTP
5XX). null in this case refers to the java class not being able to translate the error code to an associated message. E.g. the status codes 400, 501 and 543 would yield the following error messages:
SAAJ0008: Bad Response; Bad Request SAAJ0008: Bad Response; Not Implemented SAAJ0008: Bad Response; null
Most likely your server is rather picky with how the request is formatted, and the specific request you sent could not be handled properly. I would suggest that you try to verify the difference between the request sent using the java socket library and SOAPConnection to see if there is a difference.