Spring integration HTTP客户端与spring集成

Spring integration HTTP客户端与spring集成,spring-integration,Spring Integration,我需要编写一个简单的HTTP客户端,使用Spring集成生成简单的GET请求和JSON响应。 调用失败,异常中没有消息:org.springframework.web.client.HttpServerErrorException:500内部服务器错误。 我试着调试Spring代码,并成功地完成了它,直到我有了源代码,即till 在方法AbstractMessageHandler.HandleMessageMessageMessage中 已调用抽象handleMessageInternalMes

我需要编写一个简单的HTTP客户端,使用Spring集成生成简单的GET请求和JSON响应。 调用失败,异常中没有消息:org.springframework.web.client.HttpServerErrorException:500内部服务器错误。 我试着调试Spring代码,并成功地完成了它,直到我有了源代码,即till 在方法AbstractMessageHandler.HandleMessageMessageMessage中 已调用抽象handleMessageInternalMessage消息,该消息引发 例外情况是说,请求 URL={q}&authKey={authKey}&rows={rows}&page={page}&filter={filter} 失败。URL看起来和我引用的一模一样,即表达式没有被执行

消息中的有效负载始终保持其应有的状态-如果输入具有正确的字段值,则为实例

谁能告诉我该怎么办

以下是spring-integration-zt-context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:oxm="http://www.springframework.org/schema/oxm" 
xsi:schemaLocation="http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http-2.1.xsd
    http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-3.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">

<int:channel id="InChannelZt"></int:channel>
<int:channel id="OutChannelZt"></int:channel>

<!-- Gateway Start -->
<int:gateway id="ZtGateway" default-request-timeout="5000" default-reply-timeout="5000" 
default-request-channel="InChannelZt" service-interface="com.example.service.ZtService">
    <int:method name="getResults" request-channel="InChannelZt" reply-channel="OutChannelZt" />
</int:gateway>  

<int-http:outbound-gateway id="locationZtGateway"
                           request-channel="InChannelZt" 
                           reply-channel="OutChannelZt"
                           url="${zt_url}?q={q}&amp;authKey={authKey}&amp;rows={rows}&amp;page={page}&amp;filter={filter}"
                           http-method="GET"
                           reply-timeout='5000'                            
                           expected-response-type="com.example.vo.ZtResponse">
        <int-http:uri-variable name="q" expression="payload.getQ()"/>
       <int-http:uri-variable name="authKey" expression="payload.getAuthKey()"/>
       <int-http:uri-variable name="rows" expression="payload.getRows()"/>
       <int-http:uri-variable name="page" expression="payload.getPage()"/>
       <int-http:uri-variable name="filter" expression="payload.getFilter()"/>
</int-http:outbound-gateway>
有效载荷:

public class ZtInput {

private String q; //=pink
private String authKey = "baef7f8e39c53f852c8a14b7f6018b58";
private String rows="20";
private String page="1";
private String filter = "";


public ZtInputVO() {
}
public String getQ() {
    return q;
}
public void setQ(String q) {
    this.q = q;
}
public String getAuthKey() {
    return authKey;
}
public void setAuthKey(String authKey) {
    this.authKey = authKey;
}
public String getRows() {
    return rows;
}
public void setRows(String rows) {
    this.rows = rows;
}
public String getPage() {
    return page;
}
public void setPage(String page) {
    this.page = page;
}
public String getFilter() {
    return filter;
}
public void setFilter(String filter) {
    this.filter = filter;
}
}

异常中的URI是原始的未扩展URI;展开将执行到不同的变量中。我们应该/将更改它以记录扩展的URI。但底线是您的服务器不喜欢扩展的URI,并返回了500个内部服务器错误

您可以使用eclipse内置的网络/tcp监视器,也可以使用wireshark检查发送到服务器的实际URL。如果启用,还可以查看服务器日志

或者,在调试器中,转到当前源代码版本4.0.4中的第415行并检查realUri


编辑:异常现在包括中当前可用的扩展URI。

非常感谢。我确实被包含未处理URI的异常消息误导了。你把它修好了真是太好了。
public class ZtInput {

private String q; //=pink
private String authKey = "baef7f8e39c53f852c8a14b7f6018b58";
private String rows="20";
private String page="1";
private String filter = "";


public ZtInputVO() {
}
public String getQ() {
    return q;
}
public void setQ(String q) {
    this.q = q;
}
public String getAuthKey() {
    return authKey;
}
public void setAuthKey(String authKey) {
    this.authKey = authKey;
}
public String getRows() {
    return rows;
}
public void setRows(String rows) {
    this.rows = rows;
}
public String getPage() {
    return page;
}
public void setPage(String page) {
    this.page = page;
}
public String getFilter() {
    return filter;
}
public void setFilter(String filter) {
    this.filter = filter;
}
}