Hiall
我必须连接到第三方肥皂服务,所以我无法控制wsdl。它包含以下定义:
<s:schema elementFormDefault="qualified" targetNamespace="http://Shared.GlobalServices.DataTypes/PictureListRequest">
<s:element name="Request" type="s0:PictureListRequest" />
<s:complexType name="PictureListRequest">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Header"
type="s0:PictureListRequestHeader" />
<s:element minOccurs="0" maxOccurs="1" name="Body"
type="s0:PictureListRequestBody" />
</s:sequence>
</s:complexType>
<s:complexType name="PictureListRequestHeader">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="AuthCode"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="IpAddr"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="DateTime"
type="s:string" />
</s:sequence>
</s:complexType>
<s:complexType name="PictureListRequestBody">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="DataAreaID"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="DateUpdated"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="TimeUpdated"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1"
name="CurrentPageIndex" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="ItemsOnPage"
type="s:int" />
</s:sequence>
</s:complexType>
</s:schema>
我需要添加一个未定义的参数
$params = new stdClass();
$params->Header = new stdClass();
$params->Header->AuthCode = $this->authcode;
$params->Header->IpAddr = "";
$params->Header->DateTime = "";
$params->Body = new stdClass();
$params->Body->DataAreaID = "hrp";
$params->Body->DateUpdated = "";
$params->Body->TimeUpdated = "";
$params->Body->CurrentPageIndex = 1;
$params->Body->ItemsOnPage = 100;
$params->Body->AdditionalParameter = $value; // <-- undefined in wsdl
但是这样在请求中忽略了参数,它甚至不包含在xml中 是否可以强制soapclient包含并发送我的参数?
答案 0 :(得分:0)
获取WSDL的副本,添加新的参数定义,将其保存在客户端所在的服务器上的某个位置,并将SOAP客户端指向此修改后的WSDL。 但是要警告你发送SOAP请求的服务,可能完全忽略这个参数甚至无法解码XML。