SV: Read the SOAP return
| From: | Jeppe Donslund | Date: | Wed, 25 Apr 2007 06:14:46 +0000 |
| Subject: | SV: Read the SOAP return | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2511@lists.php.net to get a copy of this message | ||
Hi Rob,
Thanks for your reply.
This is my code
// strip slahes to handle magic_quotes_gpc condition
$holdsoap="<?xml version=\"1.0\" encoding=\"utf-8\"?>";
$holdsoap.="<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
$holdsoap.="<soap:Body>";
$holdsoap.="<LogOn xmlns=\"http://tempuri.org/\">";
$holdsoap.="<strUserName>MitUsername</strUserName>";
$holdsoap.="<strPwd>MitPassword</strPwd>";
$holdsoap.="</LogOn>";
$holdsoap.="</soap:Body>";
$holdsoap.="</soap:Envelope>";
$messagesize=strlen($holdsoap);
//print $messagesize;
# create HTTP header
$query = "POST /zoomiowebservice/login.asmx HTTP/1.1\r\n".
"Host: campaigns.emailserver2.com:80\r\n".
"Content-Type: text/xml\r\n". // ". ; charset=UTF-8\r\n".
"Content-length: ".$messagesize."\r\n".
"SOAPAction: http://tempuri.org/LogOn\r\n".
"\r\n";
// print str_replace("\r\n", "<br>", $query);
# Open TCP/IP port
$fp = fsockopen("campaigns.emailserver2.com",80);
if(!$fp) {
print "Failed to connect";
} else {
// print "FP: ".$fp;
#inject the header and soapmessage
fputs($fp, $query, strlen($query));
fputs($fp, $query, "<?xml version='1.0' ?>");
fputs($fp, $holdsoap, $messagesize);
}
# 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?
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: 24. april 2007 21:48
Til: Jeppe Donslund
Cc: soap@lists.php.net
Emne: Re: Read the SOAP return
Hi Jeppe,
Sorry, I don't really understand the issue you are running into.
'What does $fp contain? "some XML" doesn' help much as you could be
referring to an object returned by the soap call, maybe the data type
from a wsdl (if you are using one) declared an anyXML data type and that
is what you are referring to. Probably a little more info and possibly
some code demonstrating what you are trying to do would help.
Rob
Jeppe Donslund wrote:
> Hi,
>
> I use Soap to make a webservice call. The return ($fp) is some XML and
> printed out in a <textarea>. Isn't it possible to print out as ordinary
> text.
>
> I need it some of the xml values for another webservice call.