5

I've created a custom button on the opportunity layout which calls out to an external java app. It passes the session id and the partner API URL. The external app then creates a SOAP binding (leveraging the partner wsdl downloaded from Setup). The first thing I do with the binding is call SoapBindingStub.getUserInfo().

My org has the Communities feature enabled to allow partner users to log in through community portals. When I click the custom button coming from a community portal, the above fails and I see "Caused by: (411)Length Required" in the stack. It works just fine if I click the button coming from salesforce (rather than a community portal).

Any ideas what's causing the RemoteException? I'm using the same user for both scenarios. Here's the full stack trace:

Caused by: (411)Length Required at 
org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:218) at 
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at 
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at 
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at 
org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at 
org.apache.axis.client.Call.invokeEngine(Call.java:2784) at 
org.apache.axis.client.Call.invoke(Call.java:2767) at 
org.apache.axis.client.Call.invoke(Call.java:2443) at 
org.apache.axis.client.Call.invoke(Call.java:2366) at 
org.apache.axis.client.Call.invoke(Call.java:1812) at 
com.sforce.soap.partner.SoapBindingStub.getUserInfo(SoapBindingStub.java:3994)

I'm wondering if the URL is the cause. Is there some setting/permission in communities that needs to be set in order to do this? Here are the URLS observed:

https://myCommunityDomainName.force.com/myCommunityName/services/Soap/u/28.0/00Di0000000eG2r -does not work

https://na15.salesforce.com/services/Soap/u/28.0/00Di0000000eG2r -works

5

Found an answer for this.

I used SOAP UI to try making these calls, and I got a more helpful error message: "API access is disabled for Communities". From there I was able to find a blog post with some details.

Apparently, when coming from a Community portal, the API.Parner_Server_URL should not be used to make API calls back to Salesforce (what?!). Salesforce support says to use the endpoint that would result from a standard salesforce user clicking the link (na15.salesforce.com/... as seen above, for example). They claim it is working as designed, which makes me wonder what the heck API.Parner_Server_URL is any good for when coming though a community portal.

Here's the blog post for reference: http://boards.developerforce.com/t5/APIs-and-Integration/API-Access-Disabled-for-Communities/td-p/644035

EDIT: See Dana's answer below; according to the author, support for this has been added as of Summer '15.

  • For some reason, security to Communities portals isn't handled the same as normal SF. SSO and other certain other protocols seem to be a version behind from what I've been reading in the docs. Its a though they released Communities just a bit before it was fully ready for prime time. I suspect we'll be seeing a lot of "new features" with each new SF release that arrives. ;) – crmprogdev Sep 6 '13 at 18:02
  • That could be. Maybe using the URL provided through the community portal will work as expected in one of the coming releases. I hope. It seems silly to require a work-around from something like this. – CDelaney Sep 6 '13 at 18:19
  • Did you ever have any success in actually getting this working? Did anything improve in the subsequent SF releases? – Joel Mansford Mar 7 '14 at 0:22
  • I haven't tried since, but the Winter '14 release notes make it sound as if it is supported now. See the section titled "Improved Communities API Support" here: help.salesforce.com/help/pdfs/en/… – CDelaney Mar 8 '14 at 1:16
  • @CDelaney, I am facing the same issue now. How did you manage to retrieve the Standard Salesforce user Api URL? – Suryatej Mukkamalla Nov 3 '16 at 1:13
1

I can confirm that as of Summer 15, the RESTful Identity URL returns a usable partner url:

https://custom-dev-ed.my.salesforce.com/services/Soap/u/{version}/orgidorgidorgidorgid

Additionally, the API Enabled option must be selected on the community user's profile. From there I was able to access the API on behalf of a community user.

{
   "id":"https://login.salesforce.com/id/orgidorgidorgidorgid/useriduseriduserid",
   "asserted_user":true,
   "user_id":"useriduseriduserid",
   "organization_id":"orgidorgidorgidorgid",
   "username":"custom@custom.com",
   "nick_name":"custom",
   "display_name":"custom",
   "email":"custom@custom.com",
   "email_verified":true,
   "first_name":"custom",
   "last_name":"custom",
   "timezone":"America/Los_Angeles",
   "photos":{
      "picture":"https://custom-dev-ed.my.salesforce.com/img/userprofile/default_profile_200.png",
      "thumbnail":"https://custom-dev-ed.my.salesforce.com/img/userprofile/default_profile_45.png"
   },
   "addr_street":"123 Some Street",
   "addr_city":"Anytown",
   "addr_state":"PA",
   "addr_country":"USA",
   "addr_zip":"80000",
   "mobile_phone":null,
   "mobile_phone_verified":false,
   "status":{
      "created_date":null,
      "body":null
   },
   "urls":{
      "enterprise":"https://custom-dev-ed.my.salesforce.com/services/Soap/c/{version}/orgidorgidorgidorgid",
      "metadata":"https://custom-dev-ed.my.salesforce.com/services/Soap/m/{version}/orgidorgidorgidorgid",
      "partner":"https://custom-dev-ed.my.salesforce.com/services/Soap/u/{version}/orgidorgidorgidorgid",
      "rest":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/",
      "sobjects":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/sobjects/",
      "search":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/search/",
      "query":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/query/",
      "recent":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/recent/",
      "profile":"https://custom-dev-ed.my.salesforce.com/useriduseriduserid",
      "feeds":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/chatter/feeds",
      "groups":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/chatter/groups",
      "users":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/chatter/users",
      "feed_items":"https://custom-dev-ed.my.salesforce.com/services/data/v{version}/chatter/feed-items",
      "custom_domain":"https://custom-dev-ed.my.salesforce.com"
   },
   "active":true,
   "user_type":"POWER_PARTNER",
   "language":"en_US",
   "locale":"en_US",
   "utcOffset":-28800000,
   "last_modified_date":"2015-07-22T10:34:51-06:00",
   "is_app_installed":true
}

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.