代码之家  ›  专栏  ›  技术社区  ›  Kris Swat

如何在spring集成中获得响应体

  •  1
  • Kris Swat  · 技术社区  · 7 年前

    我正在使用基于XML的配置-HTTP出站网关trii=gger一个rest服务,响应是responseEntity,我不知道服务的详细信息。我收到的输出应该放在jms队列中。

    如何更新以下内容以仅提取响应实体的主体并传递到输出通道?如果有变压器,请举例说明。可以使用配置吗?

    <int:chain input-channel="gsInChannel" output-channel="dest-channel">
    <int-http:outbound-gateway          
                   url="https://ia-zatie.str13.tst.belst.nu/ia-zaatie/rest/signal/v2"
                   http-method="POST"  
                   header-mapper="headerMapper"
                   request-factory="sslFactory"                
                   >
    </int-http:outbound-gateway>
        </int:chain>
    

    dest channel is jms:出站通道适配器

    引导版本1.4.3和集成版本4.3.6

    错误:org.springframework.messaging.MessagehandlingException:错误 在消息处理程序中发生 [org.springframework.integration.jms.jmsSendingMessageHandler_0]; 嵌套异常是 org.springframework.jms.support.converter.MessageConversionException:。 无法转换类型为的对象 [org.springframework.http.responseEntity]到jms消息。支持 消息有效负载是:字符串、字节数组、映射、可序列化 反对。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Kris Swat    7 年前

    我使用的是http post方法,所以不希望出现响应。soo没有包含预期的响应类型,该响应类型返回正文

    <int-http:outbound-gateway          
                   url="https://ia-zatie.str13.tst.belst.nu/ia-zaatie/rest/signal/v2"
                   http-method="POST"  
                   header-mapper="headerMapper"
                   request-factory="sslFactory"  
    
                   expected-response-type="java.lang.String">