无法使用Shell脚本调用REST服务-[CLOSED]

时间:2018-12-11 11:40:02

标签: shell

我有一个REST服务,并试图通过SHELL脚本调用,但是它抛出以下错误消息。

  

卷曲:(3)在网址中发现非法字符

我有下面的Test.sh文件,它将尝试调用REST服务:

    test="$(cat testng-results.xml)"
    test1="$(cat testng-results_1.xml)"
    echo "$test"
    echo"http://10.239.61.4:8083/testngXML/getTestNGMerge/${test}/originalXML/${test1}"
    curl -O --globoff -X GET "http://10.239.61.4:8083/testngXML/getTestNGMerge/${test}/originalXML/${test1}"

我试图将XML内容作为查询参数传递到最终URL中,因为我已经将rest客户端部署在不同的主机中并访问了不同主机中的shell脚本,这就是将XML内容作为REST端点URL传递的原因。 / p>

如何使上面的REST url正常工作,这样做是正确的方法,如果没有,那么这是最好的方法

testNG-Result.xml:

<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="0" total="10" passed="10">
    <suite name="TransferMoney-Suite" duration-ms="157605" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:05Z"> 
  <test name="TransferMoneyTest" duration-ms="153141" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:01Z"> 
    <class name="com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest"> 
      <test-method status="PASS" signature="initializeDataProvider(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest@3168e461]" name="initializeDataProvider" is-config="true" duration-ms="27" started-at="2018-11-13T20:34:30Z" finished-at="2018-11-13T20:34:30Z"> 
        <params> 
          <param index="0"> 
            <value>35,</value> 
          </param>  
          <param index="1"> 
            <value is-null="true"/> 
          </param>  
          <param index="2"> 
            <value is-null="true"/> 
          </param> 
        </params> 
      </test-method>  
      <!-- initializeDataProvider -->  
      <!-- transferMoneyPaymentE2ETest --> 
    </class>  
    <!-- com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest --> 
  </test>  
  <!-- TransferMoneyTest -->  
  <test name="Suite setup and teardown" duration-ms="4312" started-at="2018-11-14T04:37:01Z" finished-at="2018-11-14T04:37:05Z"> 
    <class name="com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite"> 
      <test-method status="FAIL" signature="suiteSetup(org.testng.ITestContext)[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite@681da322]" name="suiteSetup" is-config="true" duration-ms="56" started-at="2018-11-13T20:34:27Z" finished-at="2018-11-13T20:34:27Z"> 
        <params> 
          <param index="0"> 
            <value>org.testng.TestRunner@74bc72e0</value> 
          </param> 
        </params> 
      </test-method>  
      <!-- suiteSetup -->  
      <test-method status="PASS" signature="dumpTransactionInfo()[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite@681da322]" name="dumpTransactionInfo" is-config="true" duration-ms="23" started-at="2018-11-13T20:37:05Z" finished-at="2018-11-13T20:37:05Z"/>  
      <!-- dumpTransactionInfo --> 
    </class>  
    <!-- com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite --> 
  </test>  
  <!-- Suite setup and teardown --> 
</suite>
</testng-results>

TestNG-Result_1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<testng-results skipped="0" failed="0" total="10" passed="10">
    <suite name="TransferMoney-Suite" duration-ms="157605" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:05Z"> 
  <test name="TransferMoneyTest" duration-ms="153141" started-at="2018-11-14T04:34:27Z" finished-at="2018-11-14T04:37:01Z"> 
    <class name="com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest"> 
      <test-method status="PASS" signature="initializeDataProvider(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest@3168e461]" name="initializeDataProvider" is-config="true" duration-ms="27" started-at="2018-11-13T20:34:30Z" finished-at="2018-11-13T20:34:30Z"> 
        <params> 
          <param index="0"> 
            <value>35,</value> 
          </param>  
          <param index="1"> 
            <value is-null="true"/> 
          </param>  
          <param index="2"> 
            <value is-null="true"/> 
          </param> 
        </params> 
      </test-method>  
      <!-- initializeDataProvider -->  
      <!-- transferMoneyPaymentE2ETest --> 
    </class>  
    <!-- com.paypal.test.e2e.millennium.transfermoney.TransferMoneyMillenniumE2ETest --> 
  </test>  
  <!-- TransferMoneyTest -->  
  <test name="Suite setup and teardown" duration-ms="4312" started-at="2018-11-14T04:37:01Z" finished-at="2018-11-14T04:37:05Z"> 
    <class name="com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite"> 
      <test-method status="FAIL" signature="suiteSetup(org.testng.ITestContext)[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite@681da322]" name="suiteSetup" is-config="true" duration-ms="56" started-at="2018-11-13T20:34:27Z" finished-at="2018-11-13T20:34:27Z"> 
        <params> 
          <param index="0"> 
            <value>org.testng.TestRunner@74bc72e0</value> 
          </param> 
        </params> 
      </test-method>  
      <!-- suiteSetup -->  
      <test-method status="PASS" signature="dumpTransactionInfo()[pri:0, instance:com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite@681da322]" name="dumpTransactionInfo" is-config="true" duration-ms="23" started-at="2018-11-13T20:37:05Z" finished-at="2018-11-13T20:37:05Z"/>  
      <!-- dumpTransactionInfo --> 
    </class>  
    <!-- com.paypal.test.e2e.millennium.settlement.SettlementE2ESuite --> 
  </test>  
  <!-- Suite setup and teardown --> 
</suite>
</testng-results>

0 个答案:

没有答案