2

Is there any way to create a public SOAP web service in Salesforce? I followed the instructions at http://forceguru.blogspot.com/2012/09/creating-public-web-service-in.html , but when I tried to access my web service, I got an error - "UNKNOWN_EXCEPTION: Site under construction"

  • 6
    Did you make an effort to look in the documentation ? – Samuel De Rycke Oct 23 '12 at 12:27
  • I merged Inshar's comment into the question to show that some effort had been expended, and deleted comments that were thereby rendered moot. – metadaddy Oct 24 '12 at 5:47
  • @Inshar Please update your question with more details on what you have set up already, and at what action you get the exception. Without details the very best we can do is make an educated guess. – Samuel De Rycke Oct 24 '12 at 5:48
  • Can you post your site URL? Are you including the path prefix? – Ryan Guest Oct 24 '12 at 6:07
6

http://forceguru.blogspot.in/2012/09/creating-public-web-service-in.html

Force Guru had posted a code on how to use sites and create a public webservice .

global class DemoClass {
    webService static string Method() {
        return 'DoSomething' ;
    }
}

You may need to change the address in your SOAP file enter image description here

Also if you are looking for proper documentation using apex class methods to expose as WSDLs here is the doc

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_web_services_methods.htm

  • Hi Mohith, Thanks for the reply. I followed the Force Guru link. But, When I tried with the SoapUI to access my webservice I got an error saying "UNKNOWN_EXCEPTION: Site under construction" Any Idea? – Inshar Oct 24 '12 at 4:48
  • I found the error. Its something wrong with the Endpoint URL. I changed the endpoint url as following. https://**ap1-api.salesforce.com**/services/Soap/class/InsharWS Replace the bolded text with your default web address of your site. In my case, its inshar-developer-edition.ap1.force.com/testWS So finally, It should look like inshar-developer-edition.ap1.force.com/testWS/services/Soap/… I only used inshar-developer-edition.ap1.force.com, earlier. That was the issue. Thanks all for your support! – Inshar Oct 24 '12 at 5:38
  • @inshar, please post your solution as answer (and accept it), or accept on of the given answers so that it becomes clear to other users that your issue was solved :) – Samuel De Rycke Oct 24 '12 at 6:59
7

And if you want to use REST, I suggest taking a look at: http://blogs.developerforce.com/developer-relations/2012/02/quick-tip-public-restful-web-services-on-force-com-sites.html

you basically create apexrest classes, and add the classes to a public salesforce site

  • Hi Peiterjan, Thanks for the reply. I did the same thing with soap. Also, I changed the binding URL for "myDomain-developer-edition.ap1.force.com/services/Soap/class/…" and try to call the webservice with SoapUI. Then I got this error - "UNKNOWN_EXCEPTION: Site under construction" Any Idea? Thanks – Inshar Oct 24 '12 at 4:43
  • did you add all the classes to the public site profile access? However i'm not that familiar with public SOAP webservices – pjcarly Oct 24 '12 at 11:57
0

I found the error. Its something wrong with the Endpoint URL. I changed the endpoint url as following.

https://ap1-api.salesforce.com/services/Soap/class/InsharWS

Replace the bolded text with your default web address of your site. In my case, its inshar-developer-edition.ap1.force.com/testWS

So finally, It should look like http://inshar-developer-edition.ap1.force.com/testWS/services/Soap/class/InsharWS

I only used inshar-developer-edition.ap1.force.com, earlier. That was the issue.

Thanks all for your support!

  • Next to your (or any other answer in a question you post), you will see a (V) icon which you can click to select the answer as accepted. This will mark your question as resolved. – Samuel De Rycke Oct 24 '12 at 12:37
  • @Inshar I just followed all steps, just dont get how to modify the service url, are you downloading the WSDL and uploading it again or how can i achieve it? – Edgar Sep 7 '17 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.