Mule Facebook Null Payload

时间:2015-06-10 14:48:29

标签: facebook oauth mule payload

要求评估购买Mulesoft - 并制作连接到Facebook的演示。我跟随这两个样本:
https://github.com/mulesoft/facebook-connector/blob/master/doc/sample.mdhttp://blogs.mulesoft.com/mule-school-integration-with-social-media-part-ii-%E2%80%93-facebook/

遇到第一个样本的问题 - 它不会编译,因为http连接器的端点与facebook连接器相同。我做了一些研究并做了一些修改,但我现在得到以下错误,找不到其他经历过相同的错误:

无法获取访问令牌。 Message payload is of type: NullPayload - 这是在回调页面上。有没有人经历过这个?

这是我的代码:

    <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8099" doc:name="HTTP Listener Configuration"/>
<facebook:config-with-oauth name="Facebook-config" consumerKey="..." consumerSecret="..." scope="user_photos" doc:name="Facebook">
    <facebook:oauth-callback-config domain="localhost" localPort="8099" remotePort="8099" path="callback"/>
</facebook:config-with-oauth>
<http:listener-config name="HTTP_Listener_Configuration1" host="localhost" port="8094" doc:name="HTTP Listener Configuration"/>
<flow name="Authorize">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <facebook:authorize config-ref="Facebook-config" doc:name="Facebook"/>
    <set-session-variable variableName="accessTokenID" value="#[flowVars['OAuthAccessTokenId']]" doc:name="Save Access Token"/>
    <flow-ref name="PhotoDownload" doc:name="Call Photo Download"/>
</flow>
<flow name="PhotoDownload">
    <http:listener config-ref="HTTP_Listener_Configuration1" path="/" doc:name="HTTP"/>
    <not-filter doc:name="Not">
        <wildcard-filter pattern="/favicon.ico" caseSensitive="false"/>
    </not-filter>
    <facebook:get-user-picture config-ref="Facebook-config" user="me" accessTokenId="#[sessionVars['accessTokenId']]" doc:name="Get Profile Picture"/>
    <file:outbound-endpoint path="c:\temp" outputPattern="profilepic.jpg" responseTimeout="10000" doc:name="Save The Picture "/>
    <json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>

这是堆栈跟踪:

        
ERROR 2015-06-10 13:47:07,731 [[internalfacebook].HTTP_Listener_Configuration.worker.01] org mule exception DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Unable to fetch access token. Message payload is of type: NullPayload
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. unable to find valid certification path to requested target (sun.security.provider.certpath.SunCertPathBuilderException)
  sun.security.provider.certpath SunCertPathBuilder:-1 (null)
2. PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (sun.security.validator ValidatorException)
  sun.security.validator PKIXValidator:-1 (null)
3. sun.security.validator ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (javax net ssl SSLHandshakeException)
  sun security ssl Alerts:-1 ( java.sun com/j2ee/sdk_1.3/techdocs/api/javax/net/ssl/SSLHandshakeException html)
4. Error found while consuming http resource at https(colonslashslash) graph facebook com/oauth/access_token (java.lang.RuntimeException)
  org.mule security oauth util HttpUtilImpl:93 (null)
5. Unable to fetch access token. Message payload is of type: NullPayload (org mule api MessagingException)
  org.mule.security.oauth.processor.OAuth2FetchAccessTokenMessageProcessor:95 ( wwwmulesoftrog docs site current3 apidocs org mule api MessagingException html)
--------------------------------------------------------------------------------
Root Exception stack trace:
sun.security.provider certpath SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun security provider certpath SunCertPathBuilder engineBuild(Unknown Source)
    at java.security cert CertPathBuilder build(Unknown Source)
    at sun.security validator PKIXValidator doBuild(Unknown Source)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

INFO  2015-06-10 13:47:08,183 [[internalfacebook].HTTP_Listener_Configuration.worker.01] org mule module http internal listener HttpListenerRegistry: No listener found for request: (GET)/favicon ico
INFO  2015-06-10 13:47:08,184 [[internalfacebook].HTTP_Listener_Configuration.worker.01] org mule module http internal listener HttpListenerRegistry: Available listeners are: [(*)/callback/, (*)/]

1 个答案:

答案 0 :(得分:0)

偶尔会有所帮助。首先,确保您的FB App和Mule FB Config匹配“范围”Ex。 “电子邮件,public_profile,user_friends”。

此外,我通过创建一个全局HTTP元素作为回调来解决部分问题。回调HTTP路径必须是“/ *”。然后在OAuth选项卡下的Authorization FB组件中,我将回调HTTP名称作为HTTP Connector Reference。

<facebook:oauth-callback-config domain="localhost"
        localPort="5000" remotePort="5000" connector-ref="callback"></facebook:oauth-callback-config>
</facebook:config-with-oauth>
<http:listener-config name="callback" host="0.0.0.0"
    port="5000" basePath="/*" doc:name="HTTP Listener Configuration" />