Yes this should be the way. Only use init method before each call. On Sat, Jun 4, 2016 at 8:00 AM, Shakila Sivagnanarajah <shak...@wso2.com> wrote:
> Hi Maheeka, > > Since the refreshing access token is automated in the connector, you can > use following init configuration. > > <gmail.init> > <refreshToken>{$ctx:refreshToken}</refreshToken> > <clientId>{$ctx:clientId}</clientId> > <clientSecret>{$ctx:clientSecret}</clientSecret> > > <accessTokenRegistryPath>{$ctx:accessTokenRegistryPath}</accessTokenRegistryPath> > <accessToken>{$ctx:accessToken}</accessToken> > <apiUrl>{$ctx:apiUrl}</apiUrl> > <userId>{$ctx:userId}</userId> > </gmail.init> > <gmail.createAMail> > <to>{$ctx:to}</to> > <subject>{$ctx:subject}</subject> > <from>{$ctx:from}</from> > <messageBody>{$ctx:messageBody}</messageBody> > <cc>{$ctx:cc}</cc> > <bcc>{$ctx:bcc}</bcc> > </gmail.createAMail> > <gmail.endSession/> > > Thanks > > On Sat, Jun 4, 2016 at 7:40 AM, Shakila Sivagnanarajah <shak...@wso2.com> > wrote: > >> Hi Maheeka, >> >> I Just have tested it, it is working fine. It seems the access token is >> not set in your call. >> >> Please try with this configuration. >> >> <gmail.getAccessTokenFromRefreshToken> >> <refreshToken>{$ctx:refreshToken}</refreshToken> >> <clientId>{$ctx:clientId}</clientId> >> <clientSecret>{$ctx:clientSecret}</clientSecret> >> <grantType>{$ctx:grantType}</grantType> >> </gmail.getAccessTokenFromRefreshToken> >> <gmail.init> >> <apiUrl>{$ctx:apiUrl}</apiUrl> >> <userId>{$ctx:userId}</userId> >> </gmail.init> >> <gmail.createAMail> >> <to>{$ctx:to}</to> >> <subject>{$ctx:subject}</subject> >> <from>{$ctx:from}</from> >> <messageBody>{$ctx:messageBody}</messageBody> >> <cc>{$ctx:cc}</cc> >> <bcc>{$ctx:bcc}</bcc> >> </gmail.createAMail> >> <gmail.endSession/> >> >> >> Thanks >> >> On Sat, Jun 4, 2016 at 7:33 AM, Malaka Silva <mal...@wso2.com> wrote: >> >>> Looping Hariprasath. >>> >>> On Sat, Jun 4, 2016 at 7:25 AM, Shakila Sivagnanarajah <shak...@wso2.com >>> > wrote: >>> >>>> Hi Maheeka, >>>> >>>> I will check and update you >>>> >>>> Thanks >>>> >>>> On Sat, Jun 4, 2016 at 1:05 AM, Maheeka Jayasuriya <mahe...@wso2.com> >>>> wrote: >>>> >>>>> Hi Shakila/Malaka, >>>>> >>>>> I am getting the following errors when using the latest gmail >>>>> connector from connector store. I am getting the clientId and clientSecret >>>>> from the app and the refresh token and access token from playground app. >>>>> Used apiUrl as https://www.googleapis.com/gmail. >>>>> >>>>> Am I doing any configuration wrong? >>>>> >>>>> [2016-06-04 00:04:44,784] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "POST //v1/users/johndoeintcl...@gmail.com/messages/send >>>>> HTTP/1.1[\r][\n]" >>>>> [2016-06-04 00:04:44,784] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "X-Frame-Options: SAMEORIGIN[\r][\n]" >>>>> [2016-06-04 00:04:44,784] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Authorization: Bearer [\r][\n]" >>>>> [2016-06-04 00:04:44,785] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Alt-Svc: quic=":443"; ma=2592000; >>>>> v="34,33,32,31,30,29,28,27,26,25"[\r][\n]" >>>>> [2016-06-04 00:04:44,785] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Vary: X-Origin[\r][\n]" >>>>> [2016-06-04 00:04:44,785] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "X-XSS-Protection: 1; mode=block[\r][\n]" >>>>> [2016-06-04 00:04:44,785] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Expires: Fri, 03 Jun 2016 18:34:43 GMT[\r][\n]" >>>>> [2016-06-04 00:04:44,785] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Alternate-Protocol: 443:quic[\r][\n]" >>>>> [2016-06-04 00:04:44,785] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Content-Type: application/json; charset=UTF-8[\r][\n]" >>>>> [2016-06-04 00:04:44,786] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Accept-Ranges: none[\r][\n]" >>>>> [2016-06-04 00:04:44,786] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "X-Content-Type-Options: nosniff[\r][\n]" >>>>> [2016-06-04 00:04:44,786] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Content-Length: 38[\r][\n]" >>>>> [2016-06-04 00:04:44,786] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Host: mail.google.com[\r][\n]" >>>>> [2016-06-04 00:04:44,786] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "Connection: Keep-Alive[\r][\n]" >>>>> [2016-06-04 00:04:44,786] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]" >>>>> [2016-06-04 00:04:44,787] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "[\r][\n]" >>>>> [2016-06-04 00:04:44,787] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> << "{"raw":"dG86bWFoZWVrYUB3c28yLmNvbQo="}" >>>>> [2016-06-04 00:04:45,052] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "HTTP/1.1 301 Moved Permanently[\r][\n]" >>>>> [2016-06-04 00:04:45,052] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Location: >>>>> https://www.google.com/v1/users/johndoeintcl...@gmail.com/messages/send[\r][\n] >>>>> " >>>>> [2016-06-04 00:04:45,053] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Content-Type: text/html; charset=UTF-8[\r][\n]" >>>>> [2016-06-04 00:04:45,053] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "X-Content-Type-Options: nosniff[\r][\n]" >>>>> [2016-06-04 00:04:45,053] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Date: Fri, 03 Jun 2016 18:34:44 GMT[\r][\n]" >>>>> [2016-06-04 00:04:45,053] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Expires: Sun, 03 Jul 2016 18:34:44 GMT[\r][\n]" >>>>> [2016-06-04 00:04:45,053] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Cache-Control: public, max-age=2592000[\r][\n]" >>>>> [2016-06-04 00:04:45,053] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Server: sffe[\r][\n]" >>>>> [2016-06-04 00:04:45,054] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Content-Length: 268[\r][\n]" >>>>> [2016-06-04 00:04:45,054] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "X-XSS-Protection: 1; mode=block[\r][\n]" >>>>> [2016-06-04 00:04:45,054] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Alternate-Protocol: 443:quic[\r][\n]" >>>>> [2016-06-04 00:04:45,054] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "Alt-Svc: quic=":443"; ma=2592000; >>>>> v="34,33,32,31,30,29,28,27,26,25"[\r][\n]" >>>>> [2016-06-04 00:04:45,054] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "[\r][\n]" >>>>> [2016-06-04 00:04:45,054] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "<HTML><HEAD><meta http-equiv="content-type" >>>>> content="text/html;charset=utf-8">[\n]" >>>>> [2016-06-04 00:04:45,055] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "<TITLE>301 Moved</TITLE></HEAD><BODY>[\n]" >>>>> [2016-06-04 00:04:45,055] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "<H1>301 Moved</H1>[\n]" >>>>> [2016-06-04 00:04:45,055] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "The document has moved[\n]" >>>>> [2016-06-04 00:04:45,055] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "<A HREF=" >>>>> https://www.google.com/v1/users/johndoeintcl...@gmail.com/messages/send >>>>> ">here</A>.[\r][\n]" >>>>> [2016-06-04 00:04:45,055] DEBUG - wire HTTPS-Sender I/O dispatcher-3 >>>>> >> "</BODY></HTML>[\r][\n]" >>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------------------------------------------------------- >>>>> >>>>> [2016-06-04 00:53:56,567] ERROR - ClientUtils The system cannot infer >>>>> the transport information from the //users//messages/send URL. >>>>> [2016-06-04 00:53:56,573] ERROR - Axis2Sender Unexpected error during >>>>> sending message out >>>>> org.apache.axis2.AxisFault: The system cannot infer the transport >>>>> information from the //users//messages/send URL. >>>>> at >>>>> org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81) >>>>> at >>>>> org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:115) >>>>> at >>>>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) >>>>> at >>>>> org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:569) >>>>> at >>>>> org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:79) >>>>> at >>>>> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:546) >>>>> at >>>>> org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:383) >>>>> at >>>>> org.apache.synapse.endpoints.HTTPEndpoint.send(HTTPEndpoint.java:85) >>>>> at >>>>> org.apache.synapse.mediators.builtin.CallMediator.handleNonBlockingCall(CallMediator.java:217) >>>>> at >>>>> org.apache.synapse.mediators.builtin.CallMediator.mediate(CallMediator.java:99) >>>>> at >>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97) >>>>> at >>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:54) >>>>> at >>>>> org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:104) >>>>> at >>>>> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:148) >>>>> at >>>>> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:84) >>>>> at >>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97) >>>>> at >>>>> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:171) >>>>> at >>>>> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:286) >>>>> at >>>>> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:779) >>>>> at >>>>> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:281) >>>>> at >>>>> org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:551) >>>>> at >>>>> org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:190) >>>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) >>>>> at >>>>> org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.processResponse(MultitenantMessageReceiver.java:166) >>>>> at >>>>> org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.receive(MultitenantMessageReceiver.java:82) >>>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) >>>>> at >>>>> org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:255) >>>>> at >>>>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) >>>>> at >>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >>>>> at >>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >>>>> at java.lang.Thread.run(Thread.java:745) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> Thanks, >>>>> Maheeka >>>>> >>>> >>>> >>>> >>>> -- >>>> Shakila Sivagnanarajah >>>> Software Engineer >>>> Mobile :+94 (0) 768 856837 >>>> shak...@wso2.com >>>> >>> >>> >>> >>> -- >>> >>> Best Regards, >>> >>> Malaka Silva >>> Senior Technical Lead >>> 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 >>> http://www.wso2.com/ >>> http://www.wso2.com/about/team/malaka-silva/ >>> <http://wso2.com/about/team/malaka-silva/> >>> https://store.wso2.com/store/ >>> >>> Save a tree -Conserve nature & Save the world for your future. Print >>> this email only if it is absolutely necessary. >>> >> >> >> >> -- >> Shakila Sivagnanarajah >> Software Engineer >> Mobile :+94 (0) 768 856837 >> shak...@wso2.com >> > > > > -- > Shakila Sivagnanarajah > Software Engineer > Mobile :+94 (0) 768 856837 > shak...@wso2.com > -- Best Regards, Malaka Silva Senior Technical Lead 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 http://www.wso2.com/ http://www.wso2.com/about/team/malaka-silva/ <http://wso2.com/about/team/malaka-silva/> https://store.wso2.com/store/ Save a tree -Conserve nature & Save the world for your future. Print this email only if it is absolutely necessary.
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev