【问题标题】:Error while consuming REST service over HTTPs通过 HTTPs 使用 REST 服务时出错
【发布时间】:2017-02-20 19:39:54
【问题描述】:

我有一个简单的 REST HTTPS POST,它的 uri 是这样的:https://paymentservicestest.informa.com/mcas_services.asp?

非常适合在浏览器、邮递员等中运行。使用 Mule 3.8 HTTP,我从 RAML 生成规范中选择 uri,设置 uri-param,但我仍然收到异常和下面的代码。

 ERROR 2016-10-11 16:16:52,944 [[tstconnection].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.request.DefaultHttpRequester: Remote host closed connection. Possible SSL/TLS handshake issue. Check protocols, cipher suites and certificate set up. Use -Djavax.net.debug=handshake for further debugging.
 ERROR 2016-10-11 16:16:53,025 [[tstconnection].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy: 
 ********************************************************************************
 Message               : Error sending HTTP request.
 Payload               : {NullPayload}
 Payload Type          : org.mule.transport.NullPayload
 Element               : /tstconnectionFlow/processors/1 @ tstconnection:tstconnection.xml:14 (HTTP)
 Element XML           : <http:request config-ref="HTTP_Request_Configuration" path="/mcas_services.asp" method="POST" doc:name="HTTP">
                         <http:request-builder>
                         <http:query-param paramName="username" value="XXXXX"></http:query-param>
                         <http:query-param paramName="password" value="XXXXX"></http:query-param>
                         <http:query-param paramName="method" value="XXXXX"></http:query-param>
                         <http:query-param paramName="source" value="XXXXX"></http:query-param>
                         <http:query-param paramName="cardtype" value="XXXXX"></http:query-param>
                         <http:query-param paramName="currency" value="XXXXX"></http:query-param>
                         </http:request-builder>
                         </http:request>
 --------------------------------------------------------------------------------
 Root Exception stack trace:
 java.io.IOException: Remotely closed
My sample Code is :

 <?xml version="1.0" encoding="UTF-8"?>
 
 <mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
     xmlns:spring="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
 http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
 http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
     <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="2020" doc:name="HTTP Listener Configuration"/>
     <http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="paymentservice.informa.com" port="443" connectionIdleTimeout="300000" responseTimeout="300000" doc:name="HTTP Request Configuration" />
     <flow name="tstconnectionFlow">
         <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
         <logger message="sampleTest" level="INFO" doc:name="Logger"/>
     <http:request config-ref="HTTP_Request_Configuration" path="/mcas_services.asp" method="GET" doc:name="HTTP">
            <!--  <http:request-builder>
                 <http:query-param paramName="qParams1" value="#[flowVars.qParams]"/>
             </http:request-builder> -->
                <http:request-builder>
                 <http:query-param paramName="username" value="XXXXXX"/>
                 <http:query-param paramName="password" value="XXXXXX"/>
                 <http:query-param paramName="method" value="XXXXXXX"/>
                 <http:query-param paramName="source" value="XXXXX"/>
                 <http:query-param paramName="cardtype" value="XXXX"/>
                 <http:query-param paramName="currency" value="XXX"/>
 
             </http:request-builder> 
         </http:request>
         <logger level="INFO" doc:name="blankResponse"/>
         <logger message="Reponse: #[payload]" level="INFO" doc:name="Logger"/>
     </flow>
 </mule>

【问题讨论】:

    标签: rest http https mule connector


    【解决方案1】:

    您的 URI 中似乎有错字

    我可以从您的帖子中看到实际的 URI 应该是:

    https://paymentservices.informa.com/

    在您的配置中,您正在调用以下 URI:

    https://paymentservice.informa.com/

    确保在“服务”中包含“s”,这至少应该向正确的服务器发出成功的请求。

    将您的 HTTP_Request_Configuration 更改为:

    <?xml version="1.0" encoding="UTF-8"?>
     
     <mule
    ...
    
    <http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="paymentservices.informa.com" port="443" connectionIdleTimeout="300000" responseTimeout="300000" doc:name="HTTP Request Configuration" />
    ...
    
     </mule>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-12
      • 1970-01-01
      • 1970-01-01
      • 2012-04-30
      • 1970-01-01
      相关资源
      最近更新 更多