获取错误com.intuit.karate-http请求失败:org.apache.http.conn.HttpHostConnectException

时间:2019-12-30 02:01:22

标签: http intellij-idea soap karate

I am trying to run a demo scenario for Soap XML request . Have used the sample calculator web service . I works fine when i trigger the request from Soap UI .But the connection fails on trying to access the request from IntelliJ using Karate .
@SoapTest
    Feature:   
    Background:
    * url 'http://www.dneonline.com'
    * path 'calculator.asmx'
      * configure ssl = true

    Scenario: soap 1.1
        Given url apiURL
    And request
        """
        <?xml version="1.0" encoding="utf-8"?>
        <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
          <soap:Body>
            <Add xmlns="http://tempuri.org/">
              <intA>2</intA>
              <intB>3</intB>
            </Add>
          </soap:Body>
        </soap:Envelope>
        """
        When soap action 'http://tempuri.org/Add'
        Then status 200
        And match /Envelope/Body/AddResponse/AddResult == 5
        And Print response

**下面是正在使用的空手道配置文件**

 function() {   
          var config = {
            apiURL: 'http://www.dneonline.com/calculator.asmx'
          };

          karate.configure('connectTimeout', 5000);
          karate.configure('readTimeout', 5000);
          karate.configure('ssl', { trustAll: true });
          return config;
        }

错误详细信息:   12:38:56.822 [ForkJoinPool-1-worker-1]错误com.intuit.karate-org.apache.http.conn.ConnectTimeoutException:连接到www.dneonline.com:80 [www.dneonline.com/45.40.165.23 ]失败:连接超时,URL:http://www.dneonline.com/calculator.asmx/calculator.asmx的5068毫秒后http调用失败         12:38:56.822 [ForkJoinPool-1-worker-1] com.intuit.karate错误-http请求失败:         org.apache.http.conn.ConnectTimeoutException:连接到www.dneonline.com:80 [www.dneonline.com/45.40.165.23]失败:连接超时

I am not quite sure if i need to configure any proxy setting in Intellij or in the karate framework. 
or if it is something to do with the firewall as i am using my company's system.

Thanks .

2 个答案:

答案 0 :(得分:1)

是的,也许您必须设置一个代理:https://github.com/intuit/karate#configure

* configure proxy = 'http://my.proxy.host:8080'

答案 1 :(得分:0)

感谢彼得的迅速答复...您提供的解决方案很好。非常感谢:)