GinoCyber Posted September 2, 2010 Share Posted September 2, 2010 HI everyone, I am trying to write a simple php page using an sdk. The SDK api contains all wsdl files which do all the work. There's a soap.php which has all the functions and stores the output in $response. My php page includes soap.php and a function. The function is handled by soap.php and it will get the date from the appropriate wdsl file and store it in $response. It is stored in xml format using utf-16. If I run my php page frmo console, I get the output fine. If I run it from a browser, the page is empty but if I "view source", the date is there. What do I need to do in my php page to get $response actually displayed in a browser. Thanks Gino Quote Link to comment https://forums.phpfreaks.com/topic/212384-php-soap-and-wdsl/ Share on other sites More sharing options...
samshel Posted September 2, 2010 Share Posted September 2, 2010 Well !! to start with posting some code or at least complete contents of the "view source" would help Quote Link to comment https://forums.phpfreaks.com/topic/212384-php-soap-and-wdsl/#findComment-1106619 Share on other sites More sharing options...
GinoCyber Posted September 3, 2010 Author Share Posted September 3, 2010 The return data that appears in the browsers "view source" and also when I run the php page in console is: <?xml version="1.0" encoding="utf-16"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > . . .bunch of data . . </response></soap:Body></soap:Envelope> My php page is literally 2 lines: include /path to soaplib.php; function(1,1) Soaplib will take the 1,1 parameters, make the calculations and send it to the appropriate wdsl file. WDSL will take the calculations, insert it into an array and then sends it back to soaplib. Soaplib will then put the data in $response where it finishes off it's function with print $response. And that is what is being shown in the view source. Quote Link to comment https://forums.phpfreaks.com/topic/212384-php-soap-and-wdsl/#findComment-1106665 Share on other sites More sharing options...
samshel Posted September 3, 2010 Share Posted September 3, 2010 This is XML output, if you see on console, you see whatever the response is. however in browser, it will try to parse the content as HTML. As the XML you are getting in response cannot be parse as HTML, it is not displaying in browser. Is the function(1,1) returning you this XML ? If yes, you can try catching that response in a string: $str = function(1,1); Add HTML tags: $str = "<HTML><BODY>".htmlentities($str)."</BODY></HTML>"; echo $str; This will display the complete XML. Quote Link to comment https://forums.phpfreaks.com/topic/212384-php-soap-and-wdsl/#findComment-1106959 Share on other sites More sharing options...
GinoCyber Posted September 6, 2010 Author Share Posted September 6, 2010 Thanks. That worked. Quote Link to comment https://forums.phpfreaks.com/topic/212384-php-soap-and-wdsl/#findComment-1107895 Share on other sites More sharing options...
GinoCyber Posted September 6, 2010 Author Share Posted September 6, 2010 One for question. How would I parse for the section -> information="info_2" I've read a few articles on xml name spaces and none have helped. <?xml version="1.0" encoding="utf-16"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://nowhere.com/wsdl"><soap:Body><response status="complete" version="46" resource_type="data_1" ns="username" op_type="get_data"> <data_1 id="ID 1" information="info_2"/> /response></soap:Body></soap:Envelope> ?> Quote Link to comment https://forums.phpfreaks.com/topic/212384-php-soap-and-wdsl/#findComment-1107981 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.