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>
  • 相关阅读:
    简单工厂模式
    单例
    开发帮助网址
    图片上传
    数据提交
    存储过程
    标量值函数
    linux查看TCP各连接状态
    nginx配置文件nginx.conf
    php配置文件php-fpm.conf
  • 原文地址:https://www.cnblogs.com/jing1617/p/6442640.html
Copyright © 2011-2022 走看看