Hi RRT Team, I guess we need to use "OAuth" instead of "Bearer" [2]. Shall we try this and fix the bug?
[1] https://github.com/wso2-extensions/esb-connector-salesforcerest/blob/master/src/main/resources/salesforcerest-config/init.xml#L126 [2] https://salesforce.stackexchange.com/questions/184947/salesforce-rest-api-invalid-session-id-error-when-using-access-token On Fri, Dec 1, 2017 at 10:23 AM, Lahiru Cooray <[email protected]> wrote: > Hi Rajith, > Thank you for the reply but I'm using 'init for username password flow' > mentioned in [1] > > > [1] https://docs.wso2.com/display/ESBCONNECTORS/Configuring+Salesforce+ > Operations > > On Fri, Dec 1, 2017 at 8:31 AM, Rajith Siriwardena <[email protected]> > wrote: > >> >> Hi Lahiru, >> >> Aren't you missing following init properties. >> >> - >> intervalTime: The Interval time in milliseconds to check the access >> token validity. >> - registryPath: Registry path of the connector where the values are >> stored. You must give the value as : connectors/<value> >> . >> >> For example: registryPath = "connectors/salesforcerest". >> >> >> Thanks, >> Rajith >> >> >> [1] https://docs.wso2.com/display/ESBCONNECTORS/Configuring+ >> Salesforce+Operations >> >> On Thu, Nov 30, 2017 at 12:56 PM, Lahiru Cooray <[email protected] >> > wrote: >> >>> Hi team, >>> Im using ESB Salesforce REST connector to performce some operations in >>> SF. >>> >>> <api xmlns="http://ws.apache.org/ns/synapse" name="sendOrder" >>> context="/sendOrder"> >>> <resource methods="POST" url-mapping="/"> >>> <inSequence> >>> <salesforcerest.init> >>> <apiUrl>https://ap5.salesforce.com/</apiUrl> >>> <clientId>XXXXXXX</clientId> >>> <clientSecret>XXXXXXX</clientSecret> >>> <hostName>https://login.salesforce.com</hostName> >>> <apiVersion>XXXXXXX</apiVersion> >>> <username>XXXXX</username> >>> <password>XXXXXX</password> >>> </salesforcerest.init> >>> <log level="full"/> >>> <salesforcerest.recentlyViewedItem> >>> <limit>5</limit> >>> </salesforcerest.recentlyViewedItem> >>> <log level="full"/> >>> <respond/> >>> </inSequence> >>> <outSequence> >>> <send/> >>> </outSequence> >>> </resource> >>> </api> >>> >>> Init get succeeded but the subsequent API calls get failed saying that >>> the session is invalid. >>> { >>> "message": "Session expired or invalid", >>> "errorCode": "INVALID_SESSION_ID" >>> } >>> >>> I tried to revoke the access token and generating a new one but still I >>> face the same issue. highly appreciate your suggestions on this. >>> >>> >>> >>> 7-12-01 00:14:47,172] INFO - LogMediator To: >>> http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: >>> , MessageID: urn:uuid:076481b3-c1f0-4663-a19f-511f2ecd0eee, Direction: >>> request, Payload: {"access_token":"XXX!XXXXXX","instance_url":" >>> https://cs58.salesforce.com","id":"https://te >>> st.salesforce.com/id/00D0l00000340CrhxEAC/005546F000005kaBGQAY >>> ","token_type":"Bearer","issued_at":"XXX","signature":"XXX >>> XX+z6HbpWvod+4DUI="} >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "GET //services/data/v40.0/theme HTTP/1.1[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Authorization: Bearer XXXX!XXXXXX[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "X-ReadOnlyMode: false[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Cache-Control: no-cache,must-revalidate,max-a >>> ge=0,no-store,private[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "X-Content-Type-Options: nosniff[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Content-Security-Policy: upgrade-insecure-requests[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Set-Cookie: BrowserId=9efBu0mDTIWX7as_4T0ihA;Path=/;Domain=. >>> salesforce.com;Expires=Mon, 29-Jan-2018 18:44:46 >>> GMT;Max-Age=5184000[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Vary: Accept-Encoding[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "X-XSS-Protection: 1; mode=block[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Content-Type: application/json;charset=UTF-8[\r][\n]" >>> [2017-12-01 00:14:47,174] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Host: ap5.salesforce.com[\r][\n]" >>> [2017-12-01 00:14:47,175] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "Connection: Keep-Alive[\r][\n]" >>> [2017-12-01 00:14:47,175] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]" >>> [2017-12-01 00:14:47,175] DEBUG - wire HTTPS-Sender I/O dispatcher-2 << >>> "[\r][\n]" >>> [2017-12-01 00:14:47,560] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "HTTP/1.1 401 Unauthorized[\r][\n]" >>> [2017-12-01 00:14:47,561] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Date: Thu, 30 Nov 2017 18:44:47 GMT[\r][\n]" >>> [2017-12-01 00:14:47,561] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]" >>> [2017-12-01 00:14:47,561] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "X-Content-Type-Options: nosniff[\r][\n]" >>> [2017-12-01 00:14:47,561] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "X-XSS-Protection: 1; mode=block[\r][\n]" >>> [2017-12-01 00:14:47,561] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Content-Security-Policy: upgrade-insecure-requests [\r][\n]" >>> [2017-12-01 00:14:47,561] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Cache-Control: no-cache,must-revalidate,max-a >>> ge=0,no-store,private[\r][\n]" >>> [2017-12-01 00:14:47,562] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Set-Cookie: BrowserId=nrfXAmi3RPidZl2vKAAAiA;Path=/;Domain=. >>> salesforce.com;Expires=Mon, 29-Jan-2018 18:44:47 >>> GMT;Max-Age=5184000[\r][\n]" >>> [2017-12-01 00:14:47,562] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]" >>> [2017-12-01 00:14:47,562] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "WWW-Authenticate: Token[\r][\n]" >>> [2017-12-01 00:14:47,562] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Content-Type: application/json;charset=UTF-8[\r][\n]" >>> [2017-12-01 00:14:47,562] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "Transfer-Encoding: chunked[\r][\n]" >>> [2017-12-01 00:14:47,562] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "[\r][\n]" >>> [2017-12-01 00:14:47,562] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "4B[\r][\n]" >>> [2017-12-01 00:14:47,563] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "[{"message":"Session expired or invalid","errorCode":"INVALID_ >>> SESSION_ID"}][\r][\n]" >>> [2017-12-01 00:14:47,563] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "0[\r][\n]" >>> [2017-12-01 00:14:47,563] DEBUG - wire HTTPS-Sender I/O dispatcher-2 >> >>> "[\r][\n]" >>> [2017-12-01 00:14:47,566] INFO - LogMediator To: >>> http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: >>> , MessageID: urn:uuid:853c8354-a633-4d91-a124-050ada7e7595, Direction: >>> request, Payload: [{"message":"Session expired or >>> invalid","errorCode":"INVALID_SESSION_ID"}] >>> [2017-12-01 00:14:47,569] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "HTTP/1.1 401 Unauthorized[\r][\n]" >>> [2017-12-01 00:14:47,570] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]" >>> [2017-12-01 00:14:47,570] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Cache-Control: no-cache,must-revalidate,max-a >>> ge=0,no-store,private[\r][\n]" >>> [2017-12-01 00:14:47,570] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "X-Content-Type-Options: nosniff[\r][\n]" >>> [2017-12-01 00:14:47,571] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Content-Security-Policy: upgrade-insecure-requests[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "WWW-Authenticate: Token[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Set-Cookie: BrowserId=nrfXAmi3RPidZl2vKAAAiA;Path=/;Domain=. >>> salesforce.com;Expires=Mon, 29-Jan-2018 18:44:47 >>> GMT;Max-Age=5184000[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "X-XSS-Protection: 1; mode=block[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Content-Type: application/json;charset=UTF-8[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Date: Thu, 30 Nov 2017 18:44:47 GMT[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Transfer-Encoding: chunked[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "Connection: keep-alive[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "4b[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "[{"message":"Session expired or invalid","errorCode":"INVALID_ >>> SESSION_ID"}][\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "0[\r][\n]" >>> [2017-12-01 00:14:47,572] DEBUG - wire HTTP-Listener I/O dispatcher-2 << >>> "[\r][\n]" >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> *Rajith Siriwardana* >> WSO2 Inc. | http://wso2.com >> *lean. enterprise. middleware* >> >> --------------------------------------------------- >> *https://home.apache.org/~siriwardana >> <https://home.apache.org/~siriwardana>* >> >> >> >> Disclaimer: This communication may contain privileged or other >> confidential information and is intended exclusively for the addressee/s. >> If you are not the intended recipient/s, or believe that you may have >> received this communication in error, please reply to the sender indicating >> that fact and delete the copy you received and in addition, you should not >> print, copy, re-transmit, disseminate, or otherwise use the information >> contained in this communication. Internet communications cannot be >> guaranteed to be timely, secure, error or virus-free. The sender does not >> accept liability for any errors or omissions. >> > > -- Best Regards, Malaka Silva Associate Director / Architect M: +94 777 219 791 Tel : 94 11 214 5345 Fax :94 11 2145300 Skype : malaka.sampath.silva LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77 Blog : http://mrmalakasilva.blogspot.com/ WSO2, Inc. lean . enterprise . middleware https://wso2.com/signature http://www.wso2.com/about/team/malaka-silva/ <http://wso2.com/about/team/malaka-silva/> https://store.wso2.com/store/ Don't make Trees rare, we should keep them with care
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
