[英]How to send parameters to wsdl file using soap in php
我有一個帶位置的wsdl文件,我想通過soap發送請求值,我正在嘗試以下情況。 但是它沒有調用wsdl函數。 請幫助我如何發送soap請求參數。
<xs:complexType name="wsNotification">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="notificationList" nillable="true" type="tns:notificationsParam"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="notificationsParam">
<xs:sequence>
<xs:element minOccurs="0" name="email" type="xs:string"/>
<xs:element minOccurs="0" name="phone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
下面的代碼我在PHP中使用soap函數調用wsdl
$client = new SoapClient("http://192.100.1.8:8080/getAPI/ws/WSNotification?wsdl",
array('email' => "test@gmail.com",
'phone' => "97122555")
);
echo "Response:\n" . $client->__getLastResponse() . "<br>";
當我調用上述soap函數時,我沒有從wsdl得到任何響應。 請幫助我如何將參數從php發送到soap。
不知道您是否已經對此有了答案。 但是以前我使用nusoap工具包來實現這一目標。
將庫包含在您的代碼中
require_once('lib / nusoap.php');
寫你的代碼
查看您的xml可以解決問題
$client=new nusoap_client('http://192.100.1.8:8080/getAPI/ws/WSNotification?wsdl', 'wsdl');
$login=array('email'=>'test@gmail.com', 'phone'=>'97122555');
$response= $client->call('notificationsParam', array('parameters' => $login));
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($response);
echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
print_r($response);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.