这样设置response回来的信息应该是UTF-8的,e.g. ...... Server: NuSOAP Server v0.6.3 Connection: Close Content-Type: text/xml; charset=UTF-8 ......
呵呵,那代码应该怎么写呢? <?php // Pull in the NuSOAP code require_once('lib/nusoap.php'); // Create the server instance $server = new soap_server(); // Initialize WSDL support $server->configureWSDL('hellowsdl', 'urn:hellowsdl'); // Put the WSDL schema types in the namespace with the tns prefix $server->wsdl->schemaTargetNamespace = 'urn:hellowsdl'; $soap_defencoding = 'UTF-8'; $server->soap_defencoding='utf-8'; // Register the method to expose $server->register('hello', // method name array('name' => 'xsd:string'), // input parameters array('return' => 'xsd:string'), // output parameters 'urn:hellowsdl', // namespace 'urn:hellowsdl#hello', // soapaction // style // use 'Says hello to the caller' // documentation ); // Define the method as a PHP function function hello($name) { return 'Hello, ' . $name; } // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?>这是源码。 <?xml version="1.0" encoding="ISO-8859-1" ?> 这是WSDL中的XML编码。如何变成 <?xml version="1.0" encoding="utf-1" ?>
$soap_defencoding = 'UTF-8';
......
Server: NuSOAP Server v0.6.3
Connection: Close
Content-Type: text/xml; charset=UTF-8
......
<?php
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('hellowsdl', 'urn:hellowsdl');
// Put the WSDL schema types in the namespace with the tns prefix
$server->wsdl->schemaTargetNamespace = 'urn:hellowsdl'; $soap_defencoding = 'UTF-8';
$server->soap_defencoding='utf-8';
// Register the method to expose
$server->register('hello', // method name
array('name' => 'xsd:string'), // input parameters
array('return' => 'xsd:string'), // output parameters
'urn:hellowsdl', // namespace
'urn:hellowsdl#hello', // soapaction
// style
// use
'Says hello to the caller' // documentation
);
// Define the method as a PHP function
function hello($name) {
return 'Hello, ' . $name;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>这是源码。
<?xml version="1.0" encoding="ISO-8859-1" ?>
这是WSDL中的XML编码。如何变成
<?xml version="1.0" encoding="utf-1" ?>
我找了nusoap.php中的serialize()方法
没有发现修改的地方啊?PHP我只学了两天,现在要开发项目,没办法啊
{
$xml = '<?xml version="1.0" encoding="UTF-8"?><definitions';