【问题标题】:WSClient won't see my WSDL fileWSClient 不会看到我的 WSDL 文件
【发布时间】:2014-08-06 10:31:03
【问题描述】:

在尝试关注 PHP 框架的 wso2 wsf 演示时,我似乎无法运行几个示例脚本,即使我已经编译并安装了 wso2/wsf .so 文件和所有内容.

具体来说,在尝试运行 WSDL 的示例脚本时,我得到了错误:

Warning: WSClient::getProxy(wsf_wsdl.php): failed to open stream: No such file or directory in /vagrant/public/test.php on line 8

运行此代码时:

try {

    $client = new WSClient(array("wsdl"=>"http://localhost:8888/samples/wsdl_mode/sample_wsdl_11.wsdl",
                                 ));

    $proxy = $client->getProxy();

    $return_val =  $proxy->QueryPurchaseOrder(array("productName"=> "Testing",
                                             "quantity" => 234,
                                             "date" => "2003-12-34",
                                             "orderNo" => 345));

    printf("<strong>Shipping address </strong><br/>");
    printf("Name : %s <br/>", $return_val["shipTo"]["name"]);
    printf("Street : %s <br/>", $return_val["shipTo"]["street"]);
    printf("City : %s <br/>", $return_val["shipTo"]["city"]);
    printf("State : %s <br/>", $return_val["shipTo"]["state"]);
    printf("Zip : %s <br/>", $return_val["shipTo"]["zip"]);

    printf("<br/><strong>Billing address </strong><br/>");
    printf("Name : %s <br/>", $return_val["billTo"]["name"]);
    printf("Street : %s <br/>", $return_val["billTo"]["street"]);
    printf("City : %s <br/>", $return_val["billTo"]["city"]);
    printf("State : %s <br/>", $return_val["billTo"]["state"]);
    printf("Zip : %s <br/>", $return_val["billTo"]["zip"]);

    printf("<br/><strong>Product info </strong><br/>");
    printf("Product ID : %s <br/>", $return_val["product"]["productId"]);
    printf("ShippingDate : %s <br/>", $return_val["product"]["shippingDate"]);
    printf("Status : %s <br/>", $return_val["product"]["status"]);

} catch (Exception $e) {

    printf("Message = %s\n",$e->getMessage());
}

文件确实存在;当我在浏览器中运行它时,我得到了 .wsdl 文件本身,但是 WSClient 似乎不喜欢它。

【问题讨论】:

    标签: php soap wsdl wso2 wsh


    【解决方案1】:

    这是因为您没有在 php.ini 文件中包含 WSO2 脚本。脚本应该在扩展包中分发(应该有scripts 目录)。将该目录保存在您的情况下有意义的位置(在您的系统中或项目中的某处,这取决于您),然后将该目录的路径放入您的 php.ini 文件中,如下所示:

    include_path = "/path/to/wso2/scripts"
    

    最终,您可以将 wso2 脚本目录放在您的 php 包含目录中。在任何情况下你都应该重启 apache 服务,例如:

    sudo service apache2 restart
    

    它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多