• Harshala Shewale
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies

Hi,

 

I am trying to get one webservice methdos from one org to another org without any login details.

 

My webservice :

 

global class testWebservice
{  
     
      webservice static string test()
      {
          return 'test-test';
      }   
 
}

 

 

from another org I am calling :

 

 HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
 
// I have created site and given public access to testWebservice class



req.setEndpoint('https://harshalatest-developer-edition.na7.force.com/mysite/services/Soap/class/testWebservice/test'); req.setMethod('POST'); req.setHeader('SOAPAction',''); req.setHeader('Content-Type', 'text/xml;charset=UTF-8'); req.setCompressed(true); // otherwise we hit a limit of 32000 try { res = http.send(req); System.debug('In sendRequest BODY: '+res.getBody()); System.debug('STATUS:'+res.getStatus()); System.debug('STATUS_CODE:'+res.getStatusCode()); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); }

referring : http://www.fishofprey.com/2010/11/invoking-public-salesforce-web-service.html 

 

getting error :

 

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>SOAPAction HTTP header missing</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>

Where I am going wrong? or help me out a simple way to call webservice from one org to another...it has been 2-3 days i  am stucked..please help

Hi,

I am trying to fetch some Lead records from ORG1  and if some condition is satisfied create records in org2  from my current org.

 

I have credential of both ORGs .

 

list<Record> records = new list<Record>();

SFConnectionController controller = new SFConnectionController();

// First org from where I am fetching Lead records
LoginResult loginResult = controller.login(firstOrgUsername, firstOrgPassword, securityToken);
if(!loginResult.isError)
{
   Response response = controller.query('select Name from Lead, loginResult);

  records = response.data.records;

  if(/*somecondition*/)
 {
   // Second org where I want to insert record 
      LoginResult loginResultPublishingOrg = controller.login(secondOrgUserNmme, secondOrgPassword, securityToken);
   // here I want to insert record - I am not sure is it right syntax or not - Subscribe_User__c is object in second org
      Response response_insert = controller.query('Insert into Subscribe_User__c (User_Name__c)values ('Harshala')', loginResultPublishingOrg);
	
   /**** Getting error in response


 }
}

 

Received following error :

response_insert:Response:[data=Result:[fields={}, records=()], isError=true, message=Query Failed, result=<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>sf:MALFORMED_QUERY</faultcode><faultstring>MALFORMED_QUERY: unexpected token: Insert</faultstring><detail><sf:MalformedQueryFault xsi:type="sf:MalformedQueryFault"><sf:exceptionCode>MALFORMED_QUERY</sf:exceptionCode><sf:exceptionMessage>unexpected token: Insert</sf:exceptionMessage><sf:row>1</sf:row><sf:column>0</sf:column></sf:MalformedQueryFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>, status=Internal Server Error, statusCode=500]

 

Help me to insert record in ORG2... not getting where I am missing point. :(

 

Hi ,

 

I want to build one functionality in app for import, so can please elaborate idea behind the packets sample data import? How that sample data is coming, I want to provide the same kind of functionality, please help me to achieve the same, atleast some hints so that I can work on this.

 

 

Thanks,

Harshala.

Hello Everyone,

 

 

Just joined  Force.com Discussion Board :). I have one question which eating my brain. I am trying to implement one feature which will restrict user to see chatter post (If some restricted info it contains) even if he is follower of me or viceversa. 

 

I have implemented trigger which will invoked when I will post something with some restricted info. Also I have selected some users in one of my object to do not to post them such post. But let suppose there are Users A, B, C and all are my followers. When I will post something to A with some secret info that time it should be visible to User B, C.

 

 

Is it possible in apex code? Please help me for this, if you have any hints plz post.

 

 

 

Thanks,

Hi,

 

I am trying to get one webservice methdos from one org to another org without any login details.

 

My webservice :

 

global class testWebservice
{  
     
      webservice static string test()
      {
          return 'test-test';
      }   
 
}

 

 

from another org I am calling :

 

 HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
 
// I have created site and given public access to testWebservice class



req.setEndpoint('https://harshalatest-developer-edition.na7.force.com/mysite/services/Soap/class/testWebservice/test'); req.setMethod('POST'); req.setHeader('SOAPAction',''); req.setHeader('Content-Type', 'text/xml;charset=UTF-8'); req.setCompressed(true); // otherwise we hit a limit of 32000 try { res = http.send(req); System.debug('In sendRequest BODY: '+res.getBody()); System.debug('STATUS:'+res.getStatus()); System.debug('STATUS_CODE:'+res.getStatusCode()); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); }

referring : http://www.fishofprey.com/2010/11/invoking-public-salesforce-web-service.html 

 

getting error :

 

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>SOAPAction HTTP header missing</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>

Where I am going wrong? or help me out a simple way to call webservice from one org to another...it has been 2-3 days i  am stucked..please help

Hi,

I am trying to fetch some Lead records from ORG1  and if some condition is satisfied create records in org2  from my current org.

 

I have credential of both ORGs .

 

list<Record> records = new list<Record>();

SFConnectionController controller = new SFConnectionController();

// First org from where I am fetching Lead records
LoginResult loginResult = controller.login(firstOrgUsername, firstOrgPassword, securityToken);
if(!loginResult.isError)
{
   Response response = controller.query('select Name from Lead, loginResult);

  records = response.data.records;

  if(/*somecondition*/)
 {
   // Second org where I want to insert record 
      LoginResult loginResultPublishingOrg = controller.login(secondOrgUserNmme, secondOrgPassword, securityToken);
   // here I want to insert record - I am not sure is it right syntax or not - Subscribe_User__c is object in second org
      Response response_insert = controller.query('Insert into Subscribe_User__c (User_Name__c)values ('Harshala')', loginResultPublishingOrg);
	
   /**** Getting error in response


 }
}

 

Received following error :

response_insert:Response:[data=Result:[fields={}, records=()], isError=true, message=Query Failed, result=<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>sf:MALFORMED_QUERY</faultcode><faultstring>MALFORMED_QUERY: unexpected token: Insert</faultstring><detail><sf:MalformedQueryFault xsi:type="sf:MalformedQueryFault"><sf:exceptionCode>MALFORMED_QUERY</sf:exceptionCode><sf:exceptionMessage>unexpected token: Insert</sf:exceptionMessage><sf:row>1</sf:row><sf:column>0</sf:column></sf:MalformedQueryFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>, status=Internal Server Error, statusCode=500]

 

Help me to insert record in ORG2... not getting where I am missing point. :(