logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: SOAP WebService not ABLE to return RESULT for > 40 Record
Author
SUNJIB



Joined: 08 Jul 2010
Posts: 8

PostPosted: Tue 03 Aug '10 8:13    Post subject: SOAP WebService not ABLE to return RESULT for > 40 Record Reply with quote

Hi Folks,

Can Anybody help me to figure out why the Webservice is not being able to return more than 40 records Aprox?

I am writing this for a GROWING TABLE, which has twenty thousand records presently.

Is there any Size LIMIT for RESPONSE??

Thanks in Advance

SUNJIB MOHANTY
0955 630 8008

My Code:

soap-client.php
<?php
$client = new SoapClient("catalog.wsdl");
$catalogid=$_GET['catalogid'];
$response = $client->getCatalogEntry($catalogid);
//echo $response;
?>


soap-server.php
<?php
function getCatalogEntry($catalogid)
{
if($catalogid=='3')
{
if(!$dbconnect = mysql_connect('localhost', 'root', 'pass'))
{
echo "Connection failed to the host 'localhost'.";
exit;
} // if
if (!mysql_select_db('test')) {
echo "Cannot connect to database 'test'";
exit;
} // if
else
{

$table_id = 'antibody';
$query = "SELECT * FROM antibody";
$dbresult = mysql_query($query, $dbconnect);

// create a new XML document
$doc = new DomDocument('1.0');
//echo "XML Dome is created";

// create root node
$root = $doc->createElement('root');
$root = $doc->appendChild($root);


while($row = mysql_fetch_array($dbresult, MYSQL_ASSOC))
{
$occ = $doc->createElement($table_id);
$occ = $root->appendChild($occ);
// add a child node for each field
foreach ($row as $fieldname => $fieldvalue)
{
$child = $doc->createElement($fieldname);
$child = $occ->appendChild($child);

$value = $doc->createTextNode($fieldvalue);
$value = $child->appendChild($value);
} // foreach
}

// get completed xml document
$xml_string = $doc->saveXML();
}
return $xml_string;
}
}
//ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer("catalog.wsdl");
$server->addFunction("getCatalogEntry");
$server->handle();
?>


catalog.wsdl
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='Catalog'
targetNamespace='http://example.org/catalog'
xmlns:tns=' http://example.org/catalog '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>

<message name='getCatalogRequest'>
<part name='catalogId' type='xsd:string'/>
</message>
<message name='getCatalogResponse'>
<part name='Result' type='xsd:string'/>
</message>

<portType name='CatalogPortType'>
<operation name='getCatalogEntry'>
<input message='tns:getCatalogRequest'/>
<output message='tns:getCatalogResponse'/>
</operation>
</portType>

<binding name='CatalogBinding' type='tns:CatalogPortType'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getCatalogEntry'>
<soap:operation soapAction='urn:localhost-catalog#getCatalogEntry'/>
<input>
<soap:body use='encoded' namespace='urn:localhost-catalog' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:localhost-catalog' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>

<service name='CatalogService'>
<port name='CatalogPort' binding='CatalogBinding'>
<soap:address location='http://localhost/soap-server.php'/>
</port>
</service>
</definitions>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 03 Aug '10 11:43    Post subject: Reply with quote

Script time out? Did you enable the error log for PHP?

e.g.
php.ini
Code:

error_reporting = E_ALL | E_STRICT
log_errors = On
error_log = "C:\Apache22\logs\php_errors.log"
Back to top
SUNJIB



Joined: 08 Jul 2010
Posts: 8

PostPosted: Wed 04 Aug '10 6:42    Post subject: SOAP WebService not ABLE to return RESULT for > 40 Record Reply with quote

Thanks for your reply, This is in my Error Log

04-Aug-2010 04:23:22] PHP Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\soap-client1.php:31
Stack trace:
#0 [internal function]: SoapClient->__call('getCatalogEntry', Array)
#1 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\soap-client1.php(31): SoapClient->getCatalogEntry('3')
#2 {main}
thrown in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\soap-client1.php on line 31
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Wed 04 Aug '10 11:04    Post subject: Reply with quote

So there is an program error.
Quote:

looks like we got no XML document


Which url do you fetch? Is it the catalog.wsdl or a generated page from php?
Back to top
SUNJIB



Joined: 08 Jul 2010
Posts: 8

PostPosted: Wed 04 Aug '10 17:32    Post subject: Reply with quote

Dear james:

I ping http://serverip/soap-client.php?catalogid=1.

This works perfectly for Aprox 30 records, But what is the issue with more records.

I have added code abhove you can refer.

Please suggest.

Thanks in Advance.
Sunjib
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Wed 04 Aug '10 20:32    Post subject: Reply with quote

As I guessed in my first post Script time out

I can use set_time_limit

e.g.
Code:

set_time_limit(60);
//now the script can run 60 seconds.


Your script seems to be very slow. SELECT * is not a good behaviour. You should only select the fields you need. Do you use indexes in your mysql table?
Back to top
SUNJIB



Joined: 08 Jul 2010
Posts: 8

PostPosted: Thu 05 Aug '10 8:32    Post subject: Reply with quote

Hi James,

Thanks for you Suggestion.

I feel this is not a Timeout Issue, the reason is If I do not RETURN the XML
and simply echo the XML, it works perfectly.

URL For your Referance: This could bring me 400 products presently
http://113.19.86.34/soapTest.php

when I return the XML RESULT SET from the function "getCatalogEntry($catalogid)" in Soap-Server.php to Soap-client.php It through error.

Can I have your email id, I can forward you the web service Files.

Thanks and REgards
SUNJIB
sunjib@rediffmail.com


CoDE for your reference:
$table_id = 'Product';
$query = "select id,CatlogNo,Description,Qty,price,CatId,moreurl from Product";
$dbresult = mysql_query($query, $Conn);

$doc = new DomDocument('1.0');
$root = $doc->createElement('root');
$root = $doc->appendChild($root);

while($row = mysql_fetch_array($dbresult, MYSQL_ASSOC))
{
$occ = $doc->createElement($table_id);
$occ = $root->appendChild($occ);
foreach ($row as $fieldname => $fieldvalue)
{
$child = $doc->createElement($fieldname);
$child = $occ->appendChild($child);

$value = $doc->createTextNode($fieldvalue);
$value = $child->appendChild($value);
}
}

$xml_string = $doc->saveXML();
echo $xml_string;
Back to top
SUNJIB



Joined: 08 Jul 2010
Posts: 8

PostPosted: Fri 06 Aug '10 12:40    Post subject: how to Build XML with the characters like ™ ® Reply with quote

Dear James,

Can you help me how to Build XML with the characters like ™ ®

Example:
Alexa Fluor® Conjugated Antibodies
HeLa QuikChIP™ Sheared Chromatin

Thanks and Regards
Sunjib
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Fri 06 Aug '10 16:38    Post subject: Reply with quote

If you wann use with special character you have to escape them into html or unicode

see http://de.selfhtml.org/html/referenz/zeichen.htm#benannte_iso8859_1
Back to top
SUNJIB



Joined: 08 Jul 2010
Posts: 8

PostPosted: Mon 09 Aug '10 13:29    Post subject: Reply with quote

Dear James:

I could not read the article you sent me. Can you send me the solution in english only.


Can you help me how to Build XML with the characters like ™ ®


Regards
SUNJIB
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Mon 09 Aug '10 20:58    Post subject: Reply with quote

SUNJIB wrote:

I could not read the article you sent me.

You just have to replace the symboles with the html name from the table

e.g

© will be &copy;
TM will be &trade;

There is a php function that can do it for you http://www.php.net/manual/en/function.htmlspecialchars.php
See also

http://www.php.net/manual/en/function.htmlentities.php
Back to top


Reply to topic   Topic: SOAP WebService not ABLE to return RESULT for > 40 Record View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner