zoukankan      html  css  js  c++  java
  • 如何用Curl 来post xml 数据

    因为登陆服务升级,密码策略变更,以前的测试脚本中的用户密码已经不能登陆,试图通过API直接更改密码,一种是直接update,一种是change,使用curl的时候均未成功。

    最后索性重新用curl命令创建新的用户,一番摸索下来,注册用户仅支持私有端口。剩下的问题就是如何使用curl来postxml 文件。

    经过一番查找,终于找到了curl使用post的命令:

    1. echo '<?xml version …>'|curl -X POST -H 'Content-type:text/xml' -d @- http://10.206.30.32:8081/loginregistration/register  
    echo '<?xml version …>'|curl -X POST -H 'Content-type:text/xml' -d @- http://10.206.30.32:8081/loginregistration/register

    其中<?xml version …>就是要post的xml 文件,8081是私有端口。

    例子:

    Request:

    1. echo '<?xml version="1.0" encoding="utf-8" ?><user>......</user>'|curl -X POST -H 'Content-type:text/xml' -d @- http://10.206.30.32:8081/loginregistration/register  
    echo '<?xml version="1.0" encoding="utf-8" ?><user>......</user>'|curl -X POST -H 'Content-type:text/xml' -d @- http://10.206.30.32:8081/loginregistration/register

    Response:

    1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user>......</user>  
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user>......</user>
  • 相关阅读:
    朋友
    Music
    Rnadom Teams
    Bone Collector(01背包)
    Common Subsequence LCS
    Copying Books
    Equal Sum Sets
    Checker Challenge
    棋盘问题
    油田(Oil Deposits)
  • 原文地址:https://www.cnblogs.com/jing1617/p/6442640.html
Copyright © 2011-2022 走看看