我正在为我的公司开发 WSO2 ESB POC,其中涉及通过 ESB 上的 SOAP 端点公开内部 RESTful 服务。我已阅读与 SOAP-REST 中介相关的所有主题和博客文章,但仍然找不到答案。我的 RESTful 服务返回“application/rdf+xml”消息格式。这是我的顺序:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="CQProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<send>
<endpoint>
<address uri="http://<MYURL>/cqweb/oslc/repo/eraprototype/db/CQT_T/simpleQuery/16783484?oslc.select=dcterms:title,cq:CM_Label,dcterms:type,cq:Assigned_To,oslc_cm:status,cq:AutoDeployment,cq:SentToEADS_By&oslc.where=oslc:shortTitle=CQT_T00000131" format="get"/>
<property xmlns:ns="http://org.apache.synapse/xsd" name="Authorization" expression="fn:concat('Basic ', base64Encode('user:password'))" scope="transport"/>
<property name="OSLC-Core-Version" value="2.0" scope="transport"/>
<property name="Accept" value="application/rdf+xml" scope="transport"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full"/>
<send/>
</outSequence>
</target>
<publishWSDL key="gov:/services/cqproxy/CQProxy.wsdl">
<resource location="CQProxy.xsd" key="gov:/services/cqproxy/CQProxy.xsd"/>
<resource location="eads_ws.xsd" key="gov:/services/eads_ws/eads_ws.xsd"/>
</publishWSDL>
<description></description>
</proxy>
我能够成功地将请求发送到 RESTful 服务。但是我的 OUT 序列无法处理“application/rdf+xml”响应。日志显示以下错误:
INFO {org.apache.axis2.builder.BuilderUtil} - OMException in getSOAPBuilder {org.apache.axis2.builder.BuilderUtil}
org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found RDF
两个问题:
1. 如何在 Axis2 对其应用 SOAP 转换之前记录从 REST 服务接收到的实际响应?我的日志中介只生成空的 SOAP 信封。
INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:4c06fcb9-4e45-4fb3-bc5a-4350e3d86533, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
2. 如何从 RDF+XML 转换回 SOAP 格式?我应该为此在 OUT 序列中使用 XSLT 中介吗?
感谢你的帮助!