Reputation: 9793
At work i have to implement an EDI thing. I have to create an XML message, sign it with a certificate, encode it with Base64
, pack it in an XML structure and send it to a server.
To send the message to the soap service i use HTTPSOAPConnection. The problem i ran into is, that i always get a 503 service unavailable
error.
I thought okay the service is not started, but for curiosity i tryed to reach it with SoapUi
. Sending the same message to the same service endpoint i get a HTTP 200 Ok
, with a response message.
Analyzing this response i have found, that there is a Base64
encoed xml inside, like the service documentation said. Decoding this i found out, that the server sent me an error code, saying that the service is unavailable.
But how can it be, that with my java generated request i get a 503 and with SoapUi i get a service specific response, containing the service specific error code for 503?
The only thing i can think about is, that something is wrong with my request. But what other reasons can a Http 503 have? How can i analyze the error (for example comparing the MimeHeader
of SoapUi with mine...)?
One more information i can give you is the block in which the error occures: Starting at line 245 of HTTPSOAPConnection
responseCode = httpConnection.getResponseCode();
// let HTTP_INTERNAL_ERROR (500) through because it is used for SOAP faults
if (responseCode == HttpURLConnection.HTTP_INTERNAL_ERROR) {
isFailure = true;
}
//else if (responseCode != HttpURLConnection.HTTP_OK)
//else if (!(responseCode >= HttpURLConnection.HTTP_OK && responseCode < 207))
else if ((responseCode / 100) != 2) {
log.log(Level.SEVERE,
"SAAJ0008.p2p.bad.response",
new String[] {httpConnection.getResponseMessage()});
throw new SOAPExceptionImpl(
"Bad response: ("
+ responseCode
+ httpConnection.getResponseMessage()
);
}
I am getting this "Bad response", with a 503 response code and no response message. I hope this informations are enough to, at least, get some guesses.
Upvotes: 0
Views: 14675
Reputation: 9793
It seems, like i get this, cause of a wrong endpoint URL. The URL i use as an endpoint is actually the URL to the WSDL. The endpoint itself is another one. I stil did not get it to work, but thats cause of some SSL, certificate, keystore, etc. stuff, which i have to learn first :P And it seems complicated...
Upvotes: 2