Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中使用soap将参数发送到wsdl文件_Php_Soap_Wsdl_Soap Client - Fatal编程技术网

如何在php中使用soap将参数发送到wsdl文件

如何在php中使用soap将参数发送到wsdl文件,php,soap,wsdl,soap-client,Php,Soap,Wsdl,Soap Client,我有一个带有位置的wsdl文件,我想通过soap发送请求值,我正在尝试下面的场景。但它并没有调用wsdl函数。请帮助我如何发送soap请求参数 <xs:complexType name="wsNotification"> <xs:sequence> <xs:element maxOccurs="unbounded" minOccurs="0" name="notificationList" nillable="true" type="tns:notificat

我有一个带有位置的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>";
$client=新的SoapClient(“http://192.100.1.8:8080/getAPI/ws/WSNotification?wsdl", 
数组('email'=>“test@gmail.com",
“电话”=>“97122555”)
);
回显“响应:\n”$客户端->\uu getLastResponse()。“
”;

调用上述soap函数时,我没有从wsdl得到任何响应。请帮助我如何将参数从php发送到soap。

不确定您是否已经有了答案。但之前我使用了

  • 下载包并将文件放在项目文件夹中
  • 在代码中包含该库

    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);
    
    }
    }
    
    $client=新的nusoap\u客户端('http://192.100.1.8:8080/getAPI/ws/WSNotification?wsdl“,”wsdl“);
    $login=array('email'=>'test@gmail.com“,”电话“=>”97122555“;
    $response=$client->call('notificationsParam',array('parameters'=>$login));
    如果($client->fault){
    回声“故障”;
    打印(回复);
    回声';
    }否则{
    $err=$client->getError();
    如果($err){
    回显“错误”。$err.';
    }否则{
    打印(回复);
    }
    }