PHP SOAP请求未填充XML参数

PHP SOAP请求未填充XML参数,php,xml,soap,Php,Xml,Soap,我正在尝试进行一个简单的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调用:

$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>
我得到以下信息:

<?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>

SOAP调用中未填充XML。 我检查了文档,但我不能确定我错了什么。 以下是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>

如果没有完整的WSDL,我认为您应该尝试:

$response = $client->LoginAndGetStudentsData(['username'=>'foo','password'=>'bar', 'p'=>[]]);
然后看看

die("Request: ".$client->__getLastRequest()."\nEnd Request");

并查看这些参数是否已填充,但请注意,实际上可能需要第三个参数的适当结构才能对其进行正确编码。请注意该wsdl中的minOccurs=“1”,并准备p作为常规php数组。它应该会起作用。如果没有,那么请阅读php soal u_soapCall+SoapParam数组,但这应该不是必需的

您可以打印$xmlstring2并发布wsdl吗?同样对于soap,我认为它不应该是作为参数的“xml”,而是作为数组或对象传递的实际结构-但为了确保我需要看到wsdl。@Greg wsdl被IP屏蔽,但我将使用的相关函数复制到了原始帖子中。谢谢@格雷格,你知道为什么会这样吗?这确实满足了你的要求,谢谢!现在我有一个标题的问题,但那是完全不同的。
die("Request: ".$client->__getLastRequest()."\nEnd Request");