binding.soap dont work in server Linux

View: New views
6 Messages — Rating Filter:   Alert me  

binding.soap dont work in server Linux

by Valverde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi!

The code below works fine in Apache+Windows but don't work in Apache
+linux

//Result.php
<?php
require 'SCA/SCA.php';

/**
 * @service
 * @binding.soap
 */
class Result
{
        /**
         *
         * @param string $input
         * @return string $output
         */
        function getResult($input)
        {
          return "Result: $input";
        }
}
?>

// client.php
<?php

$service = new SoapClient('http://localhost/Result.php?wsdl');


try
{
        $return = $service->getResult('test');

        echo "<pre>";
        echo  var_dump($return);
        echo "</pre>";
}
catch (SoapFault $soapFault)
{
    echo "<pre>";
    echo  var_dump($soapFault);
    echo "</pre>";

    echo "Request :<br>";
    echo "<pre>";
    echo  print_r(htmlentities($service->__getLastRequest()));
    echo "</pre>";

    echo "Response :<br>";
    echo "<pre>";
    echo  print_r(htmlentities($service->__getLastResponse()));
    echo "</pre>";
}
?>

the errors are:
public 'faultstring' => string 'Bad Request' (length=11)
  public 'faultcode' => string 'SOAP-ENV:Client' (length=15)
Anyone help me?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "phpsoa" group.
To post to this group, send email to phpsoa@...
To unsubscribe from this group, send email to phpsoa-unsubscribe@...
For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: binding.soap dont work in server Linux

by Matthew Peters-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Sorry to hear you are having difficulties. I just tried out the
samples you supplied below and they *do* work for me on Linux so let's
begin by comparing versions.

I am running on Red Hat Linux and PHP 5.2.3. Here is the start of the
output from php -i

phpinfo()
PHP Version => 5.2.3

System => Linux localhost.localdomain 2.4.21-20.EL #1 Wed Aug 18
20:58:25 EDT 2004 i686
Build Date => Jun 20 2007 08:17:41
Configure Command =>  './configure' '--enable-soap' '--with-openssl'
'--with-xmlrpc' '--with-zlib'

What level of php and what level of SCA_SDO are you on?

Matthew


On 4 Mar, 20:05, Valverde <valverde.marc...@...> wrote:

> Hi!
>
> The code below works fine in Apache+Windows but don't work in Apache
> +linux
>
> //Result.php
> <?php
> require 'SCA/SCA.php';
>
> /**
>  * @service
>  * @binding.soap
>  */
> class Result
> {
>         /**
>          *
>          * @param string $input
>          * @return string $output
>          */
>         function getResult($input)
>         {
>                 return "Result: $input";
>         }}
>
> ?>
>
> // client.php
> <?php
>
> $service = new SoapClient('http://localhost/Result.php?wsdl');
>
> try
> {
>         $return = $service->getResult('test');
>
>         echo "<pre>";
>         echo  var_dump($return);
>         echo "</pre>";}
>
> catch (SoapFault $soapFault)
> {
>     echo "<pre>";
>     echo  var_dump($soapFault);
>     echo "</pre>";
>
>     echo "Request :<br>";
>     echo "<pre>";
>     echo  print_r(htmlentities($service->__getLastRequest()));
>     echo "</pre>";
>
>     echo "Response :<br>";
>     echo "<pre>";
>     echo  print_r(htmlentities($service->__getLastResponse()));
>     echo "</pre>";}
>
> ?>
>
> the errors are:
> public 'faultstring' => string 'Bad Request' (length=11)
>   public 'faultcode' => string 'SOAP-ENV:Client' (length=15)
> Anyone help me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "phpsoa" group.
To post to this group, send email to phpsoa@...
To unsubscribe from this group, send email to phpsoa-unsubscribe@...
For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: binding.soap dont work in server Linux

by Valverde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I think that my problem is with HTTP_RAW_POST_DATA.
I tried to create a pure server and client with native soap functions
and then didn't work too.
But when I put this code below to create the server and works fine!!!

<?php
if(!$HTTP_RAW_POST_DATA)
{
   $HTTP_RAW_POST_DATA = file("php://input");
}

function getCliente{.....}

$server = new SoapServer("loja.wsdl");
$server->addFunction("getCliente");
$server->handle($HTTP_RAW_POST_DATA);
?>

I still don't try this procedure with SCA. When i do this, i put this
results here...
I'm expert in PHP and newcomer in SCA_SDO.

Sorry for my bad english, i am from Brasil.
Thanks

On 10 Mar, 14:13, Matthew Peters <matthew.f.pet...@...>
wrote:

> Sorry to hear you are having difficulties. I just tried out the
> samples you supplied below and they *do* work for me on Linux so let's
> begin by comparing versions.
>
> I am running on Red Hat Linux and PHP 5.2.3. Here is the start of the
> output from php -i
>
> phpinfo()
> PHP Version => 5.2.3
>
> System => Linux localhost.localdomain 2.4.21-20.EL #1 Wed Aug 18
> 20:58:25 EDT 2004 i686
> Build Date => Jun 20 2007 08:17:41
> Configure Command =>  './configure' '--enable-soap' '--with-openssl'
> '--with-xmlrpc' '--with-zlib'
>
> What level of php and what level of SCA_SDO are you on?
>
> Matthew
>
> On 4 Mar, 20:05, Valverde <valverde.marc...@...> wrote:
>
> > Hi!
>
> > The code below works fine in Apache+Windows but don't work in Apache
> > +linux
>
> > //Result.php
> > <?php
> > require 'SCA/SCA.php';
>
> > /**
> >  * @service
> >  * @binding.soap
> >  */
> > class Result
> > {
> >         /**
> >          *
> >          * @param string $input
> >          * @return string $output
> >          */
> >         function getResult($input)
> >         {
> >                 return "Result: $input";
> >         }}
>
> > ?>
>
> > // client.php
> > <?php
>
> > $service = new SoapClient('http://localhost/Result.php?wsdl');
>
> > try
> > {
> >         $return = $service->getResult('test');
>
> >         echo "<pre>";
> >         echo  var_dump($return);
> >         echo "</pre>";}
>
> > catch (SoapFault $soapFault)
> > {
> >     echo "<pre>";
> >     echo  var_dump($soapFault);
> >     echo "</pre>";
>
> >     echo "Request :<br>";
> >     echo "<pre>";
> >     echo  print_r(htmlentities($service->__getLastRequest()));
> >     echo "</pre>";
>
> >     echo "Response :<br>";
> >     echo "<pre>";
> >     echo  print_r(htmlentities($service->__getLastResponse()));
> >     echo "</pre>";}
>
> > ?>
>
> > the errors are:
> > public 'faultstring' => string 'Bad Request' (length=11)
> >   public 'faultcode' => string 'SOAP-ENV:Client' (length=15)
> > Anyone help me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "phpsoa" group.
To post to this group, send email to phpsoa@...
To unsubscribe from this group, send email to phpsoa-unsubscribe@...
For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: binding.soap dont work in server Linux

by Matthew Peters-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi, thanks for this info. This is interesting. I do not quite know
what is going on.

However, at the bottom of ...../PEAR/SCA/Bindings/soap/
ServiceRequestHandler.php you'll see the lines:
            global $HTTP_RAW_POST_DATA;
            $server->handle($HTTP_RAW_POST_DATA);

This is where we pick up the raw post data and pass it in to the Soap
Server. We already had to change this once before when something
changed inside the Soap Server, perhaps something has changed again.
Anyway, perhaps if you include your test and assignment from php://input
into our ServiceRequestHandler.php it will work.

Your English is fine by the way!!

Matthew

On Mar 11, 12:30 pm, Valverde <valverde.marc...@...> wrote:

