【问题标题】:Could not resolve host error while adding targetserver添加目标服务器时无法解决主机错误
【发布时间】:2014-04-02 13:41:23
【问题描述】:

我想添加新的目标服务器,但出现以下错误。

curl: (6) Could not resolve host: <TargetServer name=TS1><Host>test.jokeindex.co
m<
curl: (6) Could not resolve host: \

{
    "fault": {
        "faultstring": "XMLThreatProtection stepDefinition XMLThreat: Execution
 failed. reason: Unexpected char while looking for open tag ('&lt;') character",
        "detail": {
            "errorcode": "steps.xmlthreatprotection.ExecutionFailed"
        }
    }
}

卷曲命令:

curl -H "Content-Type:text/xml" -X POST -d \ "<TargetServer name="TS1"><Host>test.jokeindex.com</Host><Port>80</Port><IsEnabled>true</IsEnabled></TargetServer>" \ -u nisarg:mypwd https://api.enterprise.apigee.com/v1/o/nisarg/environments/test/targetservers

【问题讨论】:

  • 机器可以解析和/或ping test.jokeindex.com 吗?
  • 没有。请求超时。
  • 这也是你的 curl 错误所说的。
  • 是的,所以我使用了 chrome 的 POSTMAN 插件并得到了响应。谢谢 Flauntster。

标签: apigee


【解决方案1】:

您需要在数据周围使用单引号,因为您在其中使用双引号。

所以试试这个吧:

curl -H "Content-Type:text/xml" -X POST -d  '<TargetServer name="TS1"><Host>test.jokeindex.com</Host><Port>80</Port><IsEnabled>true</IsEnabled></TargetServer>' -u nisarg:mypwd https://api.enterprise.apigee.com/v1/o/nisarg/environments/test/targetservers

【讨论】:

  • 在 windows 上单引号抛出一些语法错误,我在 stackoverflow 上发现我们应该使用双引号而不是单引号。
猜你喜欢
  • 2018-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-09-26
  • 1970-01-01
  • 2018-04-15
  • 1970-01-01
相关资源
最近更新 更多