Re: COM - Assigning to method.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15 July 2013 16:27, Andrew Ballard <aballard@xxxxxxxxx> wrote:

> On Mon, Jul 15, 2013 at 4:21 AM, Adam Nicholls <inkysplat@xxxxxxxxx>
> wrote:
> > Hi Andrew
> >
> > Thanks for this.
> >
> > But I'm still getting errors. I think I need to explain a bit more.
> >
> > Unfortunately there isn't a PHP API for this application I'm trying to
> > interact with, my goal really is to be able to expose the COM
> > functionality over a web-service such as SOAP so I can use it in a
> > CMS. The application I'm trying to integrate with is Blackbuad's
> > Raiser's Edge - API documentation here:
> > https://www.blackbaud.com/files/support/guides/re7ent/api.pdf
> >
> > I think part of the problem is that the field names are also
> > represented by an integer. So to get data out I would do:
> >
> > $oBank->Fields(22);   // which maps to BANK_fld_BRANCH_NAME.
> >
> > When I do:
> >
> > $oBank->22 = 'blah blah';
> >
> > I get an error because a property can't be numeric, it has to start as
> > alpha character. If I use:
> >
> > $oBank->BANK_fld_BRANCH_NAME = 'blah blah blah';
> >
> > I get the following error:
> >
> > Fatal error: Uncaught exception 'com_exception' with message 'Unable
> > to lookup `BANK_fld_BRANCH_NAME': Unknown name.
> >
> > I've also tried using your Value property returned by Fields():
> >
> > $oBank->Fields(22)->Value = 'Blah Blah blah blah';
> >
> > Which I then get:
> > PHP Warning:  Creating default object from empty value in [C:\Users....]
> > Fatal error: Call to undefined method variant::Save()
> >
> > Soo seems nearly impossible to implement a safe way to write to the COM
> API.
> >
> >
> > At the moment, I'm still in the scoping/prototype stage of my project,
> > so I'm beginning to think that using this COM API for this project is
> > a no-go, which is unfortunate. I'm also guessing even if we did
> > implement this API, exposing it as a Web Service is going to be tricky
> > for performance sake (given that I've read that COM doesn't
> > multithread very well??)
> >
> > Many Thanks
> > Adam.
>
> It's definitely possible to do, once you figure out the syntax you
> need for this object.
>
> I'm guessing you must have gotten past the $oBank->Init() method call
> without issues.
>
> What happens if you just use this for the value assignment?
>
> $oBank->Fields(BANK_fld_ACCOUNT_NAME) = "Test account";
> $oBank->Fields(BANK_fld_ACCOUNT_NO) = "12345";
> $oBank->Fields(BANK_fld_BANK) = "Bank of the Nation";
> $oBank->Fields(BANK_fld_BRANCH_NAME) = "State Street Branch";
>
> It also looks like you're getting errors from the call to
> $oBank->Save() saying that the method is not defined.
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I used to use PHP+Windows+COM+Crystal Reports.

I'm in the middle of something else, but a few things. Does the library you
are using have a valid COM interface? Some of the .NET libraries simply
don't. The last version of CR that was COM enabled was CR XI R 2. After
that it was .NET and Java only. No COM. Having said that, I never got
around to using http://uk1.php.net/manual/en/class.dotnet.php, so I don't
know how this all worked. From memory the DOTNET layer of PHP was just a
wrapper around COM and still required COM exposure in the lib. I think.

Use a TypeLib Explorer to see exactly what interface is available - from
memory, the right tool is all you need. I was able to code anything I
needed with Crystal Reports.

There is also a PHP function
http://uk1.php.net/manual/en/function.com-load-typelib.php which I used to
allow the various constants within the typelib to be exposed and usable
within PHP.

And also look at
http://uk1.php.net/manual/en/function.com-print-typeinfo.php and the user
notes. Not used it but "bucket loads of info" is a good thing to see
normally.


-- 
Richard Quadling
Twitter : @RQuadling

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux