SV: SV: Read the SOAP return
| From: | Jeppe Donslund | Date: | Wed, 25 Apr 2007 10:47:00 +0000 |
| Subject: | SV: SV: Read the SOAP return | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2516@lists.php.net to get a copy of this message | ||
Hi Rob,
Thank you for your answer. It make sense to me. I'll try what you suggest.
I work with PHP5 so maybe there is an easier way to do the job.
Regards / Med venlig hilsen
Jeppe Donslund
Programmør
Tlf. dir. 7633 8824
Webmasters
Agtrupvej 51
6000 Kolding
Tlf. 7550 8877
jd@webmasters.dk
www.webmasters.dk
-----Oprindelig meddelelse-----
Fra: Rob [mailto:rrichards@ctindustries.net]
Sendt: 25. april 2007 12:22
Til: Jeppe Donslund
Cc: soap@lists.php.net
Emne: Re: SV: Read the SOAP return
Jeppe Donslund wrote:
<snip />
> # Print response
> print "<html><body>";
>
> print "SOAP Response Message<br /><textarea name='resultmessage'
> rows='50' nowrap cols='80'>";
>
> $fp2 = fpassthru($fp);
>
> print "</textarea></form><br><br>\n\n";
>
> It returns "something" and prints it in an textarea. I can't get output else
> where. I guess you are right it is an object, but how do I read this output?
Ok, you are working with raw SOAP messages, which is going to make it
difficult for you anyways if you want only the resulting payload.
Your current problem, however, is not SOAP related but due to how you
are interacting with the server. fpassthru sends the resulting data
directly to the output buffer (so you only get the output within the
text area because that is where you places the fpassthru call). $fp2
will only contain the length of the resulting data. You could change it
to do something like the following to get $fp2 to contain the resulting
data (all of it mind you).
fwrite($fp, $query.$holdsoap); /* instead of the fputs calls */
while (!feof($fd))
$fd2.=fread($fd, 1024);
$fd2 will now contain the entire response (including the headers)
A few recommendations:
if you dont want to worry about transport, the message or parsing XML
- use ext/soap or PEAR SOAP
if you do want control over the above but dont want to deal with parsing
headers
- use PHP streams or CURL
What you pick really is dependent upon what version of PHP you are using.
Rob