Hi, I have created a simple web service using Php Nusoap. It's working correctly but the only thing missing is to add the default xmlns attribute to the response tag.
Here is the copy of Response :
="1.0"="ISO-8859-1"
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<LoginResponse xmlns="">
<LoginResult>
<register>
<customer>d2ff3b88d34705e01d150c21fa7bde07</customer>
</register>
</LoginResult>
</LoginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here is the code :
<?php
require_once ('nusoap.php');
$ns = 'mynamspace';
$server = new soap_server ();
$server->configureWSDL ( 'testservice', $ns);
$server->wsdl->schemaTargetNamespace = $ns;
$server->wsdl->addComplexType ( 'customer', 'complexType', 'struct', '', '', array ('customer' => array ('name' => 'customer', 'type' => 'xsd:string' ) ) );
$server->wsdl->addComplexType ( 'register', 'complexType', 'struct', '', '', array ('register' => array ('name' => 'register', 'type' => 'tns:customer' ) ) );
$server->wsdl->addComplexType ( 'LoginResult', 'complexType', 'struct', '', '', array ('LoginResult' => array ('name' => 'LoginResult', 'type' => 'tns:register' ) ) );
$server->register ( 'Login',
array ('username' => 'xsd:string', 'password' => 'xsd:string' ),
array ('LoginResult' => 'tns:register' ),
'urn:mynamespace',
'urn:mynamespaceAction',
'document',
'literal',
'Login service for testing' );
function Login($username, $password) {
if (isset ( $username ) && isset ( $password )) {
$hash = md5 ( $username );
return array ('LoginResult' => array ('register' => array ('customer' => $hash ) ));
}
}
$HTTP_RAW_POST_DATA = isset ( $HTTP_RAW_POST_DATA ) ? $HTTP_RAW_POST_DATA : '';
$server->service ( $HTTP_RAW_POST_DATA );
?>
Any help is greatly appreciated.