Nusoap 简单类型枚举

发布于 2024-09-29 18:59:40 字数 5172 浏览 2 评论 0原文

我有一个枚举类,我想在函数中设置它的值。但我没有能力这样做。它总是选择队列中的拳头,她就是顾客。

$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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅语花开 2024-10-06 18:59:40

我是这样做的:

$server->wsdl->addSimpleType('MyDataType', 'xsd:string', 'SimpleType', 'scalar', 
    array(
    'Value1',
    'Value2'
    ));

这会导致 wsdl 中的以下内容

<xsd:simpleType name="MyDataType">
  <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Value1"/>
      <xsd:enumeration value="Value2"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>

从 NuSoap 文档中获取

Here's how I did it:

$server->wsdl->addSimpleType('MyDataType', 'xsd:string', 'SimpleType', 'scalar', 
    array(
    'Value1',
    'Value2'
    ));

which results in the following in the wsdl

<xsd:simpleType name="MyDataType">
  <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Value1"/>
      <xsd:enumeration value="Value2"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>

got it from the NuSoap docs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文