怎样通过soap 得到对方传到web service 上的参数值?
解决方案 »
- zencart中 function get_template_dir 求解释
- 求网校系统源代码
- DISCUZ ubb编辑器有分离出来的吗?
- 我的php验证码出现这样的问题:Image corrupt or truncated
- 关于用户发表文章宽度问题。我在线等。
- 帮我看下这ARRAY哪里错了
- 寻成熟可用的php语言的OA系统(或工作流系统)
- 想做个网址导航,请问这种风格的导航是用的什么模板?有现成的CMS吗?
- PHP7 下,使用MongoDB API,求助
- php 的加密规则咋写 求帮忙啊。。
- NuSoap调用C#的WCF时,使用string[]类型参数的问题
- [求助], 有没有php获取POP3邮件的内容和附件的控件,
也是用$_GET或者$_POST来获取
现在6就要出来了。你看看可否考虑用6来做SERVER端,在这方面。NET确实比PHP要强些!纯个人浅见!
function InterfaceName($params)
{
//$params里面是参数,类型是对象//这样就可以看到参数,die不可少.
var_dump($params);die;
}
客户端的话,你拼一个XML字串,通过post发过去就行了.XML字串的格式,可以用软件soapui看。
$client = new SoapClient("http://www.xxx.com/service/service.asmx?WSDL");
$param=array();
$arr = $client->__soapCall('ServiceMethod',array('parameters' => $param));
print_r($arr);这是先传值 ,然后得到返回值 。
我现在的操作是和它相反的
function add($a, $b) {
return $a + $b;
}$server = new SoapServer(null, array('uri'=>'http://127.0.0.1'));
$server->addFunction("add");
$server->handle();
客户端$client = new SoapClient ( null,
array ('uri' => 'http://127.0.0.1', 'location' => 'http://127.0.0.1/soap/hello.php', 'trace'=>true) );
echo $client->add ( 3, 4 );
客户端传来的数据被 SoapServer 自动分配给了调用的方法
{
return "abc".$str;
}$sv = new SoapServer(null,array('uri'=>'http://soap.test.test/'));
$sv->addFunction('getTime');
$sv->addFunction(SOAP_FUNCTIONS_ALL);
$sv->handle();
?>client.php<?php
try
{
$opts = array('location'=>'http://localhost/server.php','uri'=>'http://soap.test.test/');
$client = new SoapClient(null, $opts);
$str = "abcdedf";
$data = $client->getTime($str);
echo $data;
}
catch (SOAPFault $e)
{
echo "Fault! code:",$e;
}
?>