2014-02-18 58 views
0

我使用敏捷編程在Elastix是底座上的PHP在我的VM潔具調用在PHP(Elastix的)C#Web服務

我想打電話給C#Web服務在Elastix(Elastix的是PHP的基礎) 這是我的C#Web服務,返回的Hello World

using System; 
using System.Collections; 
using System.Linq; 
using System.Web; 
using System.Web.Services; 
using System.Web.Services.Protocols; 
using System.Xml.Linq; 




    /// <summary> 
    /// Summary description for WebService 
    /// </summary> 
    [WebService(Namespace = "http://tempuri.org/")] 
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
    // To allow this Web Service to be called from script, using ASP.NET AJAX,  
    [System.Web.Script.Services.ScriptService] 
public class WebService : System.Web.Services.WebService { 

public WebService() { 

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
} 

[WebMethod] 
public string HelloWorld() { 
    return "Hello World"; 
} 

} 

,在我的VM潔具(Elastix的)我使用:

$res=file_get_contents("http://127.0.0.1:55194/WebSite2/WebService.asmx?op=HelloWorld"); 
$agi->verbose($res); 

但它並沒有表現出任何的事情,我也平127.0.0.1

我想要得到的hello world,在Web服務返回請幫我

+0

我認爲你必須做一個'POST' –

+0

你可以給我一個例子,因爲我沒有使用後 – user3325354

+0

你不需要發佈。 Web服務與vm位於同一臺計算機上,因爲127.0.0.1是環回地址。嘗試使用機器的真實ipaddress。 – Chriseyre2000

回答

0

爲什麼你使用AGI(AGI不ELASTIX,可以是任何語言,包括C#)來訪問Web服務目前尚不清楚。

如果您需要訪問網絡服務,您可以使用功能捲曲在撥號方案

如果需要複雜的動作來完成的 - 你可以用C#編寫AGI。