I'm strugling around with the php soap implementation.
I need to request data from a java web application and the request parameters are sometimes passed as regular soap parameters and sometimes passed as attributes to the enclosing tag.
Example for a valid request:
Code: Select all
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://mynamespace">
<soapenv:Header/>
<soapenv:Body>
<con:GetContainerRequest containerId="2">
<!--Optional:-->
<con:CustomFieldIds>
<!--Zero or more repetitions:-->
<con:CustomFieldId>1</con:CustomFieldId>
</con:CustomFieldIds>
</con:GetContainerRequest>
</soapenv:Body>
</soapenv:Envelope>
If I code something like:
Code: Select all
$obj = new stdClass;
$obj->containerId['_'] = "containerId";
$obj->containerId['containerId'] = $containerId;
if($customFieldIds!= null) {
$cfIds = new stdClass;
foreach($customFieldIds as $cfId) {
$contIds->CustomFieldId[] = new SoapVar($cfId, XSD_STRING, null, null, null, SoapApi::$containerServiceNs);
}
$obj->CustomFieldIds = new SoapVar($cfIds, SOAP_ENC_OBJECT);
}
$soapstruct = new SoapVar($obj, SOAP_ENC_OBJECT);
return $this->clientForContainerService->GetContainer(new SoapParam($soapstruct, "inputStruct"));
The resulting request is:
Code: Select all
<SOAP-ENV:Body>
<ns1:GetContainerRequest>
<containerId>
<item>
<key>_</key>
<value>containerId</value>
</item>
<item>
<key>containerId</key>
<value>104</value>
</item>
</containerId>
</ns1:GetContainerRequest>
</SOAP-ENV:Body>
Anyone here who has knowledge about how my could should be structured?
Cheers and thanks in advance
Thomas