|
Posted by Paul on 10/17/43 11:49
Hi Everyone,
I've tried posting this question to the php-soap group, but got no
replies so I was wondering if anyone here could help me understand
what's going on with the following (I'm working in non-WSDL mode).
Basically, I need the following in the SOAP request body:
<ns6:create>
...
<property>
<name>Property 1</name>
<value>Test Value 1</value>
</property>
<property>
<name>Property 2</name>
<value>Test Value 2</value>
</property>
</ns6:create>
So I've created a class called Create that has the required members,
and stores the property elements (which are instances of a class called
NamedValue) in an array:
class NamedValue {
public $name;
public $value;
public function __construct($name, $value) { ... }
}
class Create {
public $id;
public $parent;
public $type;
public $property;
public function __construct(...) {
...
$property = array(
new NamedValue("Property 1", "Test Value 1"),
new NamedValue("Property 2", "Test Value 2")
);
}
}
and when calling the SOAP method:
$client = new SoapClient(null, array(
"location" => ...,
"uri" => ...,
"use" => SOAP_LITERAL
));
$create = new Create(...);
$queryParams = array(
new SoapParam(new SoapVar($create, SOAP_ENC_OBJECT), "statements"),
);
$response = $client->__soapCall("update", $queryParams);
However, instead of the XML I pasted in above, I'm getting each
NamedValue instance wrapped in <Struct /> elements:
<ns6:create>
...
<property>
<SOAP-ENC:Struct>
<name>Property 1</name>
<value>Test Value 1</value>
</SOAP-ENC:Struct>
<SOAP-ENC:Struct>
<name>Property 2</name>
<value>Test Value 2</value>
</SOAP-ENC:Struct>
</property>
</ns6:create>
Which is creating problems with the service I'm calling. Is there any
way to control / avoid this? Any help or further information would be
very much appreciated.
Cheers,
Paul
Navigation:
[Reply to this message]
|