我们拿SOAP 1.1的方法来举例(简体字转换为繁体字)
![](http://upload-images.jianshu.io/upload_images/1715317-1339afe1f6a0c2c7.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
WebService
关于SOAP
它是基于XML的的简易协议,在HTTP的基础上进行信息交换(一般是使用POST请求),如果你有兴趣了解它的更多细节可以参考W3school
使用Postman测试WebService?
![](http://upload-images.jianshu.io/upload_images/1715317-b4d4e8ef94d8e4b1.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/480)
.
1.输入WebService地址,请求方式为POST
![](http://upload-images.jianshu.io/upload_images/1715317-bfb4e321af4afd45.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
WebService地址
2.添加请求头
上面我们提到过SOAP是基于XML的格式来进行传输的,这边需要指定传输数据的类型;并且指定了数据编码格式为UTF-8(中文乱码)
![](http://upload-images.jianshu.io/upload_images/1715317-900f511db4fba1b6.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
添加请求头
3.上传数据并发送请求
这边把接口定义的请求格式复制进去,填上必要的参数就可以了;注意的是这边要选择raw
得方式进行请求,关于它们的区别我在后面会写到。
![](http://upload-images.jianshu.io/upload_images/1715317-08f8e8ca968efd2d.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
上传数据并发送请求
关于上面这四种请求方式
- form-data
相当于Content-Type:multipart/form-data
;
它会将表单的数据处理为一条消息,以标签为单元,用分隔符分开。既可以上传键值对,也可以上传文件。
![](http://upload-images.jianshu.io/upload_images/1715317-3dc47a66e433a22e.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
form-data
- x-www-form-urlencoded
相当于application/x-www-from-urlencoded
,会将表单中的数据以键值对的形式拼接起来;如:name=许渺&gender=0
![](http://upload-images.jianshu.io/upload_images/1715317-7030ca0598956a2b.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
x-www-form-urlencoded
- raw
上传任意格式的文本,比如JSON、XML等
![](http://upload-images.jianshu.io/upload_images/1715317-80eb93c10a11d540.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
raw
- binary
相当于Content-Type:application/octet-stream;用来上传二进制数据,一般是用来上传文件;因为没有键值对所以每次只能上传一个文件。
![](http://upload-images.jianshu.io/upload_images/1715317-da40278c88135312.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200)
binary