I am struggling with creating a proper SOAP envelope in a Zend Soap Client instance.
Here is a sample of an expected envelope, generated from the WSDL file:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:v1="http://coc.gov/xsd/ESB/SupplementalData/V1"
xmlns:ns="http://schemas.calgary.ca/xsd/familycommunitysurvey/2012/08"
xmlns:ns1="http://schemas.calgary.ca/xsd/familycommunitysurveycdm/2012/08">
<soapenv:Header>
<v1:SupplementalData>
<v1:SourceName>CFS</v1:SourceName>
<v1:ServiceProvider>
<v1:Name>FamilyCommunitySurvey</v1:Name>
<v1:OperationName>GetCodeLookupByName</v1:OperationName>
</v1:ServiceProvider>
<v1:CorrelationID>23451235634</v1:CorrelationID>
</v1:SupplementalData>
</soapenv:Header>
<soapenv:Body>
<ns:GetCodeLookupByNameRequest>
<ns1:Name>Country</ns1:Name>
</ns:GetCodeLookupByNameRequest>
</soapenv:Body>
</soapenv:Envelope>
The properties I need to set are 'SourceName', 'CorrelationID' in the header, and 'Name' in the body. Here is how I'm doing it:
$fsiiConnect = new Zend_Soap_Client($wsdl, array('soap_version' => SOAP_1_1));
$fsiiConnect->setLocation($endPoint);
$fsiiConnect->setHttpLogin($userName);
$fsiiConnect->setHttpPassword($password);
$data=array(
'SourceName' => 'CFS',
'CorrelationID' => '1234251435632',
'Name' => 'Country'
);
try {
$results = $fsiiConnect->GetCodeLookupsByName($data);
}
catch (Exception $e) {
print $fsiiConnect->getLastRequest();
}
And the contents of getLastRequest() are:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://schemas.calgary.ca/xsd/familycommunitysurveycdm/2012/08"
xmlns:ns2="http://schemas.calgary.ca/xsd/familycommunitysurvey/2012/08">
<SOAP-ENV:Body>
<ns2:GetCodeLookupByNameRequest>
<ns1:Name>Country</ns1:Name>
</ns2:GetCodeLookupByNameRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So that it's only setting properties to objects in the body, not the header. Any ideas why would be greatly appreciated!