出站网关正在返回垃圾回复

时间:2015-09-01 13:12:09

标签: spring-integration

我们正在项目中使用spring集成。我已配置<int-jdbc:stored-proc-outbound-gateway><int-http:outbound-gateway>,如下所示:

<int:chain  input-channel="PQIssueHistory-AWD10SP7_1-Or-higher-Channel"  output-channel="PQIssueHistory-AWD-Rest-Channel" >

        <int:service-activator ref="msgHandler" method="buildRequestBasedDataSource" />
        <int-jdbc:stored-proc-outbound-gateway
                        auto-startup="true"
                        data-source="routingDataSource"
                        stored-procedure-name="ZSPPQHISTORYLOOKUP "
                        skip-undeclared-results="true"
                        ignore-column-meta-data="true"  
                        use-payload-as-parameter-source = "false"
                        expect-single-result="true">

                                <int-jdbc:sql-parameter-definition name="P_CRDATTIM" direction="IN" type="VARCHAR" />
                                <int-jdbc:sql-parameter-definition name="P_RECORDCD" direction="IN" type="VARCHAR" />
                                 <int-jdbc:sql-parameter-definition name="P_CRNODE" direction="IN" type="VARCHAR" />

                                <int-jdbc:parameter name="P_CRDATTIM" expression="#xpath(payload, '//DST/AWD/storedProcedure/parameter[1]/value')" />
                                <int-jdbc:parameter name="P_RECORDCD"  expression="#xpath(payload,'//DST/AWD/storedProcedure/parameter[2]/value')" />
                                 <int-jdbc:parameter name="P_CRNODE"  expression="#xpath(payload,'//DST/AWD/storedProcedure/parameter[3]/value')" />

        <int-jdbc:returning-resultset name="rowMapper" row-mapper="com.dsths.cs.awd.utils.ResultSetRowMapper"/>

        </int-jdbc:stored-proc-outbound-gateway>
        <int:service-activator ref="msgHandler" method="buildMessageFromExtSysResponse" />

        <int:header-enricher default-overwrite="true"  should-skip-nulls="true"  >
            <int:header name="${headerNames.originalPayload}" expression="payload" />   
        </int:header-enricher>  

    </int:chain>    

 <int:channel id="PQIssueHistory-AWD-Rest-Channel" />
    <int:chain input-channel="PQIssueHistory-AWD-Rest-Channel"  >

        <int-xml:xslt-transformer xsl-resource="${stylesheet.PQIssueComments-REST}"  />
        <int:service-activator  ref="httpOutboundGatewayHandler" method="buildHttpOutboundGatewayRequest" />

        <int-http:outbound-gateway  url-expression="headers.restResourceUrl"
                                    http-method-expression="headers.httpMethod"
                                    expected-response-type="java.lang.String" >
        </int-http:outbound-gateway>
        <int:service-activator ref="msgHandler" method="enrichPayloadXml" />
        <int-xml:xslt-transformer xsl-resource="${stylesheet.PQIssueHistory-Format-Stage-One}" />
        <int-xml:xslt-transformer xsl-resource="${stylesheet.PQIssueHistory-Format-Stage-Two}" />

    </int:chain>

目标是首先点击存储过程,然后点击其余服务。我能够点击存储过程并获得响应。但是,我在遇到其他服务方面遇到了问题。我得到一些奇怪的加密响应。实际上,当我尝试使用REST客户端甚至是JUNIT测试用例时,相同的休息服务正在返回正确的响应。奇怪的是,当我与GUI集成时,其余服务正在返回一些垃圾数据。

以下是日志文件的摘录:

2015-09-01 18:16:52,367 DEBUG http-0.0.0.0-8080-7 [org.springframework.web.client.RestTemplate] Created GET request for "http://10.193.244.251/awdServer/awd/services/v1/instances/2015-08-31-03.17.22.055080T01/history/comments"
2015-09-01 18:16:52,368 DEBUG http-0.0.0.0-8080-7 [org.springframework.web.client.RestTemplate] Setting request Accept header to [text/plain, application/json, application/*+json, */*]
2015-09-01 18:16:53,098 DEBUG http-0.0.0.0-8080-7 [org.springframework.web.client.RestTemplate] GET request for "http://10.193.244.251/awdServer/awd/services/v1/instances/2015-08-31-03.17.22.055080T01/history/comments" resulted in 200 (OK)
2015-09-01 18:16:53,099 DEBUG http-0.0.0.0-8080-7 [org.springframework.web.client.RestTemplate] Reading [java.lang.String] as "application/vnd.dsttechnologies.awd+xml" using [org.springframework.http.converter.StringHttpMessageConverter@2dd2f7a]

