function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lauraecilauraeci 

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>


DevAngelDevAngel

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

lauraecilauraeci

Hi,

 

Sorry that isn't the actual code.  I ommitted it in my post.  The endpoint is correct, I checked against the documentation.  :)  

 

-Laura

lauraecilauraeci

Hi Dave,

 

Here is the full error.  

 

Thanks!

-Laura

 

12:18:35.028 (28446000)|FATAL_ERROR|System.CalloutException: no protocol: "https://api5.silverpop.com/XMLAPI"
DevAngelDevAngel

Huh, ok. Is the remote access setting got a proper url in it?

 

Cheers,

 

lauraecilauraeci

Yep.  This site is in remote sites.