We are using perl (Zimbra::SOAP). I'm working with our programmer - he passed me the sample code he is using.
Looking it in action, we had increased the logging level and clearly see the response back from the server, however 'somewhere' is being either misinterpreted or not understood and hence an error 500 is returned by libwwwperl.
Here's the snippet of code that checks for that response:
Code:
my $res = $ua->request($req);
if (!defined($res)) {
print STDERR "No response from server\n";
return undef;
}
my $xml = undef;
eval {
$xml = Zimbra::SOAP::XmlElement::parse($res->content);
};
if (!defined($xml)) {
# Check for network/HTTP error after trying XML parse because
# a SOAP fault comes back with HTTP 500 status.
if ($res->is_error()) {
print STDERR
"SOAP request failed: code=" . $res->code() .
", error=" . $res->message() . "\n";
} else {
# We have legitimate XML parse error.
print STDERR
"Unable to parse SOAP response: " . $res->content() . "\n";
}
return undef;
}