You need to sign in to do that
Don't have an account?
kpr
Problem with callout to a RPC style webservice
I'm trying to make a callout to an RPC style service. I get a 503 error saying connection refused. Is it something on my side or the web service issue?
Here's my code:
String requestBody; requestBody = '<soap:Envelope xmlns:soap=' + '\'' + 'http://schemas.xmlsoap.org/soap/envelope/' + '\'' + ' xmlns:xsi=' + '\''; requestBody += 'http://www.w3.org/2001/XMLSchema-instance' + '>';//'\'' + ' xmlns:xsd=' + '\''+ 'http://www.w3.org/2001/XMLSchema' + '\'' + '>'; requestBody = '<soap:Body><GetAvailabilityRQ xmlns="http://www.passkey.com/apiSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; requestBody += '<Security><Login><UserName>username</UserName><Password>password</Password></Login><PartnerID>1111</PartnerID><Token>111111</Token></Security>'; requestBody += '<Message><Version>4.00.00</Version><Mode>S</Mode><OP>GetHousingAvailability</OP><Service>GetHousingAvailability</Service><Locale>EN_US</Locale></Message>'; requestBody += '<Data><GetAvailability><EventID>12333</EventID><AttendeeCode>att1</AttendeeCode><StartDate>2011-08-28</StartDate><EndDate>2011-08-30</EndDate></GetAvailability></Data>'; requestBody += '</GetAvailabilityRQ></soap:Body></soap:Envelope>'; Http h = new Http(); HttpRequest request = new HttpRequest(); request.setBody(requestBody); request.setEndpoint('http://training-api.passkey.com/axis/services/HousingAvailabilityService'); request.setMethod('GET'); request.setHeader('Content-length', '1753' ); request.setHeader('Content-Type', 'text/xml;charset=UTF-8'); request.setHeader('SOAPAction',''); HttpResponse response = h.send(request); System.debug(response.getBody());
I get this error:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The requested URL could not be retrieved</TITLE> <STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE> </HEAD><BODY> <H1>ERROR</H1> <H2>The requested URL could not be retrieved</H2> <HR noshade size="1px"> <P> While trying to retrieve the URL: <A HREF="http://training-api.passkey.com/axis/services/HousingAvailabilityService">http://training-api.passkey.com/axis/services/HousingAvailabilityService</A> <P> The following error was encountered: <UL> <LI> <STRONG> Connection to 209.51.243.33 Failed </STRONG> </UL> <P> The system returned: <PRE><I> (111) Connection refused</I></PRE> <P> The remote host or network may be down. Please try the request again. <P>Your cache administrator is <A HREF="mailto:support@salesforce.com">support@salesforce.com</A>. <BR clear="all"> <HR noshade size="1px"> <ADDRESS> Generated Thu, 04 Aug 2011 03:20:15 GMT by proxy-was.net.salesforce.com (squid) </ADDRESS> </BODY></HTML>
It says the host or network might be down. But I've been trying since morning, so this is unlikely to be the case. Is there any issue with the way I'm calling this service?
Thanks in advance
kpr
503 indicates a problem on the server side (i.e. the server you're trying to call is having issues).
I contacted the admin and got a new endpoint. Here's my new request:
But I get a different error now:
Can anyone help me with this please?
Thanks,
kpr
That error is from the server. It indicates it doesn't like the XML you're sending. Whether that's because you're sending incorrect XML or the server is misconfigured, I cannot say.