2010-07-20 2 views
0

나는 PHP Nusoap을 사용하여 간단한 웹 서비스를 만들었습니다. 제대로 작동하지만 누락 된 유일한 것은 응답 태그에 기본 xmlns 특성을 추가하는 것입니다.Nusoap - 응답을 위해 빈 xmlns 속성을 수정하십시오.

<?php 

require_once ('nusoap.php'); 
// set namespace 
$ns = 'mynamspace'; 
// set up soap server 
$server = new soap_server(); 
$server->configureWSDL ('testservice', $ns); 
$server->wsdl->schemaTargetNamespace = $ns; 
// define new user data type 


// define results 


$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'))); 

// register Login function 
$server->register ('Login', // method name 
array ('username' => 'xsd:string', 'password' => 'xsd:string'), // input parameters 
array ('LoginResult' => 'tns:register'), // output parameters 
'urn:mynamespace', // namespace 
'urn:mynamespaceAction', // soapaction 
'document', // style 
'literal', // use 
'Login service for testing'); // documentation 


function Login($username, $password) { 
    if (isset ($username) && isset ($password)) { 
     $hash = md5 ($username); 
     return array ('LoginResult' => array ('register' => array ('customer' => $hash))); 

    } 
} 

// 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"?> 
<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> 

코드입니다 : 여기

는 응답의 사본입니다.

답변

1

나는이 특히 우아 주장하지만, 내 경우에는 작동하지 않습니다

내가 nusoap.php의에 가서 (나를 위해 라인 5925)이 줄을 주석 :

// $ elementNS = "xmlns = \"\ ""; 이 후 직접

: 는 경우 ($은 규정 & & $ 사용 == '문자') {

+0

덕분에 많은 리, 나는 동일한 방법을 사용했다. – Rajat

관련 문제