0

我正在学习 wso2 ESB 4.6.0。我现在正在研究中介。我实现了缓存调解器,如下所示。

<proxy xmlns="http://ws.apache.org/ns/synapse" name="cacheProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <cache id="myCache" scope="per-mediator" collector="false" hashGenerator="org.wso2.caching.digest.DOMHASHGenerator" timeout="3" maxMessageSize="1000">
            <implementation type="memory" maxSize="1000"/>
         </cache>
         <send>
            <endpoint>
               <address uri="http://localhost:44444/ws/MediatorsWS"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <cache id="myCache" scope="per-mediator" collector="true"/>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:44444/ws/MediatorsWS"/>
      </endpoint>
   </target>
   <publishWSDL uri="http://localhost:44444/ws/MediatorsWS?wsdl"/>
   <description></description>
</proxy>

它重定向到使用接收 SOAP 1.1 的 JAX-WS 实现的 web 服务。这是wsdl:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://clone.ws.wso2lessons/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://clone.ws.wso2lessons/">
<wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xsd:import namespace="http://clone.ws.wso2lessons/" schemaLocation="cacheProxy?xsd=http://localhost:44444/ws/MediatorsWS?xsd=1.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="receiveMessage">
<wsdl:part name="parameters" element="tns:receiveMessage"/>
</wsdl:message>
<wsdl:message name="receiveMessageResponse">
<wsdl:part name="parameters" element="tns:receiveMessageResponse"/>
</wsdl:message>
<wsdl:message name="replyMessage">
<wsdl:part name="parameters" element="tns:replyMessage"/>
</wsdl:message>
<wsdl:message name="replyMessageResponse">
<wsdl:part name="parameters" element="tns:replyMessageResponse"/>
</wsdl:message>
<wsdl:portType name="cacheProxyPortType">
<wsdl:operation name="receiveMessage">
<wsdl:input message="tns:receiveMessage" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/receiveMessageRequest"/>
<wsdl:output message="tns:receiveMessageResponse" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/receiveMessageResponse"/>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<wsdl:input message="tns:replyMessage" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/replyMessageRequest"/>
<wsdl:output message="tns:replyMessageResponse" wsaw:Action="http://clone.ws.wso2lessons/MediatorsWS/replyMessageResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="cacheProxySoap11Binding" type="tns:cacheProxyPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="receiveMessage">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="cacheProxySoap12Binding" type="tns:cacheProxyPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="receiveMessage">
<soap12:operation soapAction="" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<soap12:operation soapAction="" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="cacheProxyHttpBinding" type="tns:cacheProxyPortType">
<http:binding verb="POST"/>
<wsdl:operation name="receiveMessage">
<http:operation location="receiveMessage"/>
<wsdl:input>
<mime:content type="text/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replyMessage">
<http:operation location="replyMessage"/>
<wsdl:input>
<mime:content type="text/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="cacheProxy">
<wsdl:port name="cacheProxyHttpSoap11Endpoint" binding="tns:cacheProxySoap11Binding">
<soap:address location="http://PCPPTCERTDEV01:8280/services/cacheProxy.cacheProxyHttpSoap11Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpsSoap11Endpoint" binding="tns:cacheProxySoap11Binding">
<soap:address location="https://PCPPTCERTDEV01:8243/services/cacheProxy.cacheProxyHttpsSoap11Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpsSoap12Endpoint" binding="tns:cacheProxySoap12Binding">
<soap12:address location="https://PCPPTCERTDEV01:8243/services/cacheProxy.cacheProxyHttpsSoap12Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpSoap12Endpoint" binding="tns:cacheProxySoap12Binding">
<soap12:address location="http://PCPPTCERTDEV01:8280/services/cacheProxy.cacheProxyHttpSoap12Endpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpsEndpoint" binding="tns:cacheProxyHttpBinding">
<http:address location="https://PCPPTCERTDEV01:8243/services/cacheProxy.cacheProxyHttpsEndpoint"/>
</wsdl:port>
<wsdl:port name="cacheProxyHttpEndpoint" binding="tns:cacheProxyHttpBinding">
<http:address location="http://PCPPTCERTDEV01:8280/services/cacheProxy.cacheProxyHttpEndpoint"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

当我向操作replyMessage发送消息时,响应消息被成功缓存(java方法上有一个System.out.println(),在缓存时间范围内不调用)。但是,我收到的返回消息是这样的:

<axis2ns27:binary xmlns:axis2ns27="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxTOkVudmVsb3BlIHhtbG5zOlM9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj48UzpCb2R5PjxuczI6cmVwbHlNZXNzYWdlUmVzcG9uc2UgeG1sbnM6bnMyPSJodHRwOi8vY2xvbmUud3Mud3NvMmxlc3NvbnMvIj48cmV0dXJuPmhlbGxvIHRoZXJlIHJlc3BvbmRpZGEuPC9yZXR1cm4+PC9uczI6cmVwbHlNZXNzYWdlUmVzcG9uc2U+PC9TOkJvZHk+PC9TOkVudmVsb3BlPg==</axis2ns27:binary>

如果我不使用此调解器,则会正确返回消息。我在这里想念什么?

4

1 回答 1

0

我们使用直通传输,它不会构建消息..您可以切换回 NIO 传输并检查吗?

于 2013-04-19T16:31:26.357 回答