我正在尝试在mule中使用facebook连接器,我有2个流程,一个用于授权,另一个用于在facebook中发布简单文本。问题是在授权我的程序后,我丢失了accessTokenID,并且无法保存。
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:facebook="http://www.mulesoft.org/schema/mule/facebook" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/facebook http://www.mulesoft.org/schema/mule/facebook/2.0/mule-facebook.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<facebook:config-with-oauth name="Facebook" appId="appID" appSecret="appSecret" doc:name="Facebook" scope="publish_stream">
<facebook:oauth-callback-config domain="${fullDomain}" localPort="${http.port}"/>
</facebook:config-with-oauth>
<flow name="Authorization" doc:name="Authorization">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="${http.port}" doc:name="HTTP"/>
<facebook:authorize config-ref="Facebook" doc:name="Facebook"/>
<set-session-variable doc:name="Save Access Token" value="\#[flowVars['OAuthAccessTokenId']]" variableName="accessTokenId"/>
<flow-ref name="posting" doc:name="post on facebook"/>
</flow>
<flow name="posting" doc:name="posting">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="${http.port}" path="post" doc:name="HTTP"/>
<facebook:publish-message config-ref="Facebook" msg="Hi, I am from Mule, where are you from?" profile_id="myprofileID" doc:name="Facebook" accessTokenId="\#[sessionVars['accessTokenId']]"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>
这是我在cloudhub中遇到的错误:
********************************************************************************
Message : null
Code : MULE_ERROR--1
--------------------------------------------------------------------------------
Exception stack is:
1. null (org.mule.api.store.ObjectStoreNotAvaliableException)
com.mulesoft.ch.objectstore.proxy.ObjectStoreProxyImpl:59 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/store/ObjectStoreNotAvaliableException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.store.ObjectStoreNotAvaliableException
at com.mulesoft.ch.objectstore.proxy.ObjectStoreProxyImpl.contains(ObjectStoreProxyImpl.java:59)
at com.mulesoft.ch.objectstore.ObjectStoreImpl.contains(ObjectStoreImpl.java:31)
at org.mule.module.facebook.oauth.FacebookConnectorOAuthClientFactory.makeObject(FacebookConnectorOAuthClientFactory.java:31)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
任何人都可以帮助我吗?我认为会话变量不会被保存,但我无法证明它。提前致谢
答案 0 :(得分:0)
这里有一个主要的斜杠:#[flowVars [&#39; OAuthAccessTokenId&#39;]]和这里:#[sessionVars [&#39; accessTokenId&#39;]]。尝试删除它们,也尝试记录该值
答案 1 :(得分:0)
供将来参考,截至目前: https://github.com/mulesoft/facebook-connector/blob/master/doc/sample.md上的代码是错误的,在流程中它使用了与我的代码相同的'\':
<flow name="Authorize" doc:name="Authorize">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="HTTP"/>
<facebook:authorize config-ref="Facebook-config" doc:name="Authorize"/>
<set-session-variable doc:name="Save Access Token" value="\#[flowVars['OAuthAccessTokenId']]" variableName="accessTokenId"/>
<flow-ref name="PhotoDownload" doc:name="Call Photo Download"/>
</flow>
希望将来能够纠正它