RE: [SOAP] XML schema problems
| From: | Mike Carter | Date: | Wed, 11 Jun 2003 09:28:11 +0000 |
| Subject: | RE: [SOAP] XML schema problems | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-703@lists.php.net to get a copy of this message | ||
Hi,
> -----Original Message-----
> From: Steve Fisk [mailto:sfisk@quantiv.com]
>
> We wanted to send the back end an array of
> answers and therein lies the problem:
>
> When we send an array of answers the schema looks like this:
>
> <answerList>
> <ns4:item>answer1</item>
> <ns4:item>answer2</item>
> <ns4:item>answer3</item>
> </answerList>
>
> where ns4 is the default namespace and the item tags denote
> array elements.
I think this occurs from the code in SOAP/Base class
(http://cvs.php.net/co.php/pear/SOAP/Base.php?login=2&r=1.35), which does:
// serialize each array element
$ar_size = count($value);
for ($i=0; $i < $ar_size; $i++) {
$array_val =& $value[$i];
if ($this->_isSoapValue($array_val)) {
$array_type = $array_val->type;
$array_types[$array_type] = 1;
$array_type_ns = $array_val->type_namespace;
$xmlout_value .= $array_val->serialize($this);
} else {
$array_type = $this->_getType($array_val);
$array_types[$array_type] = 1;
$xmlout_value .=
$this->_serializeValue($array_val,'item', $array_type,
$this->_section5?NULL:$elNamespace);
}
}
See the $xmlout_value at the end of the above snippet?
> The problem is that the definition in the WSDL defines
> strings therefore the schema should look like this:
>
> <answerList>
> <ns4:string>answer1</string >
> <ns4:string>answer2</string >
> <ns4:string>answer3</string >
> </answerList>
>
> This is the standard for Microsoft and the back end
> developers have to write a big swathe of code to compensate
> for this problem.
You can probably solve this problem by specifying the datatype of the value
you're putting in to the array, rather than leaving PEAR::SOAP to work it
out (or default to something not great).
Possibly the use of SOAP_Value (from
http://cvs.php.net/co.php/pear/SOAP/Value.php?login=2&r=1.35)
to tell
PEAR::SOAP what type of value is going in your array.
Hope that helps. Maybe? :)
- Mike C
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.484 / Virus Database: 282 - Release Date: 5/27/2003
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________