问题:使用php消耗Web服务

问题描述 投票:0回答:1

我正在为此编写一个客户端https://manty-shah.outsystemscloud.com/WebServiceTester/Email.asmx?wsdl

请查看代码:

    <?php

    function test()
    {
        $wsdl   = "https://manty-shah.outsystemscloud.com/WebServiceTester/Email.asmx?wsdl";
        $client = new SoapClient($wsdl, array('trace'=>1));  // The trace param will show you errors stack

        // web service input params
        $request_param = array(
        "MailToBeSent" => "[email protected]");

    try
    {
       $responce_param =  $client->call("MailToBeSent", ['parameters' => $request_param]  );
       echo $responce_param;
    } 
    catch (Exception $e) 
    { 
        echo "<h2>Exception Error!</h2>"; 
        echo $e->getMessage(); 
    }
    }
if(array_key_exists('test',$_POST)){
   test();
}


?>

但是php代码在html的按钮单击上不起作用。请查看下面的html代码:

<form method="post">
    <input type="submit" name="test" id="test" value="RUN" /><br/>
</form>
php url soap webservice-client
1个回答
0
投票
<form method="post" action="/myPHP.php"> <input type="submit" name="test" id="test" value="RUN" /><br/> </form>

没有此属性,您的表单将不知道将其张贴到的位置。

© www.soinside.com 2019 - 2024. All rights reserved.