• Lakshmi_lb14447
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
I am trying to use REST API "Query" resource to fetch some data from Account object. The respective pseudo-code is as follows

var strSOQL = '/services/data/v29.0/query?q=SELECT+Id,Name,Phone+FROM+Account+WHERE+Name+LIKE+\'' + nameKeyj + '%\'' + '+ORDER+BY+Name+LIMIT+20' ;


$.ajax(strSOQL,        
       {
        beforeSend: function(xhr)
          {
              .......
       .......

          },
        success: function(response)
          {
              .......
       .......
                                                       
          },

        error: function(jqXHR, textStatus, errorThrown)
          {
   
              .......
              .......
          }
   
        });

In the above code, nameKeyj is a variable containing the value inputted by the user on the visualforce page.

For ex, if the user typed in 'a', the resulting query seen in the debugger is 

SELECT+Id,Name,Phone+FROM+Account+WHERE+Name+LIKE+%27a%%27+ORDER+BY+Name+LIMIT+20

I am always getting 400: Bad Request from the server, and my doubt is on the %27 characters which the server might be considering as invalid and unable to decode them.

Does the REST API "Query" resource supports all kinds of SOQL queries or is there any resriction of not using LIKE verb in the query.

Could someone please provide some idea on this?



What are different interview questions asked on Pardot and Marketing cloud ?
I am trying to invoke 3rd party web-services from Salesforce using WSDL2APEX. The client has also shared a .p12 certificate which I need to use for client authentication while making web-service call from Salesforce along with username and password.

I converted above .pfx into base64 using openSSL and tried below:
stub.clientCert_x = 'base64encodedstring'; 
stub.clientCertPasswd_x = 'password used for importing .pfx (password used for protecting private key)'


I am not sure above password is same as keystore password. But this method is not working.

I converted .p12(.pfx) into .jks and imported the same in Salesforce and used below:
 
​stub.clientCertName_x = 'CertificateUniqueName';



Even above method didn't work. Tried the same with HTTP callouts, but no luck.

I am not sure where I am going wrong. I am getting response from the server that authentication certificate is missing, hence I believe that the callout is successful.

My client has used "GlobalSign Root CA" which is supported by Salesforce.

Please let me know if my approach is wrong. Should I first export .p12 into public and private keys and then use it ?
I am trying to use REST API "Query" resource to fetch some data from Account object. The respective pseudo-code is as follows

var strSOQL = '/services/data/v29.0/query?q=SELECT+Id,Name,Phone+FROM+Account+WHERE+Name+LIKE+\'' + nameKeyj + '%\'' + '+ORDER+BY+Name+LIMIT+20' ;


$.ajax(strSOQL,        
       {
        beforeSend: function(xhr)
          {
              .......
       .......

          },
        success: function(response)
          {
              .......
       .......
                                                       
          },

        error: function(jqXHR, textStatus, errorThrown)
          {
   
              .......
              .......
          }
   
        });

In the above code, nameKeyj is a variable containing the value inputted by the user on the visualforce page.

For ex, if the user typed in 'a', the resulting query seen in the debugger is 

SELECT+Id,Name,Phone+FROM+Account+WHERE+Name+LIKE+%27a%%27+ORDER+BY+Name+LIMIT+20

I am always getting 400: Bad Request from the server, and my doubt is on the %27 characters which the server might be considering as invalid and unable to decode them.

Does the REST API "Query" resource supports all kinds of SOQL queries or is there any resriction of not using LIKE verb in the query.

Could someone please provide some idea on this?


I am trying to use a web service to connect to an external site and I keep on getting:

 

System.CalloutException: IO Exception: External server did not return any content

 

I was able to successfully import their wsdl and I was trying to do a simple ping operation. I tried the connection in soapUI and it was successful and returned a response.

 

One question I had was if Salesforce handles the <s:any /> complex type correctly. Their wsdl has:

 

      <s:element name="PingResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="PingResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

and the code it generates is:

 

    public class PingResult_element {
        private String[] apex_schema_type_info = new String[]{'YSI.Portal.SeniorHousing.WebServices','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class PingResponse_element {
        public seniorhousingWeb.PingResult_element PingResult;
        private String[] PingResult_type_info = new String[]{'PingResult','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'YSI.Portal.SeniorHousing.WebServices','true','false'};
        private String[] field_order_type_info = new String[]{'PingResult'};
    }

Any help is appreciated!!

Hi,

I am connecting to a webservice using visualforce controller. I have parsed the WSDL into proxy apex classes and have the service methods exposed. Now when I call the method and try to hit the service I get the error message saying.
System.CalloutException: IO Exception: External server did not return any content

When I call the same service using SOAP UI with same input parameters there is no issue and I get positive response from the service.

I validated from the service provider and came to know that when I make call from SFDC service is not getting hit. 

 

Any help is appreciated.

HI,
I am calling one web service and getting response in XML and while iterating through that XML i got below exception

System.XmlException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog.

Code:
 HttpRequest req = new HttpRequest();
        String url='abaccc';

        req.setEndpoint(url);
        req.setMethod('GET');
        // Send the request, and return a response
        HttpResponse res = h.send(req);
        XmlStreamReader reader = res.getXmlStreamReader();
        // Read through the XML
        while(reader.hasNext()) {
            System.debug('Event Type:' + reader.getEventType());
            if (reader.getEventType() == XmlTag.START_ELEMENT) {
            System.debug('Local name :'+reader.getLocalName());
            }
            reader.next();// Getting exception at this line.
        }

 Can anybody help me?

Thanks
Yash