php 調用 java webservice

Java中的網站推廣Webservice方法:php

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;
}sql

 

PHP調用Webservice方法:網站

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

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

} else {
echo " 錯誤 :",$err;
}.net

?>code

 

其中:blog

'uri'是namespace。get

'arg0'是默認參數名,不能改。class

Java網站推廣方法的參數必須是Object類型。(fblww-0312)

相關文章
相關標籤/搜索