Advertisement

11.08.2007 at 07:58AM PST, ID: 22947671
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.2

PHP SOAP client returns empty response from Web Service

Asked by mzm_uk07 in PHP Scripting Language

Tags: , , ,

Hi,

I have developed a small web service that takes two arguments and then it performs an XSLT transformation over XML and should return the result to a client which will just display it for the mean while. Although the two arguments are passed successfully to the service but the service returns nil instead of the intended response. I can't see what is the problem!

I know that the XSLT and XML files work properly since I have tested them so many times, and I'm pretty sure the client is fine as well, there is something in the service's code that I don't know why it isn't working as it should!


Here is first my client:
<?php
require_once('nusoap.php');

$wsdl="http:/myserver/AFS/AFS3.php?wsdl";
$client=new soapclient($wsdl, 'wsdl');

$Level="Advanced";
$LP="AL.xml";

$param=array("Level"=>$Level,"LP"=>$LP);

$result=$client->call('Get_Chunks_names', $param);
echo $result;

//for debugging
//Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Error Message</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

?>

Here is my service:

<?php
/**
 * Gets the level and LP location (via Aggregator Service AGS.php)
 * Reads the specific LP to extract the chunks (AL.xml or Java.xml)
 * Sends the Chunks names back to the AGS
 *
 *

 */
 
//Including NuSOAP library
require_once("nusoap.php");

//Defining the namespace for this service (a Distinct URI)
$ns="my server/AFS/AFS_nusoap";

//Instantiating the SOAP server and defining the settings for our WSDL file
$server = new soap_server();
$server->configureWSDL('AdaptionFilterService',$ns);
$server->wsdl->schemaTargetNamespace=$ns;

/** Registering our PHP functions, making the server "aware" of the existence of
*   those method and the values that will pass to and from the method.
*   Different methods are registered independently
*/

$server->register('Get_Chunks_names',
array('Level' =>'xsd:string',"LP"=>'xsd:string'), array('return' => 'xsd:string'),$ns);

function Get_Chunks_names($Level,$LP)
{
      $XSLFile = 'AFS6.xsl';
      $XMLFile = $LP;
      $xsl_params=array('Level'=>$level);
      function XSL_transformation($XMLFile,$XSLFile,$ResultFile,$xsl_params)
       {
      
            $Str = '';

            $xp = xslt_create() or trigger_error('Could not create XSLT process.',E_USER_ERROR);

            xslt_set_encoding($xp, 'ISO-8859-1');

            // read the files into memory
            $xsl_string = join('', file($XSLFile));
            $xml_string = join('', file($XMLFile));

            // set the argument buffer
            $arg_buffer = array('/xml' => $xml_string, '/xsl' => $xsl_string);

            // process the two files to get the desired output
            
                  $Str = xslt_process($xp, 'arg:/xml', 'arg:/xsl', NULL,$arg_buffer, $xsl_params);
                  

                  Saves transformation result into '$ResultFile'
                   $fp = fopen($ResultFile,"w+");
                   fwrite($fp,$Str);
                   fclose($fp);
            
                  
      
               //Free XSLT processor
               xslt_free($xh);

                   return new soapval('return','xsd:string',$ResultFile);
            

       
       
       }//end function2
   } //end of function1

//Invoking the Service
$server->service($HTTP_RAW_POST_DATA);



?>
 

Below is the request and response from soap client:


Request

POST /AFS/AFS3.php HTTP/1.0
Host: bubba.cs.nott.ac.uk
User-Agent: NuSOAP/0.7.2 (1.94)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: "http://bubba.cs.nott.ac.uk/AFS/AFS3.php/Get_Chunks_names"
Content-Length: 663

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://bubba.cs.nott.ac.uk/AFS/AFS_nusoap"><SOAP-ENV:Body><tns:Get_Chunks_names xmlns:tns="http://bubba.cs.nott.ac.uk/AFS/AFS_nusoap"><Level xsi:type="xsd:string">Advanced</Level><LP xsi:type="xsd:string">http://bubba.cs.nott.ac.uk/LPS/AL.xml</LP></tns:Get_Chunks_names></SOAP-ENV:Body></SOAP-ENV:Envelope>



Response


HTTP/1.1 200 OK
Date: Thu, 08 Nov 2007 15:36:20 GMT
Server: Apache/2.0.52 (CentOS)
X-Powered-By: PHP/4.4.7
X-SOAP-Server: NuSOAP/0.7.2 (1.94)
Content-Length: 558
Connection: close
Content-Type: text/xml; charset=ISO-8859-1

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:Get_Chunks_namesResponse xmlns:ns1="http://bubba.cs.nott.ac.uk/AFS/AFS_nusoap"><return xsi:nil="true" xsi:type="xsd:string"/></ns1:Get_Chunks_namesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>



ThanksStart Free Trial
[+][-]11.08.2007 at 11:33AM PST, ID: 20244301

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.09.2007 at 07:26AM PST, ID: 20250090

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.09.2007 at 07:49AM PST, ID: 20250321

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.09.2007 at 03:32PM PST, ID: 20253966

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.12.2007 at 05:06AM PST, ID: 20263594

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.12.2007 at 10:27PM PST, ID: 20269863

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.13.2007 at 06:16AM PST, ID: 20271541

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.13.2007 at 07:51AM PST, ID: 20272319

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.13.2007 at 11:09PM PST, ID: 20278091

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.15.2007 at 09:48AM PST, ID: 20290846

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.16.2007 at 01:29AM PST, ID: 20297031

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 10:37AM PST, ID: 20335708

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.22.2007 at 12:21PM PST, ID: 20336066

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.02.2008 at 07:56AM PST, ID: 20565180

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.10.2008 at 07:25AM PST, ID: 20627748

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.24.2008 at 06:20AM PST, ID: 20733162

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.24.2008 at 06:21AM PST, ID: 20733183

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: php, soap, empty, response
Sign Up Now!
Solution Provided By: mzm_uk07
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080924-EE-VQP-38 / EE_QW_2_20070628