我有一個在asp.net中創建並在iis 5.1中發佈的web服務。現在我想從php環境中調用這個web服務。其實我的Web服務獲取一個字符串作爲參數,並返回相同的字符串。但始終,返回的字符串是空的或null.I無法發送字符串值從PHP到asp.net的Web服務...如何從PHP調用我的asp.net web服務?
這在asp.net
namespace PRS_WS
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class prs_point : System.Web.Services.WebService
{
[WebMethod]
public string testAssignment(string inputData)
{
return inputData;
}
}
}
而創建我的web服務,這是我調用上述asp.net web服務的PHP代碼...
<?php
require_once('nusoap/lib/nusoap.php');
$wsdl="http://localhost/prs_point/prs_point.asmx?WSDL";
$str1="";
$str1="Hello from php";
$client = new soapclient($wsdl,'wsdl');
$result=$client->call('testAssignment',$str1);
foreach($result as $key => $value)
{
echo "<br/>Response ::::: $value";
}
?>
我不知道是否需要在PHP端或asp.net端進行更改?...請指導我解決這個問題...
謝謝你,Saravanan。 – PhatHV 2014-06-23 07:44:18