# [phpsoa] Re: Problems with message binding

```Hello,

Oh, that doesn't looks good. well, be honest i never tested it on
Linux, but I 'm surprised you got a segmentation fault. The most of
changes I made to sam were on php files, those shouldn't affect the
binary you built. The only change I made to C files was the following
two lines which were added to php_sam.c.```
```
REGISTER_STRING_CONSTANT(SAM_CONSTANT_PRIORITY, SAM_CONSTANT_PRIORITY,
CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT(SAM_CONSTANT_TIMETOLIVE,
SAM_CONSTANT_TIMETOLIVE, CONST_CS | CONST_PERSISTENT);

And those are just for registering two constants "SAM_PRIORITY" and
"SAM_TIMETOLIVE". If you had no problem with the original sam, I don't
see how those two lines would cause a segmentation fault when loading
the extension.

Unfortunately, I am currently working on some other project, so I
don't have a running php environment right now, cannot help you out
there. I don't know if Matthew can confirm that my version of sam
works on Linux?

Jack

P.S.  Changelog for sam:

1. php_sam.c
- two lines added for registering constants SAM_CONSTANT_PRIORITY
and SAM_CONSTANT_TIMETOLIVE
2. php_sam.php
- slightly changed the if statement in the create() method, for
handling stomp protocol.
- Fixed PECL bug #11034, deleted the carriage return at the end of
the file
4. created new folder Stomp

On 6 Mar, 18:16, jpuerta <[EMAIL PROTECTED]> wrote:
> Hello Jack, Matthew...
>
> the sam extension...
> But after loading the extension, php no longer works and we see a
> segmentation fault in the logs, so I was unable to test the example...
>
> I am testing all this on Linux...
> We have
> php 5.2.5
> apache 2.2.6
> activemq 5.0.0
>
> Thanks
> jpuerta
>
> On 6 Mar, 07:28, Matthew Peters <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Jack, thanks for this very timely and authoritative reposnse.
>
> > jp, if you want, I can try and build the version of the zip file that
> > Jack's posting refers to and make sure that our samples run with that
> > precise level. Or you can try it first. Let me know what you would
> > like. And...are you on Windows or Linux or something else?
>
> > Matthew
>
> > On Mar 5, 4:05 am, Jack Zai <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > The blank line in the WSDL may be caused by the carriage return at the
> > > end of file 'php_sam.php' (PECL bug #11034).
>
> > > In that case, i think you have used the current releases (1.1.0) of
> > > SAM, and I am afeard this version does NOT support some features of
> > > the message binding ( including the STOMP protocol ). Unfortunately,
> > > i've no idea when the next release of SAM becomes available. in the
> > > mean time, you may wish to try a patch file[1] and rebuild SAM
> > > extension yourself. Good luck!
>
> > > Jack
>
> > > [1]  the patch file can be found at this
> > > (named sam_patch.txt), there is also a zip file contains the whole sam
> > > folder with the latest sources code.
>
> > > On 4 Mar, 23:04, jpuerta <[EMAIL PROTECTED]> wrote:
>
> > > > Hi Matthew...
>
> > > > Unfortunately, we have still been unable to run a successful test with
> > > > the message binding...
> > > > The fatal error complaining about the class with "ms" in the name,
> > > > disappeared... creating the msd file works now, but trying with the
> > > > example you provided... we run the ReceivingService in one window, and
> > > > get the following output:
>
> > > > [EMAIL PROTECTED] activemqtest]# /usr/local/php/bin/php
> > > > ReceivingService.php
>
> > > > Listener for queue://receiver has been started. To exit, press <Ctrl>
> > > > + <C> ...
>
> > > > Activemq is running on another window...
> > > > But when we run the test client it still fails displaying the
> > > > following error:
>
> > > > Fatal error: Uncaught SCA_RuntimeException: Send Request Failed thrown
> > > > in /usr/local/php/lib/SCA_SDO/SCA/Bindings/message/Proxy.php on line
> > > > 120
>
> > > > At this point we really don't know what we are doing wrong...
> > > > We installed activemq 5.0.0 on the localhost and on some other
> > > > server... but it made no difference
>
> > > > We are also still getting the blank line generating WSDLs and any
> > > > other XML file generated by sca, including the msd file... we still
> > > > don't know why this happens... but this behaviour only occurs, when
> > > > the sam extension is loaded... without it, all the wsdls are generated
> > > > fine...
>
> > > > We are using SCA_SDO version 1.2.4 now...
>
> > > > Any suggestion will be appreciated...
> > > > Thank you very much
>
> > > > jpuerta...
>
> > > > On 4 Mar, 07:06, Matthew Peters <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > Good, that sounds as if that has fixed the problem for you. How about
> > > > > the second one - a blank line in the wsdl? Did you find the source of
> > > > > the problem for that too?
>
> > > > > You'll see I have just released 1.2.4, by the way.
>
> > > > > Matthew
>
> > > > > On Mar 3, 4:06 pm, jpuerta <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hello Matthew...
>
> > > > > > Thank you very much for your help...
> > > > > > I tried the example you provided, but i was unable to get it to
> > > > > > work...
> > > > > > I still get the same error when I try this:
>
> > > > > >http://yummyphpprojjpuerta/services/activemqtest/ReceivingService.php...
>
> > > > > > Fatal error: Class 'SCA_Bindings_ms_ServiceDescriptionGenerator' not
> > > > > > found in /usr/local/php/lib/SCA_SDO-1.2.3/SCA/Bindings/message/
> > > > > > ServiceRequestHandler.php on line 49
>
> > > > > > I checked the line 49 in this file, and it looks like this:
> > > > > > SCA_Bindings_ms_ServiceDescriptionGenerator::generateMPD(\$service_descripti­­on));
>
> > > > > > After that I browsed for the same file in the FULMAR branch you were
> > > > > > referring to (http://cvs.php.net/viewvc.cgi/pecl/sdo/SCA/Bindings/
> > > > > > message/ServiceRequestHandler.php?
> > > > > > hideattic=1&view=markup&pathrev=FULMAR), and found that the same
> > > > > > line
> > > > > > looks different than the one in the SCA version we downloaded:
>
> > > > > > SCA_Bindings_message_ServiceDescriptionGenerator::generateMSD(\$service_desc­­ription));
>
> > > > > > we downloaded the SCA_SDO stable version 1.2.3 from
> > > > > > here:http://pecl.php.net/package/SCA_SDO/
>
> > > > > > Again... thank you for your help
> > > > > > jpuerta
>
> > > > > > On 3 Mar, 07:04, Matthew Peters <[EMAIL PROTECTED]>
> > > > > > wrote:
>
> > > > > > > Hi, sorry to hear you are having problems.
>
> > > > > > > The Fatal error you are seeing looks odd: the _ms_ in the middle
> > > > > > > of
> > > > > > > the name looks like something somewhere is looking for a
> > > > > > > binding.ms
> > > > > > > rather than binding.message. I propose we try with an exaple that
> > > > > > > I
> > > > > > > know works - I show below a simple example that I have just tried
> > > > > > > out
> > > > > > > on my machine with ActiveMQ 5.0. I am running with the FULMAR
> > > > > > > branch
> > > > > > > of SCA but I don't think that should make any difference.
>
> > > > > > > As for the second error you report, the empty line, one reason for
> > > > > > > that can be a blank line in the php script on the receiving end -
> > > > > > > the
> > > > > > > one that is supposed to generate the wsdl. If there is a blank
> > > > > > > line
> > > > > > > before the first <?php, it comes out in the wsdl. In fact if any
> > > > > > > of
> > > > > > > the scripts that are involved in generating the wsdl emit anything
> > > > > > > before the <?xml declaration we get trouble - but I hope that the
> > > > > > > SCA
> > > > > > > scripts never do that.
>
> > > > > > > Here is my working example. See if it works for you. It's three
> > > > > > > files
> > > > > > > which for me are all in C:\Program Files\Apache
> > > > > > > Group\Apache2\htdocs
> > > > > > > \Frankfurt\Message
> > > > > > > where htdocs is of course the document root for my apache.
>
> > > > > > > Of course you need to start ActiveMQ in one window and
> > > > > > > ReceivingService.php in another. You'll see that the test client
> > > > > > > gets
> > > > > > > the receiving service to generate the msd file and writes it out,
> > > > > > > then
> > > > > > > makes a local call to the sending service which sends the magic
> > > > > > > initials IBM on queue://receiver
>
> > > > > > > I get a couple of annoying messages from the SAM extension but
> > > > > > > that is
> > > > > > > because I run php with strict messages i.e. show all errors - in
> > > > > > > any
> > > > > > > case they are nothing to worry about.
>
> > > > > > > Good luck and do let me know how you get on.
>
> > > > > > > Matthew
>
> > > > > > > TestClient.php
> > > > > > > ___________________________________________________________________________­­_________
> > > > > > > <?php
>
> > > > > > > include_once "SCA/SCA.php";
>
> > > > > > > \$msd = file_get_contents('http://localhost/Frankfurt/Message/
> > > > > > > ReceivingService.php?msd');
> > > > > > > file_put_contents('./ReceivingService.msd', \$msd);
>
> > > > > > > \$local_service = SCA::getService('./SendingService.php');
> > > > > > > \$local_service->send('IBM') . "\n";
>
> > > > > > > ?>
> > > > > > > ___________________________________________________________________________­­___________
>
> > > > > > > SendingService.php
> > > > > > > ___________________________________________________________________________­­___________
> > > > > > > <?php
>
> > > > > > > include "SCA/SCA.php";
>
> > > > > > > /**
> > > > > > >  * @service
> > > > > > >  */
>
> > > > > > > class SendingService {
> > > > > > >         /**
> > > > > > >      * @reference
> > > > > > >      * @binding.message ReceivingService.msd
> > > > > > >      */
> > > > > > >         public \$receiving_service;
>
> > > > > > >         public function send(\$str)
> > > > > > >         {
> > > > > > >                 \$this->receiving_service->send(\$str);
> > > > > > >         }
>
> > > > > > > }
>
> > > > > > > ?>
> > > > > > > ___________________________________________________________________________­­___________
>
> > > > > > > ReceivingService.php
> > > > > > > ___________________________________________________________________________­­___________
> > > > > > > <?php
> > > > > > > include "SCA/SCA.php";
>
> > > > > > > /**
> > > > > > >  * @service
> > > > > > >  * @binding.message
> > > > > > >  * @protocol stomp
> > > > > > >  * @destination queue://receiver
> > > > > > >  * @wsdl disabled
> > > > > > >  */
>
> > > > > > > class ReceivingService {
>
> > > > > > >         public function send(\$str) {
> > > > > > >                 echo \$str . "\n";
> > > > > > >         }
>
> > > > > > > }
>
> > > > > > > ?>
> > > > > > > ___________________________________________________________________________­­___________
>
> > > > > > > On Feb 29, 9:31 pm, jpuerta <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Greetings...
>
> > > > > > > > We have been trying to use the message binding with SCA, but we
> > > > > > > > have
> > > > > > > > been unsuscessful...
> > > > > > > > We were trying to do this as shown
> > > > > > > > here:http://www.osoa.org/display/PHP/binding.message+Binding+Documentation
> > > > > > > > But when we try to generate the Message Service Description
> > > > > > > > (http://
> > > > > > > > yummyphpprojjpuerta/services/activemqtest/TestService.php?msd),
> > > > > > > > we
> > > > > > > > obtain this error:
>
> > > > > > > > Fatal error: Class
> > > > > > > > 'SCA_Bindings_ms_ServiceDescriptionGenerator' not
> > > > > > > > found in /usr/local/php/lib/SCA_SDO-1.2.3/SCA/Bindings/message/
> > > > > > > > ServiceRequestHandler.php on line 49
>
> ...
>
> read more »- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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