我在1.10.0和2.0.0上试过这个
在1.10.0上,您可以在repository / conf / axis2 / axis2_blocking_client.xml中禁用JMS发送方,并在阻塞模式下使用调用介体。这篇博客文章中描述了这一点:http://shenavid.blogspot.nl/2016/08/invoking-external-endpoints-using-call.html并且正常。但是,即使相关问题已标记为已解决,此方法也无法在2.0.0中运行。
有没有其他人在2.0.0上测试过这个?或者找到了其他解决方法?
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="opal_auth_and_send"
onError="gov:apimgt/customsequences/fault/json_fault.xml"
trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<property description="ORG_PAYLOAD" expression="$body/child::node()"
name="ORG_PAYLOAD" scope="default" type="STRING"/>
<property description="URL_POSTFIX"
expression="get-property('axis2', 'REST_URL_POSTFIX')"
name="URL_POSTFIX" scope="default" type="STRING"/>
<property action="remove" description="Remove REST_URL_POSTFIX"
name="REST_URL_POSTFIX" scope="axis2"/>
<property action="remove" description="Remove transport headers"
name="TRANSPORT_HEADERS" scope="axis2"/>
<header name="Authorization" scope="transport" value="Basic xxxxxxxx"/>
<property description="set messageType" name="messageType"
scope="transport" type="STRING" value="application/json"/>
<call blocking="true" description="Get Auth token (blocking)">
<endpoint>
<http method="get" trace="enable" uri-template="https://opal-demo34.ortec-finance.com/auth/api/token"/>
</endpoint>
</call>
<property description="Get Token from Response"
expression="json-eval($.token)" name="TOKEN" scope="default" type="STRING"/>
<property action="remove" description="Remove transport headers"
name="TRANSPORT_HEADERS" scope="axis2"/>
<log description="Log auth result" level="full"/>
<property description="Restore REST_URL_POSTFIX"
expression="get-property('URL_POSTFIX')" name="REST_URL_POSTFIX"
scope="axis2" type="STRING"/>
<payloadFactory description="Restore Payload" media-type="json">
<format>$1</format>
<args>
<arg evaluator="xml" expression="get-property('ORG_PAYLOAD')"/>
</args>
</payloadFactory>
<header expression="get-property('TOKEN')" name="Authorization" scope="transport"/>
</sequence>
谢谢,
丹尼