You need to sign in to do that
Don't have an account?
System.CalloutException: no protocol Error on posting to Silverpop Engage API
Trying to create a Post to the Silverpop Engage API with this code. Getting the error System.CalloutException: no protocol. Tried the same call in Chrome's Advanced Rest Client and it works there.
Any help would be appreciated!
Thanks!
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setHeader('Content-Type', 'text/xml;charset=UTF-8');
System.debug('SEND HTTP BODY: ' + body);
req.setBody(body);
req.setMethod('POST');
Http http = new Http();
HTTPResponse res = http.send(req); // FAILING HERE
System.debug('REQUEST BODY' + res.getBody());
url is set to the Silverpop engage API EndPoint.
body is set to:
<?xml version="1.0"?>
<Envelope>
<Body>
<Login>
<USERNAME>me@myemail.com</USERNAME>
<PASSWORD>mypassword</PASSWORD>
</Login>
</Body>
</Envelope>
Error:
11:30:55.032 (32265000)|SYSTEM_METHOD_EXIT|[17]|System.Http.send(APEX_OBJECT) 11:30:55.032 (32319000)|FATAL_ERROR|System.CalloutException: no protocol: ://<http:silverpop API Endpoint here>
You have a mal-formatted url. Should be
http://silverpop
Actually, looking at your url it is being assembled wrong.
You have ://<http:silverpop API enpoiont here>.
Some text parsing or replacement is not happening. Looks like some cut and past code that is requesting that you replace the bits between <...> with a real url.
Cheers
Hi,
Sorry that isn't the actual code. I ommitted it in my post. The endpoint is correct, I checked against the documentation. :)
-Laura
Hi Dave,
Here is the full error.
Thanks!
-Laura
Huh, ok. Is the remote access setting got a proper url in it?
Cheers,
Yep. This site is in remote sites.