Lye - a COM to SOAP gateway...
Alex Martelli
aleaxit at yahoo.com
Wed Sep 13 17:45:57 EDT 2000
"Andrew Dalke" <dalke at acm.org> wrote in message
news:8pnaou$gc2$1 at slb6.atl.mindspring.net...
> [..and a request for COM help]
[snip]
> I've written a program called Lye which is a simple COM server
> that forwards calls to a SOAP server using /F's soaplib. It's
Excellent idea!
> the Python COM client to talk to the COM server, but I can't get
> VB for Applications to do it. With debugging I can see a call in
> _dynamic_ for a function/attribute named _value_ . I don't know
You have a Visual Basic problem. Your VB code:
> soap = factory.createSOAP("http://localhost:8000")
is an implicit *LET* assignment. You need to do a *SET* assignment,
which must always be explicit:
set soap = factory.createSOAP(etc)
A LET-assignment to/from an object uses/changes the *DEFAULT
VALUE* property of that object; it takes a SET-assignment to use
or change *THE OBJECT ITSELF*.
This is why for, e.g., a Label object in a VB form, you can change
its caption by writing:
Label1 = "Foobar"
This is a LET assignment, so it affects Label1's default value
property, which happens to be its Caption; it does not change
the Label1 object itself.
So, your problem does not come from any defect with your
Python code. Just fix the VB, and the problem will go away.
> what to return, or if I should raise an exception.
I think that simply not having _value_ should give the
right kind of error ("no such property or method"; an
object *IS* allowed not to have a default property, if
it does not make sense for it).
> As I minor point, I'm not sure about the standard COM names for
> things like factory functions, so advice for that would also be
> helpful.
You can take various tacks, but a read-only indexed property
is what I've found smoothest, rather than a factory-method.
In VB, that would look like:
set soap = factory.Soap("whatever")
A VC++ client (using VC++'s #import for a typelib) would
have, e.g.:
IDispatchPtr pSoap = pFactory->GetSoap("whatever");
well -- that's IF you could have a typelib, which Python
does not currently allow (sigh -- makes it a bother to access
Python-implemented servers from C++ of any kind...).
If you want to keep it as a method for some reason, I think
MakeSoap, CreateSoap, and GetSoap are good candidates.
Usual convention is to have MixedCase (the first letter also
uppercased).
Alex
More information about the Python-list
mailing list