Я пытаюсь сделать простой SOAP вызов:
$aHTTP['http']['header'] = "Content-Type: text/xml; charset=utf-8";
$aHTTP['http']['header'] = "SOAPAction: http://url.com/LoginAndGetStudentsData";
$context = stream_context_create($aHTTP);
$options = array(
'soap_version'=> SOAP_1_1,
'trace'=> true,
'exceptions'=> true, // disable exceptions
'features'=> SOAP_SINGLE_ELEMENT_ARRAYS,
'encoding'=> 'UTF-8',
'cache_wsdl'=>WSDL_CACHE_NONE,
'stream_context=>'=>$context,
);
$client = new SoapClient($baseURL."?wsdl", $options);
$response = $client->LoginAndGetStudentsData($xmlstring2);
Когда я проверяю переменную $ xmlstring2, я вижу, что она действительно заполнена моей XML строкой:
<username>****</username>
<password>****</password>
<p><OrbitId>1</OrbitId><HasLessons xsi:nil="true"/><HasLearningPrograms xsi:nil="true"/><ContextYear>2020</ContextYear><IdNumber xsi:nil="true"/><FillExtraFields>true</FillExtraFields><FromUpdateDate xsi:nil="true"/><ToUpdateDate xsi:nil="true"/><IncludeDivisionInfo>true</IncludeDivisionInfo><IncludeProgramInfo>true</IncludeProgramInfo><IncludeAccumulatedAcademicPoints>false</IncludeAccumulatedAcademicPoints><IncludeMoneyBalanceInfo>false</IncludeMoneyBalanceInfo><IncludePassportImage>false</IncludePassportImage><IncludeSpecializationData>true</IncludeSpecializationData><IncludeWsProgramInfoDetails>false</IncludeWsProgramInfoDetails><IncludeRegistraionRoadMaps>false</IncludeRegistraionRoadMaps><FromStudentCreationDate xsi:nil="true"/><ToStudentCreationDate xsi:nil="true"/><FromStudentLearningProgramUpdateDate xsi:nil="true"/><ToStudentLearningProgramUpdateDate xsi:nil="true"/><FromRegistraionRoadMapUpdateDate xsi:nil="true"/><ToRegistraionRoadMapUpdateDate xsi:nil="true"/></p>
Однако, когда я использую:
die("Request: ".$client->__getLastRequest()."\nEnd Request");
, я получаю следующее:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/"><SOAP-ENV:Body><ns1:LoginAndGetStudentsData/></SOAP-ENV:Body></SOAP-ENV:Envelope>
XML не заполняется в вызове SOAP. Я проверил документацию, но я не могу понять, что я делаю неправильно. Это функции WSDL:
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://url.net/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://url.net/">
<script/>
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://url.net/">
<s:element name="LoginAndGetStudentsData">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="p" type="tns:StudentRequestParameters"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="StudentRequestParameters">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="OrbitId" nillable="true" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="OrbitIds" type="tns:ArrayOfInt"/>
<s:element minOccurs="1" maxOccurs="1" name="HasLessons" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="HasLearningPrograms" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="ContextYear" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="IdNumber" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="FillExtraFields" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="FromUpdateDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="ToUpdateDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludeDivisionInfo" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludeProgramInfo" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludeAccumulatedAcademicPoints" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludeMoneyBalanceInfo" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludePassportImage" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludeSpecializationData" nillable="true" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="OtherId" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="FullNameContains" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludeWsProgramInfoDetails" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="IncludeRegistraionRoadMaps" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="FromStudentCreationDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="ToStudentCreationDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="FromStudentLearningProgramUpdateDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="ToStudentLearningProgramUpdateDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="FromRegistraionRoadMapUpdateDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="ToRegistraionRoadMapUpdateDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string"/>
</s:sequence>
</s:complexType>