NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
nusoap & WSDL: a few questions


Joined: 29 Jun 2006
Posts: 20
Reply with quote
Hi,

i have 3 questions concerning nusoap & WSDL generation:

1. I have a function that is supposed to return an array. But on occasion this array contains nothing (which is ok). The problem now is that the returned XML returns strange data, which the client (some eclipse java client, not under my influence) obviously cannot work with.

The WSDL Part is implemented as follows:
Code:

$server -> wsdl -> addComplexType
(
   'accessory_list',
   'complexType',
   'array',
   'all',
   '',
   array
   (
      'accessory_id' => array('name'=>'accessory_id','type'=>'xsd:int')
   )
);


So if the function does return data within the array "accessory_list" the output is somthing like this:
Code:

<accessory_list xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[3]">
    <item xsi:type="xsd:int">19173</item>
    <item xsi:type="xsd:int">19668</item>
    <item xsi:type="xsd:int">21022</item>
</accessory_list>


But if the array is empty the result is:

Code:

<accessory_list xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[0]"/>


What would be the best practice in this case? Completely unset that array so nothing is returned instead?

2. The following structure returns a "unnamed_struct_use_soapval[1]" as arrayType in the response:
Code:

$server -> wsdl -> addComplexType
(
'product_channel_list',
'complexType',
'struct',
'all',
'SOAP-ENC:Array',
array(),
array
(
   array
   (
      'ref'=>'SOAP-ENC:arrayType',
      'wsdl:arrayType'=>'tns:product_channel[]'
   )
),
'tns:product_channel');

$server -> wsdl -> addComplexType
(
   'product_channel',
   'complexType',
   'struct',
   'all',
   '',
   array
   (
      'id' => array('name' => 'id', 'type' => 'xsd:int'),
      'name' => array('name' => 'name', 'type' => 'xsd:string'),
      'price' => array('name' => 'price', 'type' => 'xsd:int'),
       'description' => array('name' => 'description', 'type' => 'xsd:string'),
      'categories' => array('name' => 'categories', 'type' => 'xsd:string'),
      'top_product' => array('name' => 'top_product', 'type' => 'xsd:boolean')
   )
);   


Result similar to this:
Code:

<product_channel_list xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="unnamed_struct_use_soapval[1]">
   <item>
      <id xsi:type="xsd:int">24</id>
      <name xsi:type="xsd:string">Lufthansa</name>
      <price xsi:type="xsd:int">24000</price>
      <description xsi:type="xsd:string"/>
      <categories xsi:type="xsd:string">0</categories>
      <top_product xsi:type="xsd:boolean">0</top_product>
   </item>
</product_channel_list>


2 questions here:

1. How can i give the struct a name (unnamed_struct_use_soapval)?
2. How can the "item" items be named as e.g. "product_channel"?

Thanx in advance[/code]
View user's profileFind all posts by Doc OlsonSend private message
nusoap & WSDL: a few questions
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic