I have developed a soap api using nusoap in php. I have created some function for that. I have created a file service.php & when i hit this file on url i get a document for all functions. Like this:
我在php中使用nusoap开发了一个soap api。我已经为此创建了一些功能。我创建了一个文件service.php&当我在url上点击这个文件时,我得到了一个所有函数的文档。喜欢这个:
我的nusoap DOC
But i want to have a xml like description for my functions. Like this:
但我希望我的函数有一个类似xml的描述。喜欢这个:
Please tell me how to do it
请告诉我怎么做
This is my code for service.php
这是我的service.php代码
<?php
require_once "lib/nusoap.php";
require_once "functions.php";
$server=new nusoap_server();
$server->configureWSDL("SOAP", "urn:soapn");
$server->register("addRecord",
array("fname"=>"xsd:string","lname"=>"xsd:string","buis_name"=>"xsd:string","phone_num"=>"xsd:int","city"=>"xsd:string","state"=>"xsd:string", "zipcode"=>"xsd:int","email"=>"xsd:string"
,"w_store"=>"xsd:string","con_store"=>"xsd:string","ind_store"=>"xsd:string","gas_staion"=>"xsd:string","other"=>"xsd:string"),
array("return" => "xsd:string"),
"urn:soap",
"urn:soap#addRecord",
"rpc",
"encoded",
"Add user information to database");
$server->register("checkLogin",
array("email"=>"xsd:string","password"=>"xsd:string"),
array("return" => "xsd:string"),
"urn:soap",
"urn:soapn#checkLogin",
"rpc",
"encoded",
"Verify UserLogin");
$HTTP_RAW_POST_DATA=isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
1 个解决方案
#1
0
The XML in your screenshot is an example SOAP request and SOAP response.
屏幕截图中的XML是一个示例SOAP请求和SOAP响应。
To generate it you need to create such an example request and obtain the raw XML of it. Both the XML of the request as well as the response.
要生成它,您需要创建这样的示例请求并获取它的原始XML。请求的XML以及响应。
You should be able to automate that by creating a request to your local server.
您应该能够通过向本地服务器创建请求来自动执行此操作。
Obtaining the raw XML is explained in the following related Q&A:
以下相关问答解释了获取原始XML:
- How do i view the "raw xml" output from nusoap?
如何查看nusoap的“原始xml”输出?
#1
0
The XML in your screenshot is an example SOAP request and SOAP response.
屏幕截图中的XML是一个示例SOAP请求和SOAP响应。
To generate it you need to create such an example request and obtain the raw XML of it. Both the XML of the request as well as the response.
要生成它,您需要创建这样的示例请求并获取它的原始XML。请求的XML以及响应。
You should be able to automate that by creating a request to your local server.
您应该能够通过向本地服务器创建请求来自动执行此操作。
Obtaining the raw XML is explained in the following related Q&A:
以下相关问答解释了获取原始XML:
- How do i view the "raw xml" output from nusoap?
如何查看nusoap的“原始xml”输出?