我正在研究WSO2 ESB代理服务,该服务涉及通过ESB上的SOAP端点公开内部RESTful服务.我的RESTful服务需要Content-type ="application/rdf + xml".我尝试使用文档中提到的所有3个属性设置它:messageType,ContentType和CONTENT_TYPE.但是,请求Content-type仍然是"application/xml".
以下是调用REST服务的序列摘录:
<property xmlns:ns="http://org.apache.synapse/xsd" name="REST_URL_POSTFIX" value="/record/12345" scope="axis2" type="STRING"/>
<property name="HTTP_METHOD" value="PUT" scope="axis2" type="STRING"/>
<property name="messageType" value="application/rdf+xml" scope="axis2" type="STRING"/>
<property name="ContentType" value="application/rdf+xml" scope="axis2" type="STRING"/>
<property name="CONTENT_TYPE" value="application/rdf+xml" scope="axis2" type="STRING"/>
<send>
<endpoint name="CQ">
<address uri="http://my_url" format="pox">
</address>
<property xmlns:ns="http://org.apache.synapse/xsd" name="Authorization" expression="fn:concat('Basic ', base64Encode('username:password'))" scope="transport"/>
<property name="OSLC-Core-Version" value="2.0" scope="transport"/>
<property name="Accept" value="application/rdf+xml" scope="transport"/>
</endpoint>
</send>
Run Code Online (Sandbox Code Playgroud)
我用TCPMon测试它,无论我使用什么Content-type属性,request仍然包含"application/xml".
请指教.
我在ESB上部署的代理服务正在调用另一个独立的REST服务.此服务返回HTTP状态200以及响应正文中的一些数据.我的问题是如何从响应中检索HTTP状态.这是我的配置:
<proxy name="CQProxy"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<switch source="get-property('Action')">
<case regex="getTaskTicket">
<sequence key="GetTaskTicket"/>
</case>
<default/>
</switch>
</inSequence>
<outSequence>
<log>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="Status"
expression="get-property('HTTP_SC')"/>
</log>
<send/>
</outSequence>
<faultSequence/>
</target>
<publishWSDL key="gov:/services/cqproxy/CQProxy.wsdl">
<resource location="CQProxy.xsd" key="gov:/services/cqproxy/CQProxy.xsd"/>
</publishWSDL>
</proxy>
<sequence name="GetTaskTicket">
...
<property name="REST_URL_POSTFIX"
value="/16783484?oslc.select=dcterms:title,oslc_cm:status"
scope="axis2"
type="STRING"/>
<property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/>
<send>
<endpoint>
<address uri="http://.../simpleQuery"
format="rest"/>
<property name="OSLC-Core-Version" value="2.0" scope="transport"/>
<property name="Accept" value="application/rdf+xml" scope="transport"/>
</endpoint>
</send>
</sequence>
...
Run Code Online (Sandbox Code Playgroud)
我尝试了以下代码:
<log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="Status" expression="get-property('HTTP_SC')"/>
</log>
Run Code Online (Sandbox Code Playgroud)
还有这个:
<log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="Status" …Run Code Online (Sandbox Code Playgroud) 我的WSO2 ESB代理服务引用位于不同环境中的不同URL的端点 - DEV,TEST,PROD.根据WSO2文档,我需要将端点定义存储在Governance Registry中,并修改每个环境中端点XML文件中的URL.对于拥有1或2个代理的组织而言,这可能会正常工作,但对于10个以上的代理来说,这会成为一个重要的开销.
另一种情况是我需要在ESB序列中读取某些特定于环境的属性.
有没有办法在外部*.properties文件中定义一堆属性,然后在ESB和注册表定义中读取它们?