好吧,所以我对mulesoft这件事很陌生。我目前正在做的是,我得到了一个mulesoft流,它首先授权我进入Linkedin,然后获得我的基本个人资料细节。我想要做的是在我的反应模型中显示这些信息,如何将我的mulesoft流的json结果显示到我的React应用程序中并显示出来呢?
这是我的mulesoft流
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:oauth2="http://www.mulesoft.org/schema/mule/oauth2" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:linkedin="http://www.mulesoft.org/schema/mule/linkedin" xmlns:barn1="http://www.mulesoft.org/schema/mule/barn1" xmlns:barn="http://www.mulesoft.org/schema/mule/barn" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
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/linkedin http://www.mulesoft.org/schema/mule/linkedin/current/mule-linkedin.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/oauth2 http://www.mulesoft.org/schema/mule/oauth2/current/mule-oauth2.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/current/mule-tcp.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="3000" doc:name="HTTP Listener Configuration" connectionIdleTimeout="3000000"/>
<http:request-config name="AcceptHTTP_Request_Configuration" host="api.linkedin.com/v1/people/~?" port="403" doc:name="HTTP Request Configuration" connectionIdleTimeout="300000000" protocol="HTTPS">
<oauth2:authorization-code-grant-type clientId="77ii50ttcezoti" clientSecret="aifsEkcXEiMsayru" redirectionUrl="http://localhost:3000/callback">
<oauth2:authorization-request authorizationUrl="https://www.linkedin.com/oauth/v2/authorization?response_type=code&state=987654321" localAuthorizationUrl="http://localhost:3000/authorize"/>
<oauth2:token-request tokenUrl="http://linkedin.com/oauth/v2/accessToken" >
<oauth2:token-response >
<oauth2:custom-parameter-extractor paramName="token_1" value="#[json:token_type]"/>
</oauth2:token-response>
</oauth2:token-request>
</oauth2:authorization-code-grant-type>
</http:request-config>
<http:request-config name="HTTP_Request_Configuration" host="api.linkedin.com" port="8081" doc:name="HTTP Request Configuration"/>
<oauth2:token-manager-config name="Token_Manager_Config" doc:name="Token Manager Config"/>
<flow name="testingFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/linkedin" doc:name="authorize" allowedMethods="GET"/>
<http:request config-ref="AcceptHTTP_Request_Configuration" path="/" method="GET" doc:name="getaccesstoken"/>
<json:xml-to-json-transformer doc:name="XML to JSON"/>
</flow>
</mule>发布于 2017-10-26 15:59:01
根据我的理解,你已经得到了linkedin的个人资料。现在,在mule中,信息将可用为有效负载,您可以通过#有效负载访问它,并且可以作为响应访问它。要在任何前沿技术(反应、角度、主干)中访问这一点,只需调用相应的骡子流即可。
在你的例子中: localhost:3000/linkedin (打电话给GET)
发布于 2019-01-20 22:45:41
您需要将配置文件信息作为有效负载返回Mule API,然后需要使用postman测试您的API。
如果每个想法都运行良好,您将需要创建与您的前端技术(反应,角度,VueJs.)相同的请求。
https://stackoverflow.com/questions/46665689
复制相似问题