[phpsoa] Re: SCA Webservice in WSDL mode

2008-02-03 Thread Dalibor Andzakovic

Glad to be of service :-)

I've applied the below fixes to my dev enviroment, but it sure would
be nice to get them into an official release. It would make app
maintenance a lot easier..

dali

On Feb 1, 7:21 am, Matthew Peters <[EMAIL PROTECTED]>
wrote:
> Dali, I am glad you told us about this in the first place as you had
> uncovered a bad bug.
>
> First of all, I made a silly mistake - I  had forgotten that I too had
> removed the @types annotation and that was why it had now started
> working for me. As soon as I put the @types annotation back in it
> started to fail again.
>
> It is caused a rather brittle bit of code where we have to scan a bit
> of human-readable output deep inside SCA. I am not sure how long it
> has been broken for, nor exactly in which cases the error occurs - it
> depends on the order in which something is printed.
>
> Anyway, I have a fix for this which I have checked in to the FULMAR
> branch. I include the two changes here in case you want to apply them;
>
> 1. Fix Bindings/soap/Mapper.php by replacing the last method,
> getAllTypes with this:
> public function getAllTypes()
> {
> $str   = $this->xmldas->__toString();
> $types = array();
> $line  = strtok($str, self::EOL);
> $line = strtok(self::EOL); // skip line that says this is
> an SDO
> $line = strtok(self::EOL); // skip line that says nn types
> have been defined
>
> while ($line !== false && strpos($line,'commonj.sdo')) {
> $line = strtok(self::EOL);
> }
> while ($line !== false && $line != '}') {
> $trimmed_line = trim($line);
> $words= explode(' ', $trimmed_line);
> if ($words[0] == '-') {
> $line = strtok(self::EOL);
> continue;
> }
> $namespace_and_type = $words[1];
> $pos_last_hash  = strrpos($namespace_and_type,
> '#');
> $namespace  = substr($namespace_and_type, 0,
> $pos_last_hash);
> $type   = substr($namespace_and_type,
> $pos_last_hash+1);
> if ($type != 'RootType') {
> $types[]= array($namespace, $type);
> }
> $line   = strtok(self::EOL);
> }
> return $types;
> }
>
> 2. In Bindings/soap/Wrapper.php
>   2.1 Add an instance variable
> private $class_name = null;
>
>   2.2 Initalise it in the constructor
> $this->class_name = $class_name;
>
>   2.3 Use it inside the __call method at the bottom...replace
> $xdoc = $this->xmldas->createDocument($method_name .
> "Response");
>   with
> $namespace = 'http://' . $this->class_name;
> $xdoc = $this->xmldas->createDocument($namespace,
> $method_name . "Response");
>
> We will make a release with FULMAR soon. I can just zip up the SCA
> directory and send it to you if you like.
>
> We also have the fix for  that you saw.
>
> Matthew
>
> On Jan 30, 8:29 pm, Dalibor Andzakovic <[EMAIL PROTECTED]>
> wrote:
>
> > I managed to get it going at my end too. It seemed to be the @types
> > annotation that was causing grief.
>
> > In the process we've had to change SCA/Bindings/soap/
> > ServiceDescriptionGenerator.php to output  tags instead of
> > , but that could just be interop issues.
>
> > dali
>
> > On Jan 30, 3:31 am, Matthew Peters <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hmmm. I tried this out, started putting in a few debug lines, saw
> > > exactly the same message you did, and then it went away and won't come
> > > back :-). Here is what is currently working for me:
>
> > >  > > include "SCA/SCA.php";
> > > $weather = SCA::getService('servicetest.php');
> > > var_dump($weather->sayHello('dali'));
>
> > > //$wsdl = file_get_contents('http://localhost/bugs/bug/servicetest.php?
> > > wsdl');
> > > //file_put_contents('./servicetest.wsdl',$wsdl);
> > > //$weather = SCA::getService('./servicetest.wsdl');
>
> > > $weather = SCA::getService('http://localhost/bugs/bug/servicetest.php?
> > > wsdl','soap',array('location' => 'http://localhost/bugs/bug/
> > > servicetest.php'));
> > > var_dump($weather->sayHello('dali'));
> > > ?>
>
> > > where I have renamed your servicetest4 to servicetest and as you can
> > > see I have the files under htdocs at bugs/bug rather than ihug.
>
> > > You'll see the three lines I have commented out where I get the wsdl
> > > explicitly in one step, and write it into the directory where both the
> > > test script and the server script are located. This is what I always
> > > do and always works for me - write the wsdl out to a file. I suspect
> > > there is something vulnerable about using http://... in the getService
> > > call itself that we have never pinned down - it ought to work but
> > > sometimes doesn't. The server end writes out

[phpsoa] Re: SCA Webservice in WSDL mode

2008-01-31 Thread Matthew Peters

Dali, I am glad you told us about this in the first place as you had
uncovered a bad bug.

First of all, I made a silly mistake - I  had forgotten that I too had
removed the @types annotation and that was why it had now started
working for me. As soon as I put the @types annotation back in it
started to fail again.

It is caused a rather brittle bit of code where we have to scan a bit
of human-readable output deep inside SCA. I am not sure how long it
has been broken for, nor exactly in which cases the error occurs - it
depends on the order in which something is printed.

Anyway, I have a fix for this which I have checked in to the FULMAR
branch. I include the two changes here in case you want to apply them;

1. Fix Bindings/soap/Mapper.php by replacing the last method,
getAllTypes with this:
public function getAllTypes()
{
$str   = $this->xmldas->__toString();
$types = array();
$line  = strtok($str, self::EOL);
$line = strtok(self::EOL); // skip line that says this is
an SDO
$line = strtok(self::EOL); // skip line that says nn types
have been defined

while ($line !== false && strpos($line,'commonj.sdo')) {
$line = strtok(self::EOL);
}
while ($line !== false && $line != '}') {
$trimmed_line = trim($line);
$words= explode(' ', $trimmed_line);
if ($words[0] == '-') {
$line = strtok(self::EOL);
continue;
}
$namespace_and_type = $words[1];
$pos_last_hash  = strrpos($namespace_and_type,
'#');
$namespace  = substr($namespace_and_type, 0,
$pos_last_hash);
$type   = substr($namespace_and_type,
$pos_last_hash+1);
if ($type != 'RootType') {
$types[]= array($namespace, $type);
}
$line   = strtok(self::EOL);
}
return $types;
}

2. In Bindings/soap/Wrapper.php
  2.1 Add an instance variable
private $class_name = null;

  2.2 Initalise it in the constructor
$this->class_name = $class_name;

  2.3 Use it inside the __call method at the bottom...replace
$xdoc = $this->xmldas->createDocument($method_name .
"Response");
  with
$namespace = 'http://' . $this->class_name;
$xdoc = $this->xmldas->createDocument($namespace,
$method_name . "Response");

We will make a release with FULMAR soon. I can just zip up the SCA
directory and send it to you if you like.

We also have the fix for  that you saw.

Matthew


On Jan 30, 8:29 pm, Dalibor Andzakovic <[EMAIL PROTECTED]>
wrote:
> I managed to get it going at my end too. It seemed to be the @types
> annotation that was causing grief.
>
> In the process we've had to change SCA/Bindings/soap/
> ServiceDescriptionGenerator.php to output  tags instead of
> , but that could just be interop issues.
>
> dali
>
> On Jan 30, 3:31 am, Matthew Peters <[EMAIL PROTECTED]>
> wrote:
>
> > Hmmm. I tried this out, started putting in a few debug lines, saw
> > exactly the same message you did, and then it went away and won't come
> > back :-). Here is what is currently working for me:
>
> >  > include "SCA/SCA.php";
> > $weather = SCA::getService('servicetest.php');
> > var_dump($weather->sayHello('dali'));
>
> > //$wsdl = file_get_contents('http://localhost/bugs/bug/servicetest.php?
> > wsdl');
> > //file_put_contents('./servicetest.wsdl',$wsdl);
> > //$weather = SCA::getService('./servicetest.wsdl');
>
> > $weather = SCA::getService('http://localhost/bugs/bug/servicetest.php?
> > wsdl','soap',array('location' => 'http://localhost/bugs/bug/
> > servicetest.php'));
> > var_dump($weather->sayHello('dali'));
> > ?>
>
> > where I have renamed your servicetest4 to servicetest and as you can
> > see I have the files under htdocs at bugs/bug rather than ihug.
>
> > You'll see the three lines I have commented out where I get the wsdl
> > explicitly in one step, and write it into the directory where both the
> > test script and the server script are located. This is what I always
> > do and always works for me - write the wsdl out to a file. I suspect
> > there is something vulnerable about using http://... in the getService
> > call itself that we have never pinned down - it ought to work but
> > sometimes doesn't. The server end writes out wsdl itself if it finds
> > that there is none in the directory beside itself, and I think it's
> > possible for the wsdl at either end to get out of step if you don't
> > write it out explicitly.
>
> > Let me know how you get on.
>
> > Matthew
>
> > On Jan 27, 9:29 pm, Dalibor Andzakovic <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Jan 25, 10:23 pm, Matthew Peters <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Thanks for trying SCA and for telling us about the prob

[phpsoa] Re: SCA Webservice in WSDL mode

2008-01-30 Thread Dalibor Andzakovic

I managed to get it going at my end too. It seemed to be the @types
annotation that was causing grief.

In the process we've had to change SCA/Bindings/soap/
ServiceDescriptionGenerator.php to output  tags instead of
, but that could just be interop issues.

dali


On Jan 30, 3:31 am, Matthew Peters <[EMAIL PROTECTED]>
wrote:
> Hmmm. I tried this out, started putting in a few debug lines, saw
> exactly the same message you did, and then it went away and won't come
> back :-). Here is what is currently working for me:
>
>  include "SCA/SCA.php";
> $weather = SCA::getService('servicetest.php');
> var_dump($weather->sayHello('dali'));
>
> //$wsdl = file_get_contents('http://localhost/bugs/bug/servicetest.php?
> wsdl');
> //file_put_contents('./servicetest.wsdl',$wsdl);
> //$weather = SCA::getService('./servicetest.wsdl');
>
> $weather = SCA::getService('http://localhost/bugs/bug/servicetest.php?
> wsdl','soap',array('location' => 'http://localhost/bugs/bug/
> servicetest.php'));
> var_dump($weather->sayHello('dali'));
> ?>
>
> where I have renamed your servicetest4 to servicetest and as you can
> see I have the files under htdocs at bugs/bug rather than ihug.
>
> You'll see the three lines I have commented out where I get the wsdl
> explicitly in one step, and write it into the directory where both the
> test script and the server script are located. This is what I always
> do and always works for me - write the wsdl out to a file. I suspect
> there is something vulnerable about using http://... in the getService
> call itself that we have never pinned down - it ought to work but
> sometimes doesn't. The server end writes out wsdl itself if it finds
> that there is none in the directory beside itself, and I think it's
> possible for the wsdl at either end to get out of step if you don't
> write it out explicitly.
>
> Let me know how you get on.
>
> Matthew
>
> On Jan 27, 9:29 pm, Dalibor Andzakovic <[EMAIL PROTECTED]>
> wrote:
>
> > On Jan 25, 10:23 pm, Matthew Peters <[EMAIL PROTECTED]>
> > wrote:
>
> > > Thanks for trying SCA and for telling us about the problem. Please
> > > would you put up the Temperatures.xsd as well? I'll look at it
> > > straight away.
>
> > Hi Matthew,
>
> > thanks for looking at this.
>
> > XSD below:
>
> > 
> > http://www.w3.org/2001/XMLSchema";
> >targetNamespace="http://Weather";
> >elementFormDefault="qualified">
>
> >   
> > 
> >   
> >   
> > 
> >   
>
> >   
> > 
> >   
> >  > maxOccurs="unbounded"/>
> >   
> > 
> >   
>
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] Re: SCA Webservice in WSDL mode

2008-01-29 Thread Matthew Peters

Hmmm. I tried this out, started putting in a few debug lines, saw
exactly the same message you did, and then it went away and won't come
back :-). Here is what is currently working for me:

sayHello('dali'));

//$wsdl = file_get_contents('http://localhost/bugs/bug/servicetest.php?
wsdl');
//file_put_contents('./servicetest.wsdl',$wsdl);
//$weather = SCA::getService('./servicetest.wsdl');

$weather = SCA::getService('http://localhost/bugs/bug/servicetest.php?
wsdl','soap',array('location' => 'http://localhost/bugs/bug/
servicetest.php'));
var_dump($weather->sayHello('dali'));
?>

where I have renamed your servicetest4 to servicetest and as you can
see I have the files under htdocs at bugs/bug rather than ihug.

You'll see the three lines I have commented out where I get the wsdl
explicitly in one step, and write it into the directory where both the
test script and the server script are located. This is what I always
do and always works for me - write the wsdl out to a file. I suspect
there is something vulnerable about using http://... in the getService
call itself that we have never pinned down - it ought to work but
sometimes doesn't. The server end writes out wsdl itself if it finds
that there is none in the directory beside itself, and I think it's
possible for the wsdl at either end to get out of step if you don't
write it out explicitly.

Let me know how you get on.

Matthew

On Jan 27, 9:29 pm, Dalibor Andzakovic <[EMAIL PROTECTED]>
wrote:
> On Jan 25, 10:23 pm, Matthew Peters <[EMAIL PROTECTED]>
> wrote:
>
> > Thanks for trying SCA and for telling us about the problem. Please
> > would you put up the Temperatures.xsd as well? I'll look at it
> > straight away.
>
> Hi Matthew,
>
> thanks for looking at this.
>
> XSD below:
>
> 
> http://www.w3.org/2001/XMLSchema";
>targetNamespace="http://Weather";
>elementFormDefault="qualified">
>
>   
> 
>   
>   
> 
>   
>
>   
> 
>   
>  maxOccurs="unbounded"/>
>   
> 
>   
>
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] Re: SCA Webservice in WSDL mode

2008-01-27 Thread Dalibor Andzakovic



On Jan 25, 10:23 pm, Matthew Peters <[EMAIL PROTECTED]>
wrote:

> Thanks for trying SCA and for telling us about the problem. Please
> would you put up the Temperatures.xsd as well? I'll look at it
> straight away.

Hi Matthew,

thanks for looking at this.

XSD below:


http://www.w3.org/2001/XMLSchema";
   targetNamespace="http://Weather";
   elementFormDefault="qualified">

  

  
  

  

  

  

  

  


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



[phpsoa] Re: SCA Webservice in WSDL mode

2008-01-25 Thread Matthew Peters

Hi Dan,
Thanks for trying SCA and for telling us about the problem. Please
would you put up the Temperatures.xsd as well? I'll look at it
straight away.

Matthew

On Jan 25, 12:28 am, Dalibor Andzakovic <[EMAIL PROTECTED]>
wrote:
> Hi All,
>
> I Have a problem running consuming SCA exposed as a webservice. If i
> create a SCA client based on a local file i get expected behaviour,
> however if i create it based on generated WSDL i get
> SDO_UnsupportedOperationException: createDocument - cannot find
> element.
>
> Any tips would be greatly appreciated.
>
> Following code works:
>
> $weather = SCA::getService('servicetest4.php');
> var_dump($weather->sayHello('dali'));
>
> Following doesn't :-(
>
> $weather = SCA::getService('http://localhost/ihug/servicetest4.php?
> wsdl', 'soap', array('location' => 'http://localhost/ihug'));
> var_dump($weather->sayHello('dali'));
>
> below is the complete servicetest.php
>  require_once 'SCA/SCA.php';
>
> /**
>  * SCA SOAP test
>  *
>  * @service
>  * @binding.soap
>  *
>  * @typeshttp://WeatherTemperatures.xsd
>  */
> class servicetest4 {
>
> /**
>  * Class constructor
>  *
>  */
> public function __construct()
> {
> // Some Constructor
> }
>
> /**
>  * Say Hello to Somebody
>  * @param string $who
>  * @return string
>  */
> public function sayHello($who)
> {
> return "Hello $who";
> }
>
> /**
>  * Something to return an object
>  *
>  * @param string $foo
>  * @return Temperatureshttp://Weather
>  */
> public function returnObject($foo)
> {
> $Temperatures = SCA::createDataObject('http://Weather',
>   'Temperatures');
> $Pair = $Temperatures->createDataObject('entry');
> $Pair->state = 'CA';
> $Pair->temperature = 65;
> $Pair = $Temperatures->createDataObject('entry');
> $Pair->state = 'UT';
> $Pair->temperature = 105;
> $Pair = $Temperatures->createDataObject('entry');
> $Pair->state = 'ND';
> $Pair->temperature = -20;
> return $Temperatures;
> }
>
> private function doSomething()
> {
> // Some Private Method
> }}
>
> ?>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---