Jump to content

PHP, Soap, and WDSL


GinoCyber

Recommended Posts

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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>

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.