我有一个名为 createReport() 的肥皂方法,它具有以下参数:
- 令牌
- 报告类型
- 时间
- 内容
- 标题
- 分析师电子邮件
- 电子邮件模板
- pdf网址
- 地位
- 活跃
- 部门
- 地区
- 报告ID
我的 WSDL 将参数定义为:
<wsdl:message name="reportRequest">
<wsdl:part name="token" type="xsd:string"/>
<wsdl:part name="reportType" type="xsd:int"/>
<wsdl:part name="time" type="xsd:int"/>
<wsdl:part name="content" type="xsd:string"/>
<wsdl:part name="title" type="xsd:string"/>
<wsdl:part name="analystEmail" type="xsd:string"/>
<wsdl:part name="email_template" type="xsd:string"/>
<wsdl:part name="pdfUrl" type="xsd:string"/>
<wsdl:part name="status" type="xsd:string"/>
<wsdl:part name="isActive" type="xsd:boolean"/>
<wsdl:part name="sector" type="xsd:int"/>
<wsdl:part name="region" type="xsd:int"/>
<wsdl:part name="reportID" type="xsd:int"/>
</wsdl:message>
我使用默认的 php SOAP 客户端请求响应,如下所示:
$report_id = $client->createReport(
$token,
1,
time(),
'content!',
'Company Report',
'support@website.com',
'email template!',
'pdf URL',
2,
1,
33,
-1,
1
);
目前,服务器函数设置为简单地返回参数列表:
function createReport($token, $reportType, $time, $content, $title, $analystEmail, $email_template, $pdfUrl, $status, $isActive, $sector, $region, $reportID){
//if the user has a bad token
if ( checkToken($token) !== 0 ){
return checkToken($token);
$return->success = 0;
$return->information = "Bad Token ". checkToken( correctPassword() );
return $return;
}
$return->information = '\nToken: '.$token . "\nReportType " .$reportType . "\nTime: " . $time . "\nContent: " . $content . "\nTitle: " . $title . "\nEmail: " . $analystEmail . "\nTemplate: " . $email_template . "\nPDF: " . $pdfUrl . "\nStatus: " . $status . "\nisActive: " . $isActive . "\nsector: " . $sector . "\nregion: " .$region . "\nreportID: " . $reportID;
return $return;
}
生成的 SOAP 请求:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:xmethods-delayed-quotes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:createReport>
<token xsi:type="xsd:string">8f4cf7ae4bd4ab02e591c8b0ab72fe57b4f8ad0c</token>
<reportType xsi:type="xsd:int">1</reportType>
<time xsi:type="xsd:int">1301385965</time>
<content xsi:type="xsd:string">content!</content>
<title xsi:type="xsd:string">Company Report</title>
<analystEmail xsi:type="xsd:string">support@website.com</analystEmail>
<email_template xsi:type="xsd:string">email template!</email_template>
<pdfUrl xsi:type="xsd:string">pdf URL</pdfUrl>
<status xsi:type="xsd:int">2</status>
<isActive xsi:type="xsd:boolean">true</isActive>
<sector xsi:type="xsd:int">33</sector>
<region xsi:type="xsd:int">-1</region>
<reportID xsi:type="xsd:int">1</reportID>
</ns1:createReport>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
和回应:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:xmethods-delayed-quotes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://wood.example.net/master/api/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:createReportResponse>
<response xsi:type="ns2:ReportInfo">
<information xsi:type="xsd:string">\nToken: 8f4cf7ae4bd4ab02e591c8b0ab72fe57b4f8ad0cReportType 1Time: content!Content: Company ReportTitle: support@website.comEmail: email template!Template: pdf URLPDF: 2Status: 1isActive: 33sector: -1region: 1reportID: </information>
</response>
</ns1:createReportResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
注意结果字符串:
Token: 8f4cf7ae4bd4ab02e591c8b0ab72fe57b4f8ad0c
ReportType 1
Time: content!
Content: Company Report
Title: support@website.com
Email: email template!
Template: pdf URL
PDF: 2
Status: 1
isActive: 33
sector: -1
region: 1
reportID:
时间=“内容!”?这是怎么回事?似乎元素被跳过或拼接的时间......是否有 SOAP 有效(尤其是客户端)的解决方法?