在调用wcf服务时在php中的Retun方法中获取错误 [英] Getting Error in Retun method in php while calling wcf service
本文介绍了在调用wcf服务时在php中的Retun方法中获取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
我是网络服务的新手,也是Php,
这里我试图从php(wamp服务器)使用Wcf服务
这是我的PHP代码
Dear all,
I am new to web services and also Php,
Here i am trying to consume the Wcf service from php(wamp server)
this is my php code
<?php
try{
require_once ('lib/nusoap.php');
$client = new SoapClient("http://localhost:51732/Service1.svc?wsdl");
$params = array('value' => '10');
// Call web service PassMember methordd
$webService = $client-> GetData($parms);
$wsResult = $webService->GetDataResult();
print_r($wsResult);
} catch (Exception $e) {
echo 'Caught exception:', $e->getMessage(), "\n";
}
?>
这是我的服务方法
----------------------------- -
this is my method in service
-------------------------------
namespace First
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
}
但我得到了像这样的错误
致命错误:在第14行的C:\ wamp \\\ first.php中调用未定义的方法stdClass :: GetDataResult()< br $> b $ b
所以请帮我解决这个
提前谢谢
but i got the error like this
Fatal error: Call to undefined method stdClass::GetDataResult() in C:\wamp\www\first.php on line 14
So help me to solve this
thanks in advance
推荐答案
client = new SoapClient( http:// localhost:51732 / Service1.svc?wsdl);
client = new SoapClient("http://localhost:51732/Service1.svc?wsdl");
params = array(' value' => ' 10'跨度>);
// 调用Web服务PassMember methordd
params = array('value' => '10'); // Call web service PassMember methordd
webService =
webService =
这篇关于在调用wcf服务时在php中的Retun方法中获取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文