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
SaurabhRawaneSaurabhRawane 

Ajax Proxy Error

Hi All,

I have been working on Ajax proxy example to get data on to salesforce by making a call to external WebService.

By Envelope variable looks likes this:

var envelope='<?xml version="1.0" encoding="utf-8"?>'+
    +'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '+
    +'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
     +'<soap:Body>'+
    +'<GetWeatherByPlaceName xmlns="http://www.webservicex.net">'+
    +'<PlaceName>'+c1+'</PlaceName>'+
    +'</GetWeatherByPlaceName></soap:Body>'+
    +'</soap:Envelope>';
And remote function looks like this:

    sforce.connection.remoteFunction({
        url : "http://www.webservicex.net/soap",
        requestHeaders: {
                "Content-Type": "text/xml",
            "SOAPAction":  "\"\""
        },
        mimeType: "text/xml",
        requestData: envelope,
        method: "POST",
        onSuccess : function(response) {
            alert(response+'Test');
            document.getElementById("result").value = response.textContent;
            
        },
        onFailure : function(response) {
             document.getElementById("result").value = "Failed  " + response.textContent;
            
        }
    }
    );

I have been not getting any response using the above method,i have also made entry for the proxy in Salesforce,can anyone help me regarding this,or suggest some methods to track where i am facing problem.



cheenathcheenath
It seems the external service you are trying to invoke  is down.
Otherwise your code looks good.