.............................................


2015-09-01 18:16:53,101 DEBUG http-0.0.0.0-8080-7 [org.springframework.integration.http.support.DefaultHttpHeaderMapper] setting headerName=[Content-Language], value=[en-US]
2015-09-01 18:16:53,102 DEBUG http-0.0.0.0-8080-7 [org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler] handler 'org.springframework.integration.handler.MessageHandlerChain#407$child#2.handler' sending reply Message: [Payload=?       ?ڸ?nX;!!?T?ٿQ??^:⨶P?ԫݿd?܇П'?x:gl3¡4˪Ԭf襣ee?Gp\([ؐxGpx䧁׻v˘Ⱈj罨mc+۱࿿ˤAӎ?gzYͿ8ٌC쎹?ŬŨ,EFqiLu̦4쀎2)ꀋ(U\N Ҹ?ӻNA~?휕?Ϯۼ?Зo{l!ֿƑ씐}?Ԧ?޻ΉA~蜎Hmr܎Ө?ʞHӘJޯνիq:?-=䑏ʧt
v
?ֺ:ȥQѳDx\:礩8?ʹϕƎA׿?l;(gʹ?֥}ӣ皃ӷыKVʄ꣔?eH㥖ՠ)ʛ'0@?¿dzߟ8_oMד욐?<ؾ?Άjꥧ܄{Zt.LӻH~"
夡?Ĩȿ?OO2Ee?Oăt??˄ۿ?F׭e?o?Ŝk?؝?=:?=˿z??ϸ_mů뱛_DϜYjE䑿;?J??4勎bɿH?Ш;ϖ?࠿
Ms㯺ࠡlΘӜʌcΊ?B4#4Ȉ?h?di??b?|?쭾4Y=쿼ࠕ0Ȳ:TbߞƪHD^)%d}Ͳ
Y蟧ܜ࠴E/ǷᤵƷݧeԯĘT?'1-JYёɳͿ?!+ޅH7׷_?³غ?ڿ?[ɭƿ>i?࠵͵mѽثߦ㏂ᵣ~ڐm?  ][Headers={content-type=text/xml;charset=UTF-8, errorChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@b18e904, http_requestMethod=POST, jobDesignerJobName=PQIssueHistory, Content-Length=827, sequenceSize=1, accept=*/*, restResourceUrl=http://10.193.244.251/awdServer/awd/services/v1/instances/2015-08-31-03.17.22.055080T01/history/comments, Set-Cookie=JSESSIONID=0000mu3kOUPs_yoyP25muhiCPrl:-1; Path=/, Connection=Keep-Alive, sequenceNumber=1, Cache-Control=no-cache, no-transform, timestamp=1441111613102, id=29c8dff5-6ecf-d3aa-1db7-22abfb887376, cache-control=no-cache, Authorization=Basic RFQ3NzIxNDpQYXNzd2RAMQ==, businessArea=, Date=1441111612000, http_statusCode=200, sequenceDetails=[[b8205f72-33d8-d5ce-d804-b61cb354ea4a, 1, 1]], accept-encoding=gzip, deflate, Accept=application/vnd.dsttechnologies.awd+xml, connection=Keep-Alive, Content-Language=en-US, correlationId=87e97dfa-bcfd-2959-f4be-c04fbb7577f1, replyChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@b18e904, host=hddt0214:8080, accept-language=en-us, httpMethod=GET, Expires=786297600000, user-agent=Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E), http_requestUrl=http://hddt0214:8080/pqawdTestWebApp/rest/jobdesigner?src=PQIssueHistory, Server=IBM_HTTP_Server, Vary=Accept-Encoding, content-length=832, Content-Encoding=gzip, referer=http://hddt0214:8080/pqawdTestWebApp/pqawd/test/contactMainScreen.htm?9220401181721231211, originalPayload=<?xml version="1.0" encoding="UTF-8"?>

.......................................

2015-09-01 18:15:19,851 DEBUG http-0.0.0.0-8080-7 [org.springframework.integration.channel.DirectChannel] preSend on channel 'PQIssueHistory-AWD-Rest-Channel', message: [Payload=<?xml version="1.0" encoding="UTF-8"?>
    <response><PQIssueHistory><hostAddress>10.193.244.251</hostAddress><hostPort>12955</hostPort><userID>DT77214</userID><password>Cnffjq@1</password><AWD10SP7_1orhigher>Y</AWD10SP7_1orhigher><METHOD>GET</METHOD><issue><CRDATTIM>2015-08-31-03.17.22.055080</CRDATTIM><RECORDCD>T</RECORDCD><CRNODE>01</CRNODE><ORIGUSERID>DT77214</ORIGUSERID></issue></PQIssueHistory><results><row><RECTYP>HISTORY</RECTYP><DATTIM>2015-08-31-03.17.22.055000</DATTIM><USERID>DT77214</USERID><STATCD>TOVBR</STATCD><QUEUE>SYSTEM</QUEUE><PRIORITY>999</PRIORITY></row><row><RECTYP>HISTORY</RECTYP><DATTIM>2015-08-31-03.17.22.430080</DATTIM><USERID>SYSTEM</USERID><STATCD>TOVBR</STATCD><QUEUE>SYSTEM</QUEUE><PRIORITY>999</PRIORITY></row><row><RECTYP>HISTORY</RECTYP><DATTIM>2015-08-31-03.17.22.555080</DATTIM><USERID>SYSTEM</USERID><STATCD>CATCHALL</STATCD><QUEUE>CATCHALL</QUEUE><PRIORITY>999</PRIORITY></row></results></response>][Headers={errorChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@b18e904, content-type=text/xml;charset=UTF-8, http_requestMethod=POST, connection=Keep-Alive, correlationId=87e97dfa-bcfd-2959-f4be-c04fbb7577f1, replyChannel=org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel@b18e904, host=hddt0214:8080, accept-language=en-us, jobDesignerJobName=PQIssueHistory, sequenceSize=1, accept=*/*, user-agent=Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E), http_requestUrl=http://hddt0214:8080/pqawdTestWebApp/rest/jobdesigner?src=PQIssueHistory, sequenceNumber=1, timestamp=1441111519851, id=6a05ebc4-2e72-7823-a23e-97d2d33a2cec, cache-control=no-cache, businessArea=, content-length=832, sequenceDetails=[[b8205f72-33d8-d5ce-d804-b61cb354ea4a, 1, 1]], accept-encoding=gzip, deflate, referer=http://hddt0214:8080/pqawdTestWebApp/pqawd/test/contactMainScreen.htm?9220401181721231211, originalPayload=<?xml version="1.0" encoding="UTF-8"?>
    <response><PQIssueHistory><hostAddress>10.193.244.251</hostAddress><hostPort>12955</hostPort><userID>DT77214</userID><password>Cnffjq@1</password><AWD10SP7_1orhigher>Y</AWD10SP7_1orhigher><METHOD>GET</METHOD><issue><CRDATTIM>2015-08-31-03.17.22.055080</CRDATTIM><RECORDCD>T</RECORDCD><CRNODE>01</CRNODE><ORIGUSERID>DT77214</ORIGUSERID></issue></PQIssueHistory><results><row><RECTYP>HISTORY</RECTYP><DATTIM>2015-08-31-03.17.22.055000</DATTIM><USERID>DT77214</USERID><STATCD>TOVBR</STATCD><QUEUE>SYSTEM</QUEUE><PRIORITY>999</PRIORITY></row><row><RECTYP>HISTORY</RECTYP><DATTIM>2015-08-31-03.17.22.430080</DATTIM><USERID>SYSTEM</USERID><STATCD>TOVBR</STATCD><QUEUE>SYSTEM</QUEUE><PRIORITY>999</PRIORITY></row><row><RECTYP>HISTORY</RECTYP><DATTIM>2015-08-31-03.17.22.555080</DATTIM><USERID>SYSTEM</USERID><STATCD>CATCHALL</STATCD><QUEUE>CATCHALL</QUEUE><PRIORITY>999</PRIORITY></row></results></response>}]

有人可以告诉我这里出了什么问题吗?

1 个答案:

答案 0 :(得分:0)

  

@ Gary Russell的建议在识别和解决问题方面确实很有效。

垃圾回应的罪魁祸首是另一个标题&#34; accept-encoding:gzip,deflate&#34;被IE浏览器添加。 Spring Integration框架提供了<header-filter/>,可以用来摆脱不需要的标题。

<int:header-filter input-channel="unnecessary-headers-removal-channel"
        output-channel="PQIssueHistory-AWD-Rest-Channel" header-names="accept-encoding"/>