Xml &;它显示在'<';-WSO2代理服务

Xml &;它显示在'<';-WSO2代理服务,xml,web-services,soap,wso2,wso2esb,Xml,Web Services,Soap,Wso2,Wso2esb,我有一个Web服务,它返回XML字符串,而XML字符串又被调出中介捕获,并被发送到JMS队列。但是当我看到队列中的内容时,'您是否可以确保正确设置了contentType?它应该是“application/xml” 内容类型 应用程序/xml 请参阅下面的示例配置 <definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy" transports="jms"&g

我有一个Web服务,它返回XML字符串,而XML字符串又被调出中介捕获,并被发送到JMS队列。但是当我看到队列中的内容时,'您是否可以确保正确设置了contentType?它应该是“application/xml”


内容类型
应用程序/xml
请参阅下面的示例配置

<definitions xmlns="http://ws.apache.org/ns/synapse">
    <proxy name="StockQuoteProxy" transports="jms">
        <target>
            <endpoint>
        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
            <outSequence>
                <property action="set" name="OUT_ONLY" value="true"/>
        <send/>
            </outSequence>
        </target>
        <publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
        <parameter name="transport.jms.ContentType">
            <rules>
                <jmsProperty>contentType</jmsProperty>
                <default>application/xml</default>
            </rules>
        </parameter>
    </proxy>
</definitions>

谢谢,,
Dharshana.

如果您在从ESB发送的JMS队列中发现上述格式错误的XML消息,我认为不会发生这种情况。因为无法处理格式错误的xml消息。 我想问题出在您的队列浏览器中?
它将xml标记转换为

您是否尝试通过SOAPUI调用外部服务,并查看它是否正确返回响应。进一步在日志级别为full的callout mediator之后添加一个日志中介器,并查看构造的消息是否如图所示是XML转义的。这将有助于隔离问题。如果可能,也粘贴您的配置。

这是我的ESB代理配置:这是我的代理配置:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="ESBTESTProxy" transports="https,http,jms" statistics="enable" trace="enable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="ContentType" value="text/plain"/>
         <class name="com.guru.test.HEALTH_Mediator"/>
         <callout serviceURL="http://localhost:8080/PrescriptionValidation/validate" action="urn:validatePrescription">
            <source xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
            <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
         </callout>
         <property name="RESPONSE" value="true"/>
         <header name="To" action="remove"/>
         <send>
            <endpoint>
               <address uri="jms:/OutputQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <drop/>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:8080/PrescriptionValidation/validate?wsdl"/>
   <parameter name="transport.jms.ContentType">
      <rules>         
         <jmsProperty>contentType</jmsProperty>         
         <default>application/xml</default>      
      </rules>
   </parameter>
   <description></description>
</proxy>

内容类型
应用程序/xml
让我知道你的想法

-古鲁
@gnanagurus

看起来好像有什么东西把一个字符串作为一个文本节点,它正确地被XML转义了。正确构建XML—如果它来自字符串,则需要[重新]转换为正确的XML(DOM?节点?),或者绕过(正确的)XML发射器。您好,Dharshana,我验证了我的代理服务。但是内容类型是按照您提到的那样编写的。还有别的主意吗GuruCould您是否尝试从队列中检索数据并签出。您可以使用随附的文章来实现这一点。只需将日志级别设置为“已满”,即可向队列发送和检索点。这将孤立问题。我主要怀疑问题出在activemq队列监视器上。即使在这里,我也面临同样的问题。我觉得这不是因为浏览器。请在调出中介之后删除contenttype text/plain属性。您为文本消息设置了该值(希望您的服务是必需的),调用callout后设置了正确的内容类型/Hello Ratha,我尝试将contentType设置为“application/xml”。它不起作用。让我知道你的想法,如果我能找到解决办法,我会回来的大师
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <proxy name="StockQuoteProxy" transports="jms">
        <target>
            <endpoint>
        <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
            <outSequence>
                <property action="set" name="OUT_ONLY" value="true"/>
        <send/>
            </outSequence>
        </target>
        <publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
        <parameter name="transport.jms.ContentType">
            <rules>
                <jmsProperty>contentType</jmsProperty>
                <default>application/xml</default>
            </rules>
        </parameter>
    </proxy>
</definitions>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ESBTESTProxy" transports="https,http,jms" statistics="enable" trace="enable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="ContentType" value="text/plain"/>
         <class name="com.guru.test.HEALTH_Mediator"/>
         <callout serviceURL="http://localhost:8080/PrescriptionValidation/validate" action="urn:validatePrescription">
            <source xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
            <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
         </callout>
         <property name="RESPONSE" value="true"/>
         <header name="To" action="remove"/>
         <send>
            <endpoint>
               <address uri="jms:/OutputQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <drop/>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:8080/PrescriptionValidation/validate?wsdl"/>
   <parameter name="transport.jms.ContentType">
      <rules>         
         <jmsProperty>contentType</jmsProperty>         
         <default>application/xml</default>      
      </rules>
   </parameter>
   <description></description>
</proxy>