Tag: salesforce

使用连接器将文件上载到salesforce

我在mule中建立了一个流程,使用“Salesforce”连接器在Salesforce中创建一个案例。 现在我需要使用相同的mule流将文件上传到该案例。 这可以通过以下代码以编程方式完成: 尝试{ File f = new File(“c:\java\test.docx”); InputStream is = new FileInputStream(f); byte[] inbuff = new byte[(int)f.length()]; is.read(inbuff); Attachment attach = new Attachment(); attach.setBody(inbuff); attach.setName(“test.docx”); attach.setIsPrivate(false); // attach to an object in SFDC attach.setParentId(“a0f600000008Q4f”); SaveResult sr = binding.create(new com.sforce.soap.enterprise.sobject.SObject[] {attach})[0]; if (sr.isSuccess()) { System.out.println(“Successfully added attachment.”); } else { System.out.println(“Error adding attachment: ” […]

无法访问资源:401 – 仅适用于RestClient插件

我正在使用Postman(Chrome插件)和RestClient(Mozilla插件)​​,当我通过Postman执行时它不起作用。 但是同样使用Rest CLient执行它然后它工作。 即使是相同的我执行代码 OAuthClientRequest request = OAuthClientRequest .tokenLocation(ACCESS_TOKEN_URL) .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(CLIENT_ID) .setClientSecret(CLIENT_SECRET) .setRedirectURI(REDIRECT_URL) .setCode(authorizationCode) .buildQueryMessage(); //create OAuth client that uses custom http client under the hood OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient()); OAuthAccessTokenResponse oAuthResponse = oAuthClient.accessToken(request); System.out.println(oAuthResponse.getBody()); request= new OAuthBearerClientRequest(“https://ap5.salesforce.com//services/data/v40.0/”). setAccessToken(oAuthResponse.getAccessToken()). buildBodyMessage(); OAuthClient client = new OAuthClient(new URLConnectionClient()); OAuthResourceResponse resourceResponse= client.resource(request, “GET”, OAuthResourceResponse.class); if (resourceResponse.getResponseCode()==200){ […]

Spring MVC Apache Oltu和Salesforce Integration示例OAUTH_APPROVAL_ERROR_GENERIC:身份validation期间发生了意外错误

我在这里扩展问题: java.io.IOException:服务器返回HTTP响应代码:411为URL:https://login.live.com/oauth20_token.srf?code = 我正在开发Spring MVC + Apache Oltu + Salesforce Integration示例。 在此示例中,我在salesforce中创建了连接的App,如下所示: 在这个例子中,我在下面使用: ACCESS_TOKEN_URL =“ https://login.salesforce.com/services/oauth2/token ” AUTHORIZATION_URL =“ https://login.salesforce.com/services/oauth2/authorize ”; 什么是OAuthBearerClientRequest请求? 和Github一样,我使用过https://api.github.com/user 。 salesforce的URL是什么? 这是从我的代码调用: https://login.salesforce.com/services/oauth2/authorize?scope=full&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapache-oltu%2Fsalesforce%2Fredirect&client_id=3MVG9d8..z.hDcPJZPIzGJ5UZDqJOJY.3R6RBM8sJAF8PyTtdTE.DDBnScvPEbcbUmaZ1HQjYItOLpnjY4JHL 但授权中没有任何内容。 例如: OAuthBearerClientRequest for Linkedin – https://api.linkedin.com/v1/people/~?oauth2_access_token= Facebook – https://graph.facebook.com/me/friends Github- https://api.github.com/user //api.github.com/user 什么是销售人员? 此URL也没有我想要的信息: https : //developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com#Obtaining_an_Access_Token_using_a_SAML_Bearer_Assertion 。 如果有人需要代码供参考,请告诉我。 我看到的错误:: error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration 这里提到的问题: https : //issues.apache.org/jira/browse/OLTU-210