Nusoap 简单类型枚举
我有一个枚举类,我想在函数中设置它的值。但我没有能力这样做。它总是选择队列中的拳头,她就是顾客。
$server->wsdl->addSimpleType(
'AddressType',
'xsd:string',
'SimpleType',
'struct',
array(
'Customer',
'Order',
'Delivery',
'Invoice',
'Contact'
)
);
Included in this struct with name Type:
// ---- AddressData ----------------------------------------------------------------
$server->wsdl->addComplexType(
'AddressData',
'complexType',
'struct',
'all',
'',
array(
'Number' => array('name'=>'Number','type'=>'xsd:string'),
'Name1' => array('name'=>'Name1','type'=>'xsd:string'),
'Name2' => array('name'=>'Name2','type'=>'xsd:string'),
'StreetAddress1' => array('name'=>'StreetAddress1','type'=>'xsd:string'),
'StreetAddress2' => array('name'=>'StreetAddress2','type'=>'xsd:string'),
'StreetAddress3' => array('name'=>'StreetAddress3','type'=>'xsd:string'),
'Postcode' => array('name'=>'Postcode','type'=>'xsd:string'),
'City' => array('name'=>'City','type'=>'xsd:string'),
'Mobile' => array('name'=>'Mobile','type'=>'xsd:string'),
'Phone' => array('name'=>'Phone','type'=>'xsd:string'),
'Email' => array('name'=>'Email','type'=>'xsd:string'),
'Fax' => array('name'=>'Fax','type'=>'xsd:string'),
'PostOfficeBox' => array('name'=>'PostOfficeBox','type'=>'xsd:string'),
'PostOfficeBoxCity' => array('name'=>'PostOfficeBoxCity','type'=>'xsd:string'),
'PostOfficeBoxPostcode' => array('name'=>'PostOfficeBoxPostcode','type'=>'xsd:string'),
'CountryName' => array('name'=>'CountryName','type'=>'xsd:string'),
'CustomerOrigin' => array('name'=>'CustomerOrigin','type'=>'xsd:string'),
'Attention' => array('name'=>'Attention','type'=>'xsd:string'),
'Contact' => array('name'=>'Contact','type'=>'xsd:string'),
'ReceiverRef' => array('name'=>'ReceiverRef','type'=>'xsd:string'),
'OurRef' => array('name'=>'OurRef','type'=>'xsd:string'),
'MessageToCarrier' => array('name'=>'MessageToCarrier','type'=>'xsd:string'),
'MessageToDriver' => array('name'=>'MessageToDriver','type'=>'xsd:string'),
'MessageToReceiver' => array('name'=>'MessageToReceiver','type'=>'xsd:string'),
'PurchaseNo' => array('name'=>'PurchaseNo','type'=>'xsd:string'),
'ShipmentTypeNo' => array('name'=>'ShipmentTypeNo','type'=>'xsd:string'),
'ReceiverRef' => array('name'=>'ReceiverRef','type'=>'xsd:string'),
'DeliveryConditions' => array('name'=>'DeliveryConditions','type'=>'xsd:string'),
'DeliveryTime' => array('name'=>'DeliveryTime','type'=>'xsd:string'),
'PaymentTerms' => array('name'=>'PaymentTerms','type'=>'xsd:string'),
'Amount' => array('name'=>'Amount','type'=>'xsd:string'),
'Account' => array('name'=>'Account','type'=>'xsd:string'),
'Reference' => array('name'=>'Reference','type'=>'xsd:string'),
'Type' => array('name'=>'Type','type'=>'tns:AddressType')
)
);
在此函数中,我尝试使用值 Delivery,但未设置它。它仍然得到客户:
// ---- GetCustomerData ----------------------------------------------------------------
function GetCustomerData($CustomerNumber,$Credentials) {
$prefix = $Credentials['UserName'];
$outArray = array();
// Query for CustomerData.
$result = mysql_query("SELECT c.customers_id ,
CONCAT(a.entry_firstname, ' ', a.entry_lastname) AS Name ,
a.entry_street_address ,
a.entry_postcode ,
a.entry_city ,
customers_email_address ,
c.customers_email_address ,
c.customers_telephone ,
c.customers_fax
FROM $prefix"."customers AS c
INNER JOIN $prefix"."address_book AS A
ON c.customers_default_address_id = a.address_book_id
WHERE c.customers_id =$CustomerNumber");
while($row = mysql_fetch_array($result))
{
$AddressData['Number'] = $row['customers_id'];
$AddressData['Name1'] = $row['Name'];
$AddressData['StreetAddress1'] = $row['entry_street_address'];
$AddressData['Postcode'] = $row['entry_postcode'];
$AddressData['City'] = $row['entry_city'];
$AddressData['Mobile'] = $row['customers_telephone'];
$AddressData['Email'] = $row['customers_email_address'];
$AddressData['Fax'] = $row['customers_fax'];
$AddressData['Reference'] = 'tester';
}
$AddressData['Type'] = $AddressType['Delivery'];---This line?
$outArray[] = $AddressData;
mysql_close($con);
// Return array
return $outArray;
}
我做错了,这是肯定的,但是什么呢?
I have a enumeration class and I want to set valuse from this in a function. But I`m not abel to do this. It allways picks the fist in line, her it is Customer.
$server->wsdl->addSimpleType(
'AddressType',
'xsd:string',
'SimpleType',
'struct',
array(
'Customer',
'Order',
'Delivery',
'Invoice',
'Contact'
)
);
Included in this struct with name Type:
// ---- AddressData ----------------------------------------------------------------
$server->wsdl->addComplexType(
'AddressData',
'complexType',
'struct',
'all',
'',
array(
'Number' => array('name'=>'Number','type'=>'xsd:string'),
'Name1' => array('name'=>'Name1','type'=>'xsd:string'),
'Name2' => array('name'=>'Name2','type'=>'xsd:string'),
'StreetAddress1' => array('name'=>'StreetAddress1','type'=>'xsd:string'),
'StreetAddress2' => array('name'=>'StreetAddress2','type'=>'xsd:string'),
'StreetAddress3' => array('name'=>'StreetAddress3','type'=>'xsd:string'),
'Postcode' => array('name'=>'Postcode','type'=>'xsd:string'),
'City' => array('name'=>'City','type'=>'xsd:string'),
'Mobile' => array('name'=>'Mobile','type'=>'xsd:string'),
'Phone' => array('name'=>'Phone','type'=>'xsd:string'),
'Email' => array('name'=>'Email','type'=>'xsd:string'),
'Fax' => array('name'=>'Fax','type'=>'xsd:string'),
'PostOfficeBox' => array('name'=>'PostOfficeBox','type'=>'xsd:string'),
'PostOfficeBoxCity' => array('name'=>'PostOfficeBoxCity','type'=>'xsd:string'),
'PostOfficeBoxPostcode' => array('name'=>'PostOfficeBoxPostcode','type'=>'xsd:string'),
'CountryName' => array('name'=>'CountryName','type'=>'xsd:string'),
'CustomerOrigin' => array('name'=>'CustomerOrigin','type'=>'xsd:string'),
'Attention' => array('name'=>'Attention','type'=>'xsd:string'),
'Contact' => array('name'=>'Contact','type'=>'xsd:string'),
'ReceiverRef' => array('name'=>'ReceiverRef','type'=>'xsd:string'),
'OurRef' => array('name'=>'OurRef','type'=>'xsd:string'),
'MessageToCarrier' => array('name'=>'MessageToCarrier','type'=>'xsd:string'),
'MessageToDriver' => array('name'=>'MessageToDriver','type'=>'xsd:string'),
'MessageToReceiver' => array('name'=>'MessageToReceiver','type'=>'xsd:string'),
'PurchaseNo' => array('name'=>'PurchaseNo','type'=>'xsd:string'),
'ShipmentTypeNo' => array('name'=>'ShipmentTypeNo','type'=>'xsd:string'),
'ReceiverRef' => array('name'=>'ReceiverRef','type'=>'xsd:string'),
'DeliveryConditions' => array('name'=>'DeliveryConditions','type'=>'xsd:string'),
'DeliveryTime' => array('name'=>'DeliveryTime','type'=>'xsd:string'),
'PaymentTerms' => array('name'=>'PaymentTerms','type'=>'xsd:string'),
'Amount' => array('name'=>'Amount','type'=>'xsd:string'),
'Account' => array('name'=>'Account','type'=>'xsd:string'),
'Reference' => array('name'=>'Reference','type'=>'xsd:string'),
'Type' => array('name'=>'Type','type'=>'tns:AddressType')
)
);
In this function I try to use the value Delivery, but it is not set. It still get Customer:
// ---- GetCustomerData ----------------------------------------------------------------
function GetCustomerData($CustomerNumber,$Credentials) {
$prefix = $Credentials['UserName'];
$outArray = array();
// Query for CustomerData.
$result = mysql_query("SELECT c.customers_id ,
CONCAT(a.entry_firstname, ' ', a.entry_lastname) AS Name ,
a.entry_street_address ,
a.entry_postcode ,
a.entry_city ,
customers_email_address ,
c.customers_email_address ,
c.customers_telephone ,
c.customers_fax
FROM $prefix"."customers AS c
INNER JOIN $prefix"."address_book AS A
ON c.customers_default_address_id = a.address_book_id
WHERE c.customers_id =$CustomerNumber");
while($row = mysql_fetch_array($result))
{
$AddressData['Number'] = $row['customers_id'];
$AddressData['Name1'] = $row['Name'];
$AddressData['StreetAddress1'] = $row['entry_street_address'];
$AddressData['Postcode'] = $row['entry_postcode'];
$AddressData['City'] = $row['entry_city'];
$AddressData['Mobile'] = $row['customers_telephone'];
$AddressData['Email'] = $row['customers_email_address'];
$AddressData['Fax'] = $row['customers_fax'];
$AddressData['Reference'] = 'tester';
}
$AddressData['Type'] = $AddressType['Delivery'];---This line?
$outArray[] = $AddressData;
mysql_close($con);
// Return array
return $outArray;
}
I`m doing this wrong this is for sure, but what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是这样做的:
这会导致 wsdl 中的以下内容
从 NuSoap 文档中获取
Here's how I did it:
which results in the following in the wsdl
got it from the NuSoap docs