2013-04-19 4 views
0

Я узнаю о wso2 ESB 4.6.0. Сейчас я изучаю медиаторы. Я применил кэш-посредник, как показано ниже.ответ посредника кэша wso2 в двоичном формате (он должен быть XML)

<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> 

Он перенаправляет на веб-сервис, реализованный с помощью JAX-WS, получающего SOAP 1.1. Вот 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 ответное сообщение кэшируются успешно (есть System.out.println() на методе Java, который не вызывается в кэше период времени). Тем не менее, возвращаемое сообщение, которое я получаю это:

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

Если я не использую этот посредник, сообщение возвращается правильно. Что мне здесь не хватает?

ответ

0

мы используем транзитный транспорт, он не создает сообщение. Можете ли вы вернуться к транспортировке NIO и проверить?

+0

Извините, я не знаю, что вы подразумеваете под «сквозным транспортом» или «создайте сообщение». Это что-то, что я должен знать, прежде чем узнавать о посредниках? –

+1

Получил это. Я раскоментировал записи для org.apache.synapse.transport.nhttp.HttpCoreNIOListener и org.apache.synapse.transport.nhttp.HttpCoreNIOSender в axis2.xml. Теперь он работает нормально. Спасибо. –