Pocket PC Networking >> XMLHTTP doesn't work, I'm getting access denied

by U2hsb21p » Wed, 16 Feb 2005 21:21:04 GMT

Hello,

I need to write a web application for my pocket PC, here is part of the
code I'm using:

xrequest = new ActiveXObject("Microsoft.XMLHTTP");
xrequest.open("POST",url,true );

I'm getting access denied when trying to execute the open method.

The same code works fine when running it using scripting host on the same
pocket PC. Also, the same code works fine on another iPaq I have that uses
win CE 4

Trying to change the security setting in the registry didn't help.

Can someone please help

Thanks,
Shlomi



Pocket PC Networking >> RE: XMLHTTP doesn't work, I'm getting access denied

by a-nlewis » Thu, 17 Feb 2005 02:52:46 GMT


This is a known problem which affects certain builds of Pocket PC 2003 and
all builds of Pocket PC 2003 Second Edition. The workaround is pretty
complicated, and involves creating an ActiveX control using ATL and
embedding it in the web page. Other than the complexity of the workaround,
the main disadvantage to this approach is that it means your end users must
download, install and register the ActiveX control before they can use your
HTML content. Unfortunately, there is no other way around the problem.

If you are familiar with creating ATL controls, the process is pretty
straightforward. Start by creating an ATL project and add a simple object
to it - let's call the control "ComAdapter" and the object "ComObject".
Then add the following method to the object:

STDMETHODIMP GetInterface
(
/*[in]*/ BSTR bstrObj, // Name of the object
/*[out, retval]*/ VARIANT *pvarObj // Returned object
)
{
CComPtr<IDispatch> pObj;
IDispatch* pDispatch = NULL;
HRESULT hr = pObj.CoCreateInstance( bstrObj );

if( SUCCEEDED( hr ) )
{
if( pObj )
hr = pObj->QueryInterface( IID_IDispatch,
(void**)&pDispatch );
else
hr = E_NOINTERFACE;
}

VariantClear( pvarObj );
V_VT( pvarObj ) = VT_DISPATCH;
V_DISPATCH( pvarObj ) = pDispatch;

return hr;
}

Finally, you will need to make some changes to your HTML code - something
like this:

var objXML = new ActiveXObject( "ComAdapter.ComObject" );
var objRealXML = objXML.GetInterface( "Microsoft.XMLHTTP" );
objRealXML.open( "POST", url, true );


---

Nathan Lewis
Microsoft Mobile and Embedded Devices Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?U2hsb21p?= < XXXX@XXXXX.COM >
Subject: XMLHTTP doesn't work, I'm getting access denied
Date: Wed, 16 Feb 2005 05:21:04 -0800


Hello,

I need to write a web application for my pocket PC, here is part of the
code I'm using:

xrequest = new ActiveXObject("Microsoft.XMLHTTP");
xrequest.open("POST",url,true );

I'm getting access denied when trying to execute the open method.

The same code works fine when running it using scripting host on the same
pocket PC. Also, the same code works fine on another iPaq I have that uses
win CE 4

Trying to change the security setting in the registry didn't help.

Can someone please help

Thanks,
Shlomi


{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs20 This is a known problem which affects certain builds of Pocket PC 2003 and all builds of Pocket PC 2003 Second Edition. The workaround is pretty complicated, and involves creating an ActiveX control using ATL and embedding it in the web page. Other than the complexity of the workaround, the main disadvantage to this approach is that it means your end users must download, install and register the ActiveX control before they can use your HTML content. Unfortunately, there is no other way around the problem.
\par
\par If you are familiar with creating ATL controls, the process is pretty straightforward. Start by creating an ATL project and add a simple object to it - let's call the control "ComAdapter" and the object "ComObject". Then add


Pocket PC Networking >> RE: XMLHTTP doesn't work, I'm getting access denied

by a-nlewis » Tue, 22 Feb 2005 04:48:49 GMT

FYI - Further information can be found in the thread with the same subject
as this one in the microsoft.public.pocketpc.developer newsgroup.


---

Nathan Lewis
Microsoft Mobile and Embedded Devices Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: XXXX@XXXXX.COM (Nathan Lewis)
Date: Wed, 16 Feb 2005 18:52:46 GMT
Subject: RE: XMLHTTP doesn't work, I'm getting access denied


This is a known problem which affects certain builds of Pocket PC 2003 and
all builds of Pocket PC 2003 Second Edition. The workaround is pretty
complicated, and involves creating an ActiveX control using ATL and
embedding it in the web page. Other than the complexity of the workaround,
the main disadvantage to this approach is that it means your end users must
download, install and register the ActiveX control before they can use your
HTML content. Unfortunately, there is no other way around the problem.

If you are familiar with creating ATL controls, the process is pretty
straightforward. Start by creating an ATL project and add a simple object
to it - let's call the control "ComAdapter" and the object "ComObject".
Then add the following method to the object:

STDMETHODIMP GetInterface
(
/*[in]*/ BSTR bstrObj, // Name of the object
/*[out, retval]*/ VARIANT *pvarObj // Returned object
)
{
CComPtr<IDispatch> pObj;
IDispatch* pDispatch = NULL;
HRESULT hr = pObj.CoCreateInstance( bstrObj );

if( SUCCEEDED( hr ) )
{
if( pObj )
hr = pObj->QueryInterface( IID_IDispatch,
(void**)&pDispatch );
else
hr = E_NOINTERFACE;
}

VariantClear( pvarObj );
V_VT( pvarObj ) = VT_DISPATCH;
V_DISPATCH( pvarObj ) = pDispatch;

return hr;
}

Finally, you will need to make some changes to your HTML code - something
like this:

var objXML = new ActiveXObject( "ComAdapter.ComObject" );
var objRealXML = objXML.GetInterface( "Microsoft.XMLHTTP" );
objRealXML.open( "POST", url, true );


---

Nathan Lewis
Microsoft Mobile and Embedded Devices Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?U2hsb21p?= < XXXX@XXXXX.COM >
Subject: XMLHTTP doesn't work, I'm getting access denied
Date: Wed, 16 Feb 2005 05:21:04 -0800


Hello,

I need to write a web application for my pocket PC, here is part of the
code I'm using:

xrequest = new ActiveXObject("Microsoft.XMLHTTP");
xrequest.open("POST",url,true );

I'm getting access denied when trying to execute the open method.

The same code works fine when running it using scripting host on the same
pocket PC. Also, the same code works fine on another iPaq I have that uses
win CE 4

Trying to change the security setting in the registry didn't help.

Can someone please help

Thanks,
Shlomi




{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs20 FYI - Further information can be found in the thread with the same subject as this one in the microsoft.public.pocketpc.developer newsgroup.
\par
\par
\par ---
\par
\par Nathan Lewis
\par Microsoft Mobile and Embedded Devices Developer Support
\par
\par This posti

Similar Threads

1. XMLHTTP doesn't work, I'm getting access denied

Hello,

 I need to write a web application for my pocket PC, here is part of the 
code I'm using:

xrequest = new ActiveXObject("Microsoft.XMLHTTP");
xrequest.open("POST",url,true );

I'm getting access denied when trying to execute the open method.

The same code works fine when running it using scripting host on the same 
pocket PC. Also, the same code works fine on another iPaq I have that uses 
win CE 4

Trying to change the security setting in the registry didn't help.

Can someone please help

Thanks,
 Shlomi