Home  >  Article  >  php教程  >  php 调用 java webservice

php 调用 java webservice

WBOY
WBOYOriginal
2016-06-13 10:48:231084browse

Java中的网站推广Webservice方法:

public String findCode(Object code) {
ElementNSImpl ens = (ElementNSImpl)code;
String num = ens.getTextContent();
System.out.println(code);
SqlSearch sqlSearch = new SqlSearch();
String result = sqlSearch.findCode(String.valueOf(num));
sqlSearch = null;
return result;
}

 

PHP调用Webservice方法:

require_once("lib/nusoap.php");
$client = new soapclient('http://192.168.0.108:8080/data/DataPort?wsdl',array('uri'=>'http://ws.data.com/'));

$str=$client->call("findCode",array("arg0"=>"123456"));
if (!$err=$client->getError()) {
echo " 程序返回 :",print_r(array_count_values($str));

} else {
echo " 错误 :",$err;
}

?>

 

其中:

'uri'是namespace。

'arg0'是默认参数名,不能改。

Java网站推广方法的参数必须是Object类型。(fblww-0312) 


摘自  网络营销
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn