473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Nusoap - fix empty xmlns attribute for the response

Expand|Select|Wrap|Line Numbers
  1. Hi, i have created a simple web service using Php Nusoap. its working correctly but the only thing missing is to add the default xmlns attribute to the response tag.
  2.  
  3. Here is the copy of Response : 
  4.  
  5.   <?xml version="1.0" encoding="ISO-8859-1"?>
  6. <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/">
  7.   <SOAP-ENV:Body>
  8.     <LoginResponse xmlns="">
  9.       <LoginResult>
  10.         <register>
  11.           <customer>d2ff3b88d34705e01d150c21fa7bde07</customer>
  12.         </register>
  13.       </LoginResult>
  14.     </LoginResponse>
  15.   </SOAP-ENV:Body>
  16. </SOAP-ENV:Envelope>
  17.  
  18.  
  19. Here is the code :
  20.  
  21. <?php
  22.  
  23. require_once ('nusoap.php');
  24. // set namespace
  25. $ns = 'mynamspace';
  26. // set up soap server
  27. $server = new soap_server ();
  28. $server->configureWSDL ( 'testservice', $ns);
  29. $server->wsdl->schemaTargetNamespace = $ns;
  30. // define new user data type
  31.  
  32.  
  33. // define results
  34.  
  35.  
  36. $server->wsdl->addComplexType ( 'customer', 'complexType', 'struct', '', '', array ('customer' => array ('name' => 'customer', 'type' => 'xsd:string' ) ) );
  37. $server->wsdl->addComplexType ( 'register', 'complexType', 'struct', '', '', array ('register' => array ('name' => 'register', 'type' => 'tns:customer' ) ) );
  38. $server->wsdl->addComplexType ( 'LoginResult', 'complexType', 'struct', '', '', array ('LoginResult' => array ('name' => 'LoginResult', 'type' => 'tns:register' ) ) );
  39.  
  40. // register Login function
  41. $server->register ( 'Login', // method name
  42. array ('username' => 'xsd:string', 'password' => 'xsd:string' ), // input parameters
  43. array ('LoginResult' => 'tns:register' ), // output parameters
  44. 'urn:mynamespace', // namespace
  45. 'urn:mynamespaceAction', // soapaction
  46. 'document', // style
  47. 'literal', // use
  48. 'Login service for testing' ); // documentation
  49.  
  50.  
  51. function Login($username, $password) {
  52.     if (isset ( $username ) && isset ( $password )) {
  53.         $hash = md5 ( $username );
  54.         return array ('LoginResult' => array ('register' => array ('customer' => $hash ) ));
  55.  
  56.     } 
  57. }
  58.  
  59. // Use the request to (try to) invoke the service
  60. $HTTP_RAW_POST_DATA = isset ( $HTTP_RAW_POST_DATA ) ? $HTTP_RAW_POST_DATA : '';
  61. $server->service ( $HTTP_RAW_POST_DATA );
  62. ?>
  63.  
Jul 20 '10 #1
0 1739

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hyunchan Kim | last post by:
To indent xml file, I made an instance of Transformer from Templates using following. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
1
by: Michael TEpperis | last post by:
hello, my xml files starts with +++++++ <?xml version='1.0' encoding='utf-8' ?> <?integrity app='Visio' version='10.0' buildnum='525' metric='1'...
4
by: David S. Alexander | last post by:
I am trying to transform XML to XML using an XSLT in C#, but the root node of my XML is not being matched by the XSLT if it has an xmlns attribute. Am I handling my namespaces incorrectly? My C#...
0
by: Ewan Fairweather | last post by:
Hi, I'm generating the below XML in c# for an asp.net application When i've generated this XML the <LaboratoryDetails xmlns=""> element has a blank xmlns set. How do i either a) remove this...
1
by: Ewan Fairweather | last post by:
Hi, I'm generating the below XML in c# for an asp.net application When i've generated this XML the <LaboratoryDetails xmlns=""> element has a blank xmlns set. How do i either a) remove this...
6
by: fzhang | last post by:
I am relatively new to XML and C#. So, forgive me if this question is too newbie. :-) While assuming this is an easy programming task, I couldn't find a single reference anywhere for how to do...
3
by: =?Utf-8?B?R3JlZw==?= | last post by:
If I have an XmlDocument with a deep hierarchy of nodes, with a documentElement having an attribute xmlns="http://someurl.com" and all children inheriting that namespace (but not having the xmlns...
4
by: =?Utf-8?B?UmFqaXY=?= | last post by:
Hi, I have a webservices(developed in .net 2.0, using c#) with a webmethod that returns a XML document. The problem is that the XML returned from the webservice is having a attribute xmlns="" in...
1
by: C.W.Holeman II | last post by:
I have an xmlns attribute that produces an XHTML validation error and I do not understand why it is considered an error.The file displays as expected on Firefox and IE7. ...
1
by: Amit | last post by:
Suppose I am having this input xml:<Event><Test></Test><Result Value="true"><Request xmlns='http://tempuri.org/AtoB.xsd' RequestID="" MessageID=""...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.