Yet another problem with PHP soapclient, I hope someone can show me the correct way of doing this:
Here is a portion of the parameter array to keep things simple:
$params = array (
'communication' =>
[
'user-configuration' =>
[
'ruleset' =>
[
'rule' =>
[
'_' => '',
'id' => '999',
'conditions' =>
[
'rule1' => 'true',
],
'actions' =>
[
'forward-to' =>
[
'target' => '123456'
],
],
],
],
],
],
);
I call the soapclient as follows:
$client = new SoapClient
($wsdl,
array(
'location' => "http://$ip:8080/CAI3G1.2/services/CAI3G1.2",
'uri' => "http://$ip:8080/CAI3G1.2/services/CAI3G1.2",
'exceptions' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
'connection_timeout' => 5,
'trace' => 1,
'encoding'=>' UTF-8'
));
$header = new SoapHeader('http://schemas.ericsson.com/cai3g1.2/','SessionId',$sessionID,false);
$client->__setSoapHeaders($header);
try {
$response = $client->Set($params);
} catch(Exception $e){
if ($debug) print_r($e);
return $e;
}
return $response;
The XML generated has an extra unwanted part highlighted as follows:
<ns2:communication>
<ns2:user-configuration>
<ns2:ruleset>
<ns2:rule id="999">
<ns2:id>999</ns2:id>
<ns2:conditions>
<ns2:rule1>true</ns2:rule1>
</ns2:conditions>
<ns2:actions>
<ns2:forward-to>
<ns2:target>123456</ns2:target>
</ns2:forward-to>
</ns2:actions>
</ns2:rule>
</ns2:ruleset>
</ns2:user-configuration>
</ns2:communication>
the server doesnt like these extra line added on the request:
<ns2:id>999</ns2:id>
if I put the same request on soapUI the request does not contain this extra values, it is as follows, which the server accepts:
<ns2:communication>
<ns2:user-configuration>
<ns2:ruleset>
<ns2:rule id="999">
<ns2:conditions>
<ns2:rule1>true</ns2:rule1>
</ns2:conditions>
<ns2:actions>
<ns2:forward-to>
<ns2:target>123456</ns2:target>
</ns2:forward-to>
</ns2:actions>
</ns2:rule>
</ns2:ruleset>
</ns2:user-configuration>
</ns2:communication>