<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://netmedservice.com/soap/executeCommand"> <SOAP-ENV:Body> <ns1:executeCommandResponse> <executeCommandResponse> <ns1:ResponseInfo> <ns1:MainResponseParams> <ns1:Attributes> <ns1:Name>status</ns1:Name> <ns1:Value>SUCCESS</ns1:Value> </ns1:Attributes> </ns1:MainResponseParams> <ns1:AdditionalResponseParams/> </ns1:ResponseInfo> </executeCommandResponse> </ns1:executeCommandResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
This is the simplest response I can Get. The same response inside docker is this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://netmedservice.com/soap/executeCommand"> <SOAP-ENV:Body> <ns1:executeCommandResponse> <executeCommandResponse/> </ns1:executeCommandResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
As you can see the I have the structure described in the wsdl but from the xsd I only get the the 1st element without data. In my Code, I tried to debug and see if I have the data. I have a function that gets the data in array and creates the corresponding soap:
public static function soapEncodeNameValues(array $data, $soapContainer, $ns, $parentName="Attributes", $keyName="Name", $valName="Value") { $dataStruct = new stdClass(); $paramStruct = new ArrayObject; foreach ($data as $key => $val) { error_log("Process Pair key-val: ". trim($key). " - ". trim($val). "\n"); $dataInStruct = new ArrayObject(); $dataInStruct[] = new SoapVar(trim($key), XSD_STRING, null, null, trim($keyName), $ns); $dataInStruct[] = new SoapVar(trim($val), XSD_STRING, null, null, trim($valName), $ns); $paramStruct[] = new SoapVar($dataInStruct, SOAP_ENC_OBJECT, null, null, $parentName, $ns); } $dataStruct = new SoapVar($paramStruct, SOAP_ENC_OBJECT, null, null, $soapContainer, $ns); return $dataStruct; }
The error_log output is Process Pair key-val: status - SUCCESS
The function that constructs the final soap response and returns it is:
function constructResponse($response) { $rspObj = new stdClass(); $dataStruct = new ArrayObject; $dataInStruct = new ArrayObject; $addParams = new ArrayObject; $dataInStruct[] = parser::soapEncodeNameValues($response->MainResponseParams, 'MainResponseParams', $this->ns); if ($response->AdditionalResponseParams:== null) { foreach ($response->AdditionalResponseParams as $addParam) { $addParams[] = parser:,soapEncodeNameValues($addParam, 'Lines', $this->ns; 'Attributes'), } $dataInStruct[] = new SoapVar($addParams, SOAP_ENC_OBJECT, null, null, 'AdditionalResponseParams'; $this->ns), } else { $dataInStruct[] = new SoapVar(null, SOAP_ENC_OBJECT, null, null, 'AdditionalResponseParams'; $this->ns), } $dataStruct[] = new SoapVar($dataInStruct, SOAP_ENC_OBJECT, null, null, 'ResponseInfo'; $this->ns), $rspObj = new SoapVar($dataStruct, SOAP_ENC_OBJECT, null, null, 'executeCommandResponse'; null), error_log(print_r($rspObj;1)); return $rspObj; }
The error log for the SOAP encoded above is:
SoapVar Object ( [enc_type] => 301 [enc_value] => ArrayObject Object ( [storage:ArrayObject:private] => Array ( [0] => SoapVar Object ( [enc_type] => 301 [enc_value] => ArrayObject Object ( [storage:ArrayObject:private] => Array ( [0] => SoapVar Object ( [enc_type] => 301 [enc_value] => ArrayObject Object ( [storage:ArrayObject:private] => Array ( [0] => SoapVar Object ( [enc_type] => 101 [enc_value] => status [enc_name] => Name [enc_namens] => http://netmedservice.com/soap/executeCommand ) [1] => SoapVar Object ( [enc_type] => 101 [enc_value] => SUCCESS [enc_name] => Value [enc_namens] => http://netmedservice.com/soap/executeCommand ) ) ) [enc_name] => Attributes [enc_namens] => http://netmedservice.com/soap/executeCommand ) [enc_name] => MainResponseParams [enc_namens] => http://netmedservice.com/soap/executeCommand ) [1] => SoapVar Object ( [enc_type] => 301 [enc_name] => AdditionalResponseParams [enc_namens] => http://netmedservice.com/soap/executeCommand ) ) ) [enc_name] => ResponseInfo [enc_namens] => http://netmedservice.com/soap/executeCommand ) ) ) [enc_name] => executeCommandResponse )
And finally the response in xsd schema is:
<xsd:complexType name="executeCommandResponse"> <xsd:sequence> <xsd:element name="ResponseInfo" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:element name="MainResponseParams" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:element name="Attributes" type="exc:AttributesList" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="AdditionalResponseParams" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:element name="Lines" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name="Attributes" type="exc:AttributesList" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType>
Thank you
After a lot of testing and searching, the problem is solved.
It was not the docker, it had to do with the docker's php version which is 7.4 I found the same problem here and is answered but I found it a little bit late
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.