izyumskiy / restsoap-api
此包最新版本(dev-master)没有可用的许可证信息。
dev-master
2016-05-04 15:36 UTC
This package is not auto-updated.
Last update: 2024-09-14 18:26:11 UTC
README
用于生成REST和SOAP接口的WSDL包
- 生成带有WSDL的REST和SOAP接口;
- 在REST方案中提供了XML或JSON输入/输出;
- 响应中的HTTP状态码以头信息返回;
- 使用WSDL中的XSD方案进行请求/响应验证
REST
资源调用
到资源的链接应包含多个部分。例如,/api/rest/example/xml/books/{book_id}
其中
/api/rest/example/ - link to webmaster's resource library
/xml/ - requested data format. Supported formats - xml, json
/books/ - resource name. All resources are described in documentation followed by the input parameters
输入参数
GET请求传输参数的方式有几种
In URL - /api/rest/example/xml/books/{book_id}
In GET-parameters - /api/rest/example/xml/books?book_id=351
Mixed type - /api/rest/example/xml/books/{book_id}?author=dostoevsky
一个参数的多个值以逗号分隔。例如,geo=186,150,37。注意!GET参数的值将覆盖URL中相同参数的值。
对于PUT和POST请求,参数在HTTP包体中的传输顺序应与XSD方案中描述的顺序相同。参数的表示格式必须与请求数据类型匹配 - XML或JSON。请检查PUT请求的XML和JSON格式的示例
<updateBooksRequestData>
<book_id>35</book_id>
<title>New Title</title>
<author>New Author</author>
<price>100</price>
</updateBooksRequestData>
{
"book_id": 35,
"title": "New Title",
"author": "New Author",
"price": 100
}
响应格式
无论与API交互的格式如何,方法响应中包含的数据结构如下
status - status of the query;
Possible responses:
200 - the query was successfully performed;
400 - Incorrect incoming parameters;
403 - Incorrect apiKey or insufficient access rights;
500 - Internal error.
This status code can be duplicated in The HTTP status code
error - error message;
If the query is successful, the value will be empty.
data - array with the data returned for the method called. If the query fails it will be empty.
示例
{
"status": 500,
"error": "Server error",
"data": [ ],
}
数据块的内容在WSDL/XSD中描述。
ApiController是API的入口点