PHP调用本地.NET Web服务

时间:2011-08-01 17:23:13

标签: php asp.net web-services

我现在正在本地做所有这些测试目的。我在visual studio中运行了服务项目并使用本地版本的站点设置来调用Web服务,但它不会命中它。

这是电话:

$client = new SoapClient(null, array('location' => "https://localhost:51063/Service1.asmx", 'uri' => 'http://localhost:51063/'));
$client->newMeeting(array('id' => '10000', 'location' => 'test', 'committee' => 'test', 'desc' => 'test', 'date' => '2011-08-01', 'duration' => '180', 'agenda' => '', 'notes' => '', 'agenda' => '', 'notes' => ''));

使用它我得到了这个错误:

Uncaught SoapFault
Could not connect to host

Trace in execution order:

Dispatcher→dispatch(null, 'page')  on line 98 in C:\xampp\htdocs\narca\admin\index.php
   Dispatcher→executeAction('plugin', 'committees', array[1])  on line 162 in C:\xampp\htdocs\narca\frog\Framework.php
      PluginController→execute('committees', array[1])  on line 247 in C:\xampp\htdocs\narca\frog\Framework.php
         call_user_func_array(array[2], array[0])  on line 84 in C:\xampp\htdocs\narca\frog\app\controllers\PluginController.php
            CommitteesController→addevent()  on line unknown in unknown
               SoapClient→newMeeting(array[8])  on line 429 in C:\xampp\htdocs\narca\frog\plugins\committees\CommitteesController.php
                  SoapClient→__call('newMeeting', array[1])  on line unknown in unknown
                     SoapClient→__doRequest('<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:...', 'https://localhost:51063/Service1.asmx', 'http://localhost:51063/#newMeeting', 1, 0)  on line unknown in unknown

如果我试着这样称呼它:

$client = new SoapClient("https://localhost:51063/Service1.asmx?WSDL");

我得到了一个不同的错误:

Uncaught SoapFault
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://97.67.111.2:51063/Service1.asmx?WSDL' : failed to load external entity "http://97.67.111.2:51063/Service1.asmx?WSDL"

Trace in execution order:

Dispatcher→dispatch(null, 'page')  on line 98 in /mnt/stor2-wc1-dfw1/410993/410996/lab.narca.org/web/content/admin/index.php
   Dispatcher→executeAction('plugin', 'committees', array[1])  on line 162 in /mnt/stor2-wc1-dfw1/410993/410996/lab.narca.org/web/content/frog/Framework.php
      PluginController→execute('committees', array[1])  on line 247 in /mnt/stor2-wc1-dfw1/410993/410996/lab.narca.org/web/content/frog/Framework.php
         call_user_func_array(array[2], array[0])  on line 84 in /mnt/stor2-wc1-dfw1/410993/410996/lab.narca.org/web/content/frog/app/controllers/PluginController.php
            CommitteesController→addevent()  on line unknown in unknown
               SoapClient→SoapClient('http://97.67.111.2:51063/Service1.asmx?WSDL')  on line 423 in /mnt/stor2-wc1-dfw1/410993/410996/lab.narca.org/web/content/frog/plugins/committees/CommitteesController.php

这种设置是否可行?或者有什么方法可以让实时网站点击我的本地服务?

1 个答案:

答案 0 :(得分:0)

您可以使用curl或类似的东西从PHP服务器上获取该URL吗?是否有某个阻止那些高编号邮件请求的防火墙?你的PHP看起来很好,所以我不认为你在那里做错了什么。