Php SOAP:作为NULL传递的整数
在PHP文件中,我使用WSDL调用我的函数getCustomerByID(需要一个整数)并传入相应的ID。问题是,即使将ID硬编码到函数中,它仍然会以NULL形式传递给服务器Php SOAP:作为NULL传递的整数,php,soap,null,wsdl,Php,Soap,Null,Wsdl,在PHP文件中,我使用WSDL调用我的函数getCustomerByID(需要一个整数)并传入相应的ID。问题是,即使将ID硬编码到函数中,它仍然会以NULL形式传递给服务器 <?php require_once("./include/nusoap/nusoap.php"); $client = new SoapClient('D:\wsdl\CustomerService_CustomerServiceSOAPhttpWithIPAddress.wsdl', ar
<?php
require_once("./include/nusoap/nusoap.php");
$client = new SoapClient('D:\wsdl\CustomerService_CustomerServiceSOAPhttpWithIPAddress.wsdl', array('trace' => 1));
$cId = 100777;
echo " CID:".$cId;
echo "<br>";
try{
$customerID = $client->getCustomerById(100777); //Error is here.
throw new SoapFault('code', 'string', 'actor', 'detail', 'name', 'header');
}
catch (Exception $ex) {
var_dump($ex->faultcode, $ex->faultstring, $ex->faultactor, $ex->detail, $ex->_name, $ex->headerfault);
}
?>
以下是WSDL元素:
<xsd:element name="getCustomerById">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="customerId" nillable="true" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
以下是服务器捕获的内容,以及服务器随后的回复:
发送
您会注意到,
不包含任何值
答复:
m:Server
非常感谢您的任何想法/建议 你不应该这样称呼它:
$client->call('getCustomerById', array('customerId' => 100777))
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://CustomerServices/customerService"><SOAP-ENV:Body><ns1:getCustomerById/></SOAP-ENV:Body></SOAP-ENV:Envelope>
$client->call('getCustomerById', array('customerId' => 100777))