使用WSO2 Micro Integrator对接Dynamics 365创建实体时自动令牌生成遇401错误
问题:WSO2 Micro Integrator自动获取Dynamics 365令牌报401未授权错误
我在使用WSO2 Micro Integrator结合Dynamics Connector操作CRM Dynamics 365(v9.2实例)创建实体时,手动配置<accessToken>******</accessToken>功能正常,但因为令牌存在有效期,我尝试了如下自动生成令牌的配置,却出现401未授权错误:
<resource methods="POST" uri-template="/create"> <inSequence> <log /> <property name="client_id" scope="default" type="STRING" value="***********" /> <property name="client_secret" scope="default" type="STRING" value="***********" /> <property name="grant_type" scope="default" type="STRING" value="client_credentials" /> <property name="resource" scope="default" type="STRING" value="https://***********.com" /> <payloadFactory media-type="xml"> <format> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > <soapenv:Body> <root> <client_id>$1</client_id> <client_secret>$2</client_secret> <grant_type>$3</grant_type> <resource>$4</resource> </root> </soapenv:Body> </soapenv:Envelope> </format> <args> <arg evaluator="xml" expression="$ctx:client_id" /> <arg evaluator="xml" expression="$ctx:client_secret" /> <arg evaluator="xml" expression="$ctx:grant_type" /> <arg evaluator="xml" expression="$ctx:resource" /> </args> </payloadFactory> <property name="messageType" scope="axis2" type="STRING" value="application/x-www-form-urlencoded" /> <property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true" /> <call> <endpoint> <http method="post" uri-template="https://login.microsoftonline.com/304d868c-e271-4a91-8965-f24dedd79ccf/oauth2/token" > <suspendOnFailure> <initialDuration>-1</initialDuration> <progressionFactor>-1</progressionFactor> <maximumDuration>0</maximumDuration> </suspendOnFailure> <markForSuspension> <retriesBeforeSuspension>0</retriesBeforeSuspension> </markForSuspension> </http> </endpoint> </call> <propertyGroup> <property expression="json-eval($.access_token)" name="token" scope="default" type="STRING" /> </propertyGroup> <log> <property expression="get-property('token')" name="tt" /> </log> <msdynamics365.init> <accessToken>{get-property('token')}</accessToken> <apiUrl>https://***********.com</apiUrl> <apiVersion>v9.2</apiVersion> <refreshToken>0.AR8ATWbW27lO60aZ2FxDuhU8Yas</refreshToken> <clientSecret>***********</clientSecret> <clientId>***********</clientId> <resource>https://***********.com/</resource> </msdynamics365.init> <msdynamics365.createEntity> <entityType>ext_APICreateOffre</entityType> <bodyContent>{json-eval($)}</bodyContent> <queryParam >name,refOffre,typeOffre,commitment,promotionBeginDate,promotionEndDate,promotionalOffer,products</queryParam > </msdynamics365.createEntity> <respond /> </inSequence> <outSequence /> <faultSequence /> </resource>
更新:
内容的提问来源于stack exchange,提问作者Oussama Nairi
相关产品推荐
相关产品推荐

