473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

XmlHttp can access webservices from javascript, but not from within applications?

Hi All,

After creating an end-point with batches enabled using SQL Server 2005,
I can easily query a database and have xml returned from within
javascript using something like Pablo's code (below).

But, if I try the same code from VB6 or VB.NET (a straight forward port
- swap ActiveXObject for CreateObject, remove ';'s etc) I always get
'Incorrect Parameter' on the send method of xmlhttp.

Why should it work from script but not applications, could it be that
the request headers need to be different or are somehow 'more correct'
when issued from within an ecma environment?

Many thanks,

Duncan.

---Javascript sample:
http://weblogs.asp.net/cibrax/archiv...403868.aspx---
function SendBatchRequest( strServerName, strUrlPath, strQuery )
{
var objXmlHttp = null;
var strRequest = "";

objXmlHttp = new ActiveXObject( "microsoft.xmlhttp" );
objXmlHttp.open( "POST", "http://" + strServerName + strUrlPath,
false );
objXmlHttp.setrequestheader( "Content-Type", "text/xml" );
objXmlHttp.setRequestHeader( "Host", strServerName );

strRequest = "<SOAP-ENV:Envelope

xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'

xmlns:sql='http://schemas.microsoft.com/sqlserver/2004/SOAP'>
<SOAP-ENV:Body>
<sql:sqlbatch>
<sql:BatchCommands>" + strQuery +
"</sql:BatchCommands>
</sql:sqlbatch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>";

objXmlHttp.send( strRequest );

if( objXmlHttp.status == 200 )
return objXmlHttp.responseXML.xml;
else
return "";
}

var response = SendBatchRequest( 'localhost', '/sql/myendpoint',
'Select * from sys.http_endpoints' );
------

Mar 15 '06 #1
1 1590
Could you provide the VB repro that does not work?

<DS********@googlemail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Hi All,

After creating an end-point with batches enabled using SQL Server 2005,
I can easily query a database and have xml returned from within
javascript using something like Pablo's code (below).

But, if I try the same code from VB6 or VB.NET (a straight forward port
- swap ActiveXObject for CreateObject, remove ';'s etc) I always get
'Incorrect Parameter' on the send method of xmlhttp.

Why should it work from script but not applications, could it be that
the request headers need to be different or are somehow 'more correct'
when issued from within an ecma environment?

Many thanks,

Duncan.

---Javascript sample:
http://weblogs.asp.net/cibrax/archiv...403868.aspx---
function SendBatchRequest( strServerName, strUrlPath, strQuery )
{
var objXmlHttp = null;
var strRequest = "";

objXmlHttp = new ActiveXObject( "microsoft.xmlhttp" );
objXmlHttp.open( "POST", "http://" + strServerName + strUrlPath,
false );
objXmlHttp.setrequestheader( "Content-Type", "text/xml" );
objXmlHttp.setRequestHeader( "Host", strServerName );

strRequest = "<SOAP-ENV:Envelope

xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'

xmlns:sql='http://schemas.microsoft.com/sqlserver/2004/SOAP'>
<SOAP-ENV:Body>
<sql:sqlbatch>
<sql:BatchCommands>" + strQuery +
"</sql:BatchCommands>
</sql:sqlbatch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>";

objXmlHttp.send( strRequest );

if( objXmlHttp.status == 200 )
return objXmlHttp.responseXML.xml;
else
return "";
}

var response = SendBatchRequest( 'localhost', '/sql/myendpoint',
'Select * from sys.http_endpoints' );
------

Apr 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: mikeyjudkins | last post by:
Ive been banging my head on the wall for hours with this one, hopefully someone will know what Im doing wrong here :\ The Goal: I have an xml file that is generated on the fly via JSP which I...
6
by: WhenAmIOn.com | last post by:
Hi all, I developed a web site that uses javascript and XMLHTTP to dynamically load info on the page from the server without having to re-load the page. Recently I've received complaints of it...
5
by: bboyle18 | last post by:
Hi, I've been looking into the possibility of using XMLHTTP for my enterprise application but I still have a question. When you send the request to the server, how does the server know how to...
7
by: Fabri | last post by:
I'm trying to develop a way to include static files in htm pages with javascript. I'm trying to use XMLHTTP object this way: ...
9
by: fochie | last post by:
Greetings, I'm having a problem when I try to GET a file from my server via xmlhttp when using Mozilla. With IE I can get any type of file fine, get/display headers fine, etc. With Mozilla,...
13
by: yawnmoth | last post by:
<http://www.quirksmode.org/book/printable/xmlhttp.txtshows two alternatives to Microsoft.XMLHTTP - Msxml2.XMLHTTP and Msxml3.XMLHTTP. If my understanding is correct, the different numbers refer to...
1
by: wkerplunk | last post by:
Below is what I have build with several different languages. It works great but I need help, I am stuck. When you click on an item in the dropdown autocomplete div it does a mousedown function...
4
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my...
2
by: trpost | last post by:
Is it possible to execute javascript as passed in xmlHttp.responseText Here is what I am doing: search.js var xmlHttp xmlHttp=GetXmlHttpObject() var url="search.php"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.