文件名称:Java调用php的webservice
文件大小:22KB
文件格式:DOC
更新时间:2015-07-05 09:18:43
Java调用php的webservice
Java调用php的webservice: header("Content-Type:text/html;charset=UTF-8"); // require('lib/nusoap.php'); require_once("lib/nusoap.php"); $server = new soap_server(); $server->configureWSDL('hellowsdl', 'urn:hellowsdl'); $server->wsdl->schemaTargetNamespace = 'urn:hellowsdl'; $server->register('hello', // method name array('name' => 'xsd:string'), // input parameters array('return' => 'xsd:string'), // output parameters 'urn:hellowsdl', // namespace 'urn:hellowsdl#hello', // soapaction 'rpc', // style 'encoded', // use 'Says hello to the caller' // documentation ); ... String endpoint = "http://localhost/Service1/WebContent/index.php";//该段就是上面刚将的地址 Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName("hello"); ...