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
Harshala ShewaleHarshala Shewale 

Unable to access webservice method from one org to another

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

Navatar_DbSupNavatar_DbSup

Hi,

 

As you are trying to create access between to org so login is necessary using web services.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

For reference follow the below link:

 

http://boards.developerforce.com/t5/Apex-Code-Development/Working-wiht-webservices/td-p/395369

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

Harshala ShewaleHarshala Shewale

Hi Navatar,

 

 

Sorry this didnt solve my problem as I want to call webservice without using login crediantials. The Org from  where I am call ing webservice will be client's org and I should not store my other org crediantial into Client's org. Also password gonna change time to time as want to make client's org code as managed. its not fesible solution so far...Please tell what do I do now?

 

 

 

Pat PattersonPat Patterson

Hi Harshala - it looks like this forum post might solve your problem:

 

http://boards.developerforce.com/t5/Apex-Code-Development/Salesforce-HTTP-callout-to-Salesforce-Site-Web-service/m-p/273541#M47696

 

Cheers,


Pat

Jia HuJia Hu
It doesn't work. How to call the Apex WS. Someone please help.