My problem is this:
I'm using PHP to call an object on server with class COM, at IIS 7.
The object is well created, but when I'm using a method of it, PHP return this error:
PHP Fatal error: Uncaught exception 'com_exception' with message 'Parameter 2: Type mismatch.
The error occurs ALWAYS in the last parameter, regardless of whether the error is actually in the first parameter (I think so, because using another function in that same component I sent all variables fine and all are strings).
My PHP code:
$com = new COM("LogicControlOEM.OEM_EjecutaOEM", NULL, CP_UTF8, 'LogicControlOEM') or die("Error al cargar el componente");
$empresa = 1;
$usuario = 'XXX';
$pass = 'XXX';
$com->InicializaOEM($empresa,
$usuario,
$pass);
var_dump($com);
$com = null;
I remove the optional values from the function. You can see the code below.
I tried those same parameters in a file .vbs and works fine.
I'm opening a new question because it's different, I don't know what type is VT_PTR in Visual Basic Script, and I want to transform a php variable to this type.
I don't know even if it is possible.
I use a php function com_print_typeinfo()
to see the code inside the component:
com_print_typeinfo($com);
It shows the code in VBS (?):
class _OEM_EjecutaOEM { /* GUID={XXXXXXX-XXXX-XXX-XXX-XXXXXXXXXXX} */
/* DISPID=1610612736 */
function QueryInterface(
/* VT_PTR [26] [in] --> ? [29] */ &$riid,
/* VT_PTR [26] [out] --> VT_PTR [26] */ &$ppvObj
)
{
}
/* DISPID=1610612737 */
/* VT_UI4 [19] */
function AddRef(
)
{
}
/* DISPID=1610612738 */
/* VT_UI4 [19] */
function Release(
)
{
}
/* DISPID=1610678272 */
function GetTypeInfoCount(
/* VT_PTR [26] [out] --> VT_UINT [23] */ &$pctinfo
)
{
}
/* DISPID=1610678273 */
function GetTypeInfo(
/* VT_UINT [23] [in] */ $itinfo,
/* VT_UI4 [19] [in] */ $lcid,
/* VT_PTR [26] [out] --> VT_PTR [26] */ &$pptinfo
)
{
}
/* DISPID=1610678274 */
function GetIDsOfNames(
/* VT_PTR [26] [in] --> ? [29] */ &$riid,
/* VT_PTR [26] [in] --> VT_PTR [26] */ &$rgszNames,
/* VT_UINT [23] [in] */ $cNames,
/* VT_UI4 [19] [in] */ $lcid,
/* VT_PTR [26] [out] --> VT_I4 [3] */ &$rgdispid
)
{
}
/* DISPID=1610678275 */
function Invoke(
/* VT_I4 [3] [in] */ $dispidMember,
/* VT_PTR [26] [in] --> ? [29] */ &$riid,
/* VT_UI4 [19] [in] */ $lcid,
/* VT_UI2 [18] [in] */ $wFlags,
/* VT_PTR [26] [in] --> ? [29] */ &$pdispparams,
/* VT_PTR [26] [out] --> VT_VARIANT [12] */ &$pvarResult,
/* VT_PTR [26] [out] --> ? [29] */ &$pexcepinfo,
/* VT_PTR [26] [out] --> VT_UINT [23] */ &$puArgErr
)
{
}
/* DISPID=1610809345 */
function CambiaEmpresa(
/* VT_PTR [26] [in][out] --> VT_I2 [2] */ &$intEmpresa
)
{
}
/* DISPID=1610809346 */
function InicializaOEM(
/* VT_PTR [26] [in][out] --> VT_I2 [2] */ &$intEmpresa,
/* VT_PTR [26] [in][out] --> VT_BSTR [8] */ &$sUserName,
/* VT_PTR [26] [in][out] --> VT_BSTR [8] */ &$sPassword,
/* VT_PTR [26] [in][out] --> VT_BSTR [8] */ &$sProvider,
/* VT_PTR [26] [in][out] --> VT_BSTR [8] */ &$sDataSource,
/* VT_PTR [26] [in][out] --> VT_BSTR [8] */ &$sCatalog
)
{
}
Can someone explain me how the InicializaOEM function works, please? And why shows the comments before the variables??
Any idea is very wellcome.