Re: [SOAP] Performance issue

From: Date: Wed, 27 Nov 2002 17:56:46 +0000
Subject: Re: [SOAP] Performance issue
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-318@lists.php.net to get a copy of this message
I've talked about this few times on this list. I used it for my thesis for BSc in CS. You will note that it is experimental and alpha quality (as noted by the author) but I find it quite stable for my needs. I used it for 2 months. Found some bugs which are fixed. The only problem that persist is the transport of cyrillic symbols. The module crashes. Regarding performance I can say that it is very fast. 3 times faster than the simpler protocol XMLRPC as implemented in the php's xmlrpc extension. Test against SOAP4x using an example from it's distribution showed that phpsoap is 30x faster than it. This benchmark is done on simple Hello World remote procedure. To build the phpsoap extension you have to have domxml extension built. If you are developing under windows it is easy to start with this extension because it has binary files built for this platform Andrey ----- Original Message ----- From: "Paul Faulkner" <paul.faulkner@wcom.com> To: "Andrey Hristov" <andrey@webgate.bg> Sent: Wednesday, November 27, 2002 7:48 PM Subject: RE: [SOAP] Performance issue > Are you using it? What performance you seeing from it? > > Paul Faulkner > Worldcom > paul.faulkner@wcom.com > IM: PF 2004 > > -----Original Message----- > From: Andrey Hristov [mailto:andrey@webgate.bg] > Sent: Wednesday, November 27, 2002 10:45 AM > To: Paul Faulkner; soap@lists.php.net > Subject: Re: [SOAP] Performance issue > > > Hi, > You probably use SOAP4x/NuSOAP/ PEAR > all have same roots. > Have you tried PECL::SOAP > you can find it in pecl or on sf.net - look for "php soap", the first hit > has to be > a project ot "rodif_bl". Get version 0.1.2 and try it. > > Andrey > > ----- Original Message ----- > From: "Paul Faulkner" <paul.faulkner@wcom.com> > To: <soap@lists.php.net> > Sent: Wednesday, November 27, 2002 12:26 AM > Subject: [SOAP] Performance issue > > > > I wrote a simple PHP/SOAP application and send SOAP messages to my Web > > Service. I see my web-service accept the message, process it and respond. > > This all happens in less than a second, but for some reason my php soap > > client takes another 60 seconds to parse through the message. Even if > just > > use fpassthru($socket) it still takes about the same amount of time. > > > > Anyone know what could cause the delay? I've included my complete code > for > > my client app. > > > > > > Thanks for any input/feedback. > > > > Paul Faulkner > > > > > > > > <TITLE>Testing SOAP and PHP</TITLE> > > <?php > > > > /* XML functions */ > > function CreateParser() > > { > > $xmlParser = xml_parser_create(); > > if ( $xmlParser == false ) { > > die( 'Cannot create an XML parser handle.' ); > > } > > return $xmlParser; > > } > > > > > > function SetOptions( $xmlParser ) > > { > > xml_parser_set_option( $xmlParser, XML_OPTION_CASE_FOLDING, false ); > > } > > > > > > function SetHandlers( $xmlParser ) > > { > > xml_set_element_handler( $xmlParser, 'HandleBeginTag', > > 'HandleEndTag' ); > > xml_set_character_data_handler( $xmlParser, 'HandleCharacterData' ); > > } > > > > > > function OpenFile( $fileName ) > > { > > if ( !( $fp = fopen( $fileName, 'r' ) ) ) { > > die( 'Cannot open the XML file: ' . $fileName ); > > } > > return $fp; > > } > > > > > > function Parse( $xmlParser, $fp ) > > { > > $parsedOkay = xml_parse( $xmlParser, $fp); > > if ( !$parsedOkay && > > xml_get_error_code( $xmlParser ) != XML_ERROR_NONE ) > > { > > die( 'XmlParse error: ' . > > xml_error_string( xml_get_error_code( $xmlParser ) ) . > > ' at line ' . > > xml_get_current_line_number( $xmlParser ) ); > > } > > /* > > while ( $data = fread( $fp, 4096 ) ) { > > $parsedOkay = xml_parse( $xmlParser, $data, feof( $fp ) ); > > > > if ( !$parsedOkay && > > xml_get_error_code( $xmlParser ) != XML_ERROR_NONE ) { > > die( 'XmlParse error: ' . > > xml_error_string( xml_get_error_code( $xmlParser ) ) . > > ' at line ' . > > xml_get_current_line_number( $xmlParser ) ); > > } > > } > > */ > > } > > > > > > function FreeParser( $xmlParser ) > > { > > $freedOkay = xml_parser_free( $xmlParser ); > > if( !$freedOkay ) { > > die( 'You did not pass a proper XML Parser to this function.' ); > > } > > } > > > > function HandleBeginTag($parser, $name, $attribs) > > { > > $GLOBALS['currentTag'] = $name; > > > > switch($name) > > { > > case "Response": > > /*print ("I am at <Response>");*/ > > break; > > default: > > /*print ("At $name tag");*/ > > } > > } > > > > function HandleEndTag($parser, $name) > > { > > > > } > > > > > > function HandleCharacterData( $parser, $data ) > > { > > global $currentTag; > > > > switch( $currentTag ) > > { > > case 'Response': > > appendToGlobal( $currentTag, $data ); > > break; > > } > > } > > > > > > function AppendToGlobal( $variableName, $value ) > > { > > global ${$variableName}; > > ${$variableName} .= $value; > > ${$variableName} = trim(${$variableName}); > > echo "dummy=xyz&message=". ${$variableName}; > > } > > > > > > /* MAIN APPLICATION */ > > $xmlParser = CreateParser(); > > SetOptions( $xmlParser ); > > SetHandlers( $xmlParser ); > > > > > > $soapmessage = <<<MYSOAPMESSAGE > > <SOAP-ENV:Envelope > > > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > > > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > > > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"> > > > > <SOAP-ENV:Body> > > > > <ns1:getTemp xmlns:ns1="urn:xmethods-Temperature" > > > > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> > > <REGISTRYMSG><FIELD1>abcde</FIELD1></REGISTRYMSG> > > </ns1:getTemp> > > > > </SOAP-ENV:Body> > > > > </SOAP-ENV:Envelope> > > MYSOAPMESSAGE; > > > > /* Strip escape slashes to handle magic_quotes_gpc condition */ > > $holdsoap=stripslashes($soapmessage); > > $messagesize=strlen($holdsoap); > > > > /* Create HTTP header */ > > $query="POST ". > > "/jaxm-serverapp/receiver". > > " HTTP/1.1\r\n". > > "Host: ". $_GET['servicehost']. > > ":". > > $_GET['serviceport']. > > "\r\n". > > "Content-Type: text/xml; charset=UTF-8". > > " \r\n". > > "Content-Length:$messagesize\r\n". > > "SOAPAction:". > > "\r\n". > > "\r\n"; > > > > /* Open a tcp/ip port */ > > $fp=fsockopen($_GET['servicehost'],$_GET['serviceport']); > > > > if(!$fp) > > { > > print "Unable to connect to web service !"; > > } > > else > > { > > /* Inject the header and the soap message which was supplied by the form > */ > > fputs($fp,$query,strlen($query)); > > fputs($fp,$query,"<?xml version='1.0'?>"); > > fputs($fp,$holdsoap,$messagesize); > > } > > > > > > /* Print out SOAP server Response to a web form */ > > /*print "<html><body>"; > > > > print "<br>"; > > > > print $query; > > print "<br>"; > > print "my soap message"; > > print "<br>"; > > print $soapmessage; > > > > print "<form>"; > > > > print "SOAP Response Message<br/><textarea name='resultmessage' rows='30' > > nowrap cols='80'>"; > > */ > > > > $idx = 0; > > $result = ""; > > $resultPartial = " "; > > > > while(!feof($fp)) > > { > > $resultLine = fgets($fp, 128); > > > > if ($resultPartial != "<?xml") > > { > > $resultPartial = substr($resultLine, 0, 5); > > } > > > > if ($resultPartial == "<?xml") > > { > > $result .= $resultLine; > > } > > } > > /* > > print "Checking Result Array"; > > if (isset($result)) > > { > > print $result; > > } > > else > > { > > print "NOT SET"; > > } > > print "==================="; > > */ > > /*echo fpassthru($fp);*/ > > /* > > $http_response = fpassthru($fp); > > print $http_response; > > if (isset($http_response)) > > { > > list($http_headers, $http_content) = explode("\r\n\r\n",$http_response); > > } > > else > > { > > print "NOT SET"; > > } > > > > print "---"; > > print $http_content; > > print "---"; > > */ > > > > Parse( $xmlParser, $result ); > > FreeParser( $xmlParser ); > > > > /* > > print "</textarea></form></body></html>"; > > */ > > /*echo "firstName=abc&message=$temp";*/ > > > > > > > > ?> > > > > > > > > -- > > PHP Soap Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.soap (#318) next »