473,386 Members | 1,823 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,386 software developers and data experts.

msxml2.serverXMLhttp and response.binarywrite

Question:
I get the eror listed at the bottom of the post. What can I do to
make the response of the x1.send a "binary" type? Or, in general,
how can I just "make this work"?

<%@ Language=VBScript %>
<%
Response.Buffer = TRUE
Response.ContentType = "image/jpg"

Set x1 = Server.CreateObject("Msxml2.ServerXMLHTTP")
x1.open "GET", "[http link to your favorite image.jpg]", FALSE
x1.send

Response.BinaryWrite x1.responsestream
set x1 = nothing
%>
Error is returned below:

'Response object error 'ASP 0106 : 80020005'
'Type Mismatch
'/scraps/getGraphic.asp, line 10
'An unhandled data type was encountered.
Oct 16 '05 #1
5 17816
<katrinaVictim@.> wrote in message
news:to********************************@4ax.com...
Question:
I get the eror listed at the bottom of the post. What can I do to
make the response of the x1.send a "binary" type? Or, in general,
how can I just "make this work"?

<%@ Language=VBScript %>
<%
Response.Buffer = TRUE
Response.ContentType = "image/jpg"

Set x1 = Server.CreateObject("Msxml2.ServerXMLHTTP")
x1.open "GET", "[http link to your favorite image.jpg]", FALSE
x1.send

Response.BinaryWrite x1.responsestream
set x1 = nothing
%>
Error is returned below:

'Response object error 'ASP 0106 : 80020005'
'Type Mismatch
'/scraps/getGraphic.asp, line 10
'An unhandled data type was encountered.


Try xl.ResponseBody
You can read the response using one of four properties.
responseBody
responseStream
responseText
responseXML
http://www.eggheadcafe.com/articles/20010114.asp
ResponseBody Variant array
Returns the body of the response as an array.
ResponseStream IStream
Returns the body of the response as an ADO Stream object.
ResponseText String
Returns the body of the response as a text string.
ResponseXML XMLDocument Object
Returns the body of the response as parsed by the MSXML XMLDOM parser.
http://www.sxlist.com/techref/langua...wwwextract.htm
Oct 16 '05 #2

<katrinaVictim@.> wrote in message
news:to********************************@4ax.com...
Question:
I get the eror listed at the bottom of the post. What can I do to
make the response of the x1.send a "binary" type? Or, in general,
how can I just "make this work"?

<%@ Language=VBScript %>
<%
Response.Buffer = TRUE
Response.ContentType = "image/jpg"

Set x1 = Server.CreateObject("Msxml2.ServerXMLHTTP")
x1.open "GET", "[http link to your favorite image.jpg]", FALSE
x1.send

Response.BinaryWrite x1.responsestream
set x1 = nothing
%>
Error is returned below:

'Response object error 'ASP 0106 : 80020005'
'Type Mismatch
'/scraps/getGraphic.asp, line 10
'An unhandled data type was encountered.


Try:

Response.BinaryWrite x1.responsestream.Read()
-Mark


Oct 16 '05 #3
<katrinaVictim@.> wrote in message
news:to********************************@4ax.com...
: Question:
: I get the eror listed at the bottom of the post. What can I do to
: make the response of the x1.send a "binary" type? Or, in general,
: how can I just "make this work"?
:
: <%@ Language=VBScript %>
: <%
: Response.Buffer = TRUE
: Response.ContentType = "image/jpg"
:
: Set x1 = Server.CreateObject("Msxml2.ServerXMLHTTP")
: x1.open "GET", "[http link to your favorite image.jpg]", FALSE
: x1.send
:
: Response.BinaryWrite x1.responsestream
: set x1 = nothing
: %>
:
:
: Error is returned below:
:
: 'Response object error 'ASP 0106 : 80020005'
: 'Type Mismatch
: '/scraps/getGraphic.asp, line 10
: 'An unhandled data type was encountered.

Some routines to help you. Get the image via HTTPRequest, save it and
reload it.

http://kiddanger.com/lab/getaspimage.asp

View the source with your browser to see how the file is called. Then click
on the link at the bottom of the page 'view source' to view the source of
the file that does the work.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Oct 17 '05 #4
On Sun, 16 Oct 2005 01:50:25 -0500, "McKirahan" <Ne**@McKirahan.com>
wrote:
<katrinaVictim@.> wrote in message
news:to********************************@4ax.com.. .
Question:
I get the eror listed at the bottom of the post. What can I do to
make the response of the x1.send a "binary" type? Or, in general,
how can I just "make this work"?

<%@ Language=VBScript %>
<%
Response.Buffer = TRUE
Response.ContentType = "image/jpg"

Set x1 = Server.CreateObject("Msxml2.ServerXMLHTTP")
x1.open "GET", "[http link to your favorite image.jpg]", FALSE
x1.send

Response.BinaryWrite x1.responsestream
set x1 = nothing
%>
Error is returned below:

'Response object error 'ASP 0106 : 80020005'
'Type Mismatch
'/scraps/getGraphic.asp, line 10
'An unhandled data type was encountered.


Try xl.ResponseBody
You can read the response using one of four properties.
responseBody
responseStream
responseText
responseXML
http://www.eggheadcafe.com/articles/20010114.asp
ResponseBody Variant array
Returns the body of the response as an array.
ResponseStream IStream
Returns the body of the response as an ADO Stream object.
ResponseText String
Returns the body of the response as a text string.
ResponseXML XMLDocument Object
Returns the body of the response as parsed by the MSXML XMLDOM parser.
http://www.sxlist.com/techref/langua...wwwextract.htm


You're correct. Response.body does return the graphic to the browser
if NO html surrounds the functional code.

I had left in the <html><body>....</body></html> tags around the
VBScript above before I posted to the newsgroup (whoops), and when
doing this the browser then interprets the content as "text". Try
putting in a mere <html> tag before the code and you'll get a bunch of
extended ascii and stuff in the browser when using responseBody.

See, here's my issue. I have graphics that are availabe on an
e-commerce drop ship suppliers web server. There are huge numbers of
them... I can't download them all. I can simply use a <img> tag to
get graphics on my web pages by pointing to their "http://[their
webserver]/[image].gif", but that means that hackers and others can
simply "decompose" my webpages and see that I'm just a downline
supplier to a wholesale distributor. The "domain" of the graphics
location will be different than my domain.

So I wanna transport the graphic to the page by a webserver to
webserver call from my domain. And, I need to be able to give the
ServerXMLHTTP function a dynamic http:// string within the script...

I've already tried server.execute, but I can't use a querystring with
that... I've tried response.contenttype ... I need to be able to get
the link to the graphic from the database then parse it into a string
and dynamically make an http:// call out the their webserver and then
binarywrite it back to the location on the page, intermingling the
graphic stream with other returned html...

I wish this would work.
Oct 17 '05 #5
<katrinaVictim@.> wrote in message
news:ll********************************@4ax.com...
On Sun, 16 Oct 2005 01:50:25 -0500, "McKirahan" <Ne**@McKirahan.com>
wrote:
[snip]
You're correct. Response.body does return the graphic to the browser
if NO html surrounds the functional code.

I had left in the <html><body>....</body></html> tags around the
VBScript above before I posted to the newsgroup (whoops), and when
doing this the browser then interprets the content as "text". Try
putting in a mere <html> tag before the code and you'll get a bunch of
extended ascii and stuff in the browser when using responseBody.

See, here's my issue. I have graphics that are availabe on an
e-commerce drop ship suppliers web server. There are huge numbers of
them... I can't download them all. I can simply use a <img> tag to
get graphics on my web pages by pointing to their "http://[their
webserver]/[image].gif", but that means that hackers and others can
simply "decompose" my webpages and see that I'm just a downline
supplier to a wholesale distributor. The "domain" of the graphics
location will be different than my domain.

So I wanna transport the graphic to the page by a webserver to
webserver call from my domain. And, I need to be able to give the
ServerXMLHTTP function a dynamic http:// string within the script...

I've already tried server.execute, but I can't use a querystring with
that... I've tried response.contenttype ... I need to be able to get
the link to the graphic from the database then parse it into a string
and dynamically make an http:// call out the their webserver and then
binarywrite it back to the location on the page, intermingling the
graphic stream with other returned html...

I wish this would work.


Take a look at this. Watch for word-wrap.

Create a folder called "images" under the folder that this file is in.
<%@ Language=VBScript %>
<% Option Explicit

Function Fetch(URL)
On Error Resume Next
Err.Clear
'*
'* Get Image
'*
Dim objXML
'Set objXML = Server.CreateObject("Msxml2.ServerXMLHTTP")
Set objXML = Server.CreateObject("Microsoft.XMLHTTP")
objXML.Open "GET",URL,False
objXML.Send
Dim binXML
binXML = objXML.ResponseBody
If Err.Number <> 0 _
Or objXML.Status <> 200 Then
Fetch = False
Exit Function
End If
Set objXML = Nothing
'*
'* Put Image
'*
Dim strIMG
strIMG = "images\" & Mid(xURL,InStrRev(URL,"/")+1)
Dim objADO
Set objADO = CreateObject("ADODB.Stream")
objADO.Type = 1
objADO.Open
objADO.Write binXML
objADO.SaveToFile Server.MapPath(strIMG),2
Set objADO = Nothing
'Fetch = Err.Number = 0
Fetch = strIMG
End Function
%>
<html>
<body>
<img src="<%=Fetch("http://www.google.com/intl/en/images/logo.gif")%>"
border="0" alt="">
</body>
</html>
Oct 17 '05 #6

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

Similar topics

1
by: ehilario | last post by:
Thanks Mark, That 's better than internal server error. This is what came back, which is confusing because when its called locally it comes back fine. Am I missing something? -Ed
2
by: Michael Christensen | last post by:
Hi How do I send an input-param to my web service with MSXML2.ServerXMLHTTP? Can this be done without the soap-toolkit? Can't find anything about it - looking forward getting some help :-)...
0
by: Sia Jai Sung | last post by:
Hi, I need to write a ASPX file that will post some request to other party (web service written in java), here is my code, <%@ Page aspcompat=true %> <% Dim xml, url
1
by: Raúl Martín | last post by:
I´ve a function in asp that run correctly but If I tried to change it forasp.net in asp: xmlHTTP = CreateObject("Microsoft.XMLHTTP") And I thought to use this sentence for asp.net but the...
2
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking...
5
by: twiggy182 | last post by:
Hi, I really need you help because I'm not very familliar with ASP and I could not find any solution to my problem. To put you in situation, I have a CGI to which I send a file name, and that...
8
by: lopi | last post by:
Hello. I'm trying to remotely get a pdf file - http://remoteServer/file.pdf - in order to store it into another server, maybe with Scripting.FileSystemObject However the following code doesn't...
3
by: dfordinal | last post by:
I am calling a remote web server and awaiting data that is being passed back to my process in a form variable. postData = "fname=John" Set xmlHttp =...
0
by: Quickzilverfox | last post by:
I am attempting to send a purchase request string to a webservice on a remote site I am able to successfully send the quoterequest using Msxml2.ServerXMLHTTP on one page and parse the response. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.