> I think that my problem is with HTTP_RAW_POST_DATA.
> I tried to create a pure server and client with native soap functions
> and then didn't work too.
> But when I put this code below to create the server and works fine!!!
>
> <?php
> if(!$HTTP_RAW_POST_DATA)
> {
>    $HTTP_RAW_POST_DATA = file("php://input");
>
> }
>
> function getCliente{.....}
>
> $server = new SoapServer("loja.wsdl");
> $server->addFunction("getCliente");
> $server->handle($HTTP_RAW_POST_DATA);
> ?>
>
> I still don't try this procedure with SCA. When i do this, i put this
> results here...
> I'm expert in PHP and newcomer in SCA_SDO.
>
> Sorry for my bad english, i am from Brasil.
> Thanks
>
> On 10 Mar, 14:13, Matthew Peters <matthew.f.pet...@...>
> wrote:
>
> > Sorry to hear you are having difficulties. I just tried out the
> > samples you supplied below and they *do* work for me on Linux so let's
> > begin by comparing versions.
>
> > I am running on Red Hat Linux and PHP 5.2.3. Here is the start of the
> > output from php -i
>
> > phpinfo()
> > PHP Version => 5.2.3
>
> > System => Linux localhost.localdomain 2.4.21-20.EL #1 Wed Aug 18
> > 20:58:25 EDT 2004 i686
> > Build Date => Jun 20 2007 08:17:41
> > Configure Command =>  './configure' '--enable-soap' '--with-openssl'
> > '--with-xmlrpc' '--with-zlib'
>
> > What level of php and what level of SCA_SDO are you on?
>
> > Matthew
>
> > On 4 Mar, 20:05, Valverde <valverde.marc...@...> wrote:
>
> > > Hi!
>
> > > The code below works fine in Apache+Windows but don't work in Apache
> > > +linux
>
> > > //Result.php
> > > <?php
> > > require 'SCA/SCA.php';
>
> > > /**
> > >  * @service
> > >  * @binding.soap
> > >  */
> > > class Result
> > > {
> > >         /**
> > >          *
> > >          * @param string $input
> > >          * @return string $output
> > >          */
> > >         function getResult($input)
> > >         {
> > >                 return "Result: $input";
> > >         }}
>
> > > ?>
>
> > > // client.php
> > > <?php
>
> > > $service = new SoapClient('http://localhost/Result.php?wsdl');
>
> > > try
> > > {
> > >         $return = $service->getResult('test');
>
> > >         echo "<pre>";
> > >         echo  var_dump($return);
> > >         echo "</pre>";}
>
> > > catch (SoapFault $soapFault)
> > > {
> > >     echo "<pre>";
> > >     echo  var_dump($soapFault);
> > >     echo "</pre>";
>
> > >     echo "Request :<br>";
> > >     echo "<pre>";
> > >     echo  print_r(htmlentities($service->__getLastRequest()));
> > >     echo "</pre>";
>
> > >     echo "Response :<br>";
> > >     echo "<pre>";
> > >     echo  print_r(htmlentities($service->__getLastResponse()));
> > >     echo "</pre>";}
>
> > > ?>
>
> > > the errors are:
> > > public 'faultstring' => string 'Bad Request' (length=11)
> > >   public 'faultcode' => string 'SOAP-ENV:Client' (length=15)
> > > Anyone help me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "phpsoa" group.
To post to this group, send email to phpsoa@...
To unsubscribe from this group, send email to phpsoa-unsubscribe@...
For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: binding.soap dont work in server Linux

by monxton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Matthew Peters wrote:

> Hi, thanks for this info. This is interesting. I do not quite know
> what is going on.
>
> However, at the bottom of ...../PEAR/SCA/Bindings/soap/
> ServiceRequestHandler.php you'll see the lines:
>             global $HTTP_RAW_POST_DATA;
>             $server->handle($HTTP_RAW_POST_DATA);
>
> This is where we pick up the raw post data and pass it in to the Soap
> Server. We already had to change this once before when something
> changed inside the Soap Server, perhaps something has changed again.
> Anyway, perhaps if you include your test and assignment from php://input
> into our ServiceRequestHandler.php it will work.
>

There's a php.ini directive which is relevant to this behaviour:
   always_populate_raw_post_data

Might be worth experimenting with, but I wonder if it would be a
performance hit. I agree with Matthew that using php://input directly in
the service request handler is the way to go.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "phpsoa" group.
To post to this group, send email to phpsoa@...
To unsubscribe from this group, send email to phpsoa-unsubscribe@...
For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: binding.soap dont work in server Linux

by Valverde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


The code bellow works fine. But just i used the client in wsdl-mode,
like this: $service = new SoapClient('http://localhost/Result.php?
wsdl');
In this case  the function 'getResult' didn't get the value of $input
variable.
The soap-envelope sent was:

<?xml version="1.0" encoding="UTF-8"?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="http://Result">
<SOAP-ENV:Body><ns1:getResult/></SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and the return was:

array
  0 => string 'getResultResponse getResult(getResult
$getResultRequest)' (length=60)

object(stdClass)[2]
  public 'getResultReturn' => string 'Result:' (length=6)


Pay attention in the soap-envelope the $input was not sent.


Now, when i tried to use the non-wsdl mode like this:
$service = new SoapClient(null, array("location" => "http://localhost/
Result.php?wsdl",
                                                                                        "uri" => "http://Result"));

the envelope sent was:
<?xml version="1.0" encoding="UTF-8"?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="http://Result" 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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
            <ns1:getResult>
                     <param0 xsi:type="xsd:string">test</param0>
           </ns1:getResult>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and the return was.....

SoapFault Object
(
    [message:protected] => looks like we got no XML document
    [string:private] =>
    [code:protected] => 0
    [file:protected] => /localhost/client.php
    [line:protected] => 23
    [trace:private] => Array
        (
            [0] => Array
                (
                    [file] => /localhost/client.php
                    [line] => 23
                    [function] => __soapCall
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => getResult
                            [1] => Array
                                (
                                    [0] => test
                                )

                        )

                )

        )

    [faultstring] => looks like we got no XML document
    [faultcode] => Client
    [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
)

and I note that the function getResult was never call (i track it with
error_log())!!!


Anyone help me?

//Result.php

<?php

global $HTTP_RAW_POST_DATA;
if(!$HTTP_RAW_POST_DATA)
{
        $f = file("php://input");
        $HTTP_RAW_POST_DATA = implode(" ", $f);
}

require 'SCA/SCA.php';

/**
 * @service
 * @binding.soap
 */
class Result
{
        /**
         *
         * @param string $input
         * @return string $output
         */
        function getResult($input)
        {
                return "Result: $input";
        }
}

?>

// client.php
<?php

$service = new SoapClient('http://localhost/Result.php?wsdl');

try
{
        $return = $service->getResult('test');

        echo "<pre>";
        echo  var_dump($return);
        echo "</pre>";
}

catch (SoapFault $soapFault)
{
    echo "<pre>";
    echo  var_dump($soapFault);
    echo "</pre>";

    echo "Request :<br>";
    echo "<pre>";
    echo  print_r(htmlentities($service->__getLastRequest()));
    echo "</pre>";

    echo "Response :<br>";
    echo "<pre>";
    echo  print_r(htmlentities($service->__getLastResponse()));
    echo "</pre>";
}

?>

On 18 Mar, 10:12, Caroline Maynard <c...@...> wrote:

> Matthew Peters wrote:
> > Hi, thanks for this info. This is interesting. I do not quite know
> > what is going on.
>
> > However, at the bottom of ...../PEAR/SCA/Bindings/soap/
> > ServiceRequestHandler.php you'll see the lines:
> >             global $HTTP_RAW_POST_DATA;
> >             $server->handle($HTTP_RAW_POST_DATA);
>
> > This is where we pick up the raw post data and pass it in to the Soap
> > Server. We already had to change this once before when something
> > changed inside the Soap Server, perhaps something has changed again.
> > Anyway, perhaps if you include your test and assignment from php://input
> > into our ServiceRequestHandler.php it will work.
>
> There's a php.ini directive which is relevant to this behaviour:
>    always_populate_raw_post_data
>
> Might be worth experimenting with, but I wonder if it would be a
> performance hit. I agree with Matthew that using php://input directly in
> the service request handler is the way to go.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "phpsoa" group.
To post to this group, send email to phpsoa@...
To unsubscribe from this group, send email to phpsoa-unsubscribe@...
For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---