# asp post xml

what is the operation that will send this to another server getway?
i mean i want that when user will submit some operation-for example he will submit some form...
that this xml will be posted

<%
Dim objXMLHTTP, URL, params
URL = "http://00.000.000.00:1111"

Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

objXMLHTTP.Open "POST", URL & "?q=s", False

params = "x-up-ntfn-channel=push&x-up-ntfn-ttl=0&x-up-subno=123456789_yuc3.vont.com"
params = params & "&x-up-upnotifyp-version=upnotifyp/3.0"

objXMLHTTP.Send params

Response.Write objXMLHTTP.responseText
%>

URL obfuscated by modus_operandi, EE Moderator

###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Try this:

params = "&x-up-ntfn-channel=push&x-up-ntfn-ttl=0&x-up-subno=123456789_yuc3.vont.com"
params = params & "&x-up-upnotifyp-version=upnotifyp/3.0"
objXMLHTTP.Open "POST", URL & "?q=s" & params, False

Just add any other vars to your params value in the format &fieldname=fieldvalue

Stilgar.
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
like this:
<%
Dim objXMLHTTP, URL, params
URL = "http://00.000.000.00:1111"

Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

params = "&x-up-ntfn-channel=push&x-up-ntfn-ttl=0&x-up-subno=123456789_yuc3.vont.com"
params = params & "&x-up-upnotifyp-version=upnotifyp/3.0"
objXMLHTTP.Open "POST", URL & "?q=s" & params, False

objXMLHTTP.Send params

Response.Write objXMLHTTP.responseText
%>

i am sure i got you wrong...
???
URL obfuscated by modus_operandi, EE Moderator

0
Commented:
Yes, though there is no need for params when calling .Send, so:

objXMLHTTP.Send

Response.Write objXMLHTTP.responseText
%>

Unless I got YOU wrong?

Stilgar.
0
Author Commented:
if i got your question right -then it got to be send to another server and not to be print on screen...

0
Commented:
What are you trying to do exactly?
0
Author Commented:
error '80004005'
<%
Dim objXMLHTTP, URL, params
URL = "http://00.000.000.00:0000"

Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

params = "&x-up-ntfn-channel=push&x-up-ntfn-ttl=0&x-up-subno=6778991584-177831_wpu.solyr.com"
params = params & "&x-up-upnotifyp-version=upnotifyp/3.0"

objXMLHTTP.Send params

Response.Write objXMLHTTP.responseText
%>

0
Author Commented:
its the same error i got before when i tested the code that i snipped here

when i use
URL = "http://ip:port"
i get

msxml3.dll error '800c0005'

The system cannot locate the resource specified.
<%
Dim objXMLHTTP, URL, params

Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

objXMLHTTP.Open "POST", URL, False

params = "x-up-ntfn-channel=push&x-up-ntfn-ttl=0&x-up-subno=96761589-1131_wap.conty.com"
params = params & "&x-up-upnotifyp-version=upnotifyp/3.0"

objXMLHTTP.Send params

Set objXMLHTTP = Nothing
%>

0
Author Commented:
i am need to http post to another server ip: 00.000.000.00 port 1111
variables:
Content-Location: http://www.domain.com
Content-Length: 100
x-up-upnotifyp-version: upnotifyp/3.0
x-up-subno: 123456789_yuc3.vont.com
x-up-ntfn-ttl: 0
x-up-ntfn-channel: push

URL obfuscated by modus_operandi, EE Moderator

0
Commented:
>>i am need to http post to another server ip: 00.000.000.00 port 1111

Not with XMLHTTP, you don't :-(
0
Commented:
@Badotz - wrong. You can do HTTP post to another server with XMLHTTP.

http://support.microsoft.com/kb/290591
http://www.4guysfromrolla.com/webtech/110100-1.2.shtml

The above uses POST (so the accepting page should get them using Request.form or similar, not querystring).

Stilgar.
0
Commented:
oh, sorry - same DOMAIN, different servers - my bad.
0
Author Commented:
friends, any chance that you can help me here?:)
0
Commented:
See if the attached function solves the issue. You would use it as follows:

mydata = getPage("http://www.site.com:81","batch=" & Server.URLEncode(IDS) )

Notice how I am encoding the IDS variable prior to passing it to the getPage function. Also make sure you are able to get to the url in question by using a regular browser. If the page is offline it will not work.

Also, I am not using the Microsoft.XMLHTTP object.
function getPage(sourceURL,params)
set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", sourceURL, False  xmlServerHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlServerHttp.send params
getPage = xmlServerHttp.responsetext
Set xmlServerHttp = Nothing
end function

0
Commented:
Have you seen the links I posted above?

Stilgar.
0
Author Commented:
stilgar, ethat the same as mt xml code...what exactly do i need to change?
0
Commented:
server.createObject("MSXML2.ServerXMLHTTP.4.0")

There are many versions for this. Google for MSXML HTTP, or ServerXMLHTTP. Win 2k3 Server, XP and Vista has different versions.

Stilgar.
0
Author Commented:
msxml4.dll error '80072efd'

A connection with the server could not be established

why??
0
Author Commented:
i need to send those:

when i use:

i have:
msxml4.dll error '80072ee5'

The URL is invalid

why?

URL obfuscated by modus_operandi, EE Moderator

0
Commented:
Try this:

If you're expecting the other parameters to contain non-alphanumeric chars, URLEncode them as well.
URL obfuscated by modus_operandi, EE Moderator

0
Author Commented:
what do you mean-my title need to have the word "anything"

is that not the right way to send those words?

i tried that:

=
msxml4.dll error '80072ee5'

The URL is invalid
0
Commented:
I do hope you're not using http://00.00.00.00:0000 as the URL?

If you don't, then this should work:

set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "GET", "http://yoururlhere", False  xmlServerHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
getPage = xmlServerHttp.responsetext
Set xmlServerHttp = Nothing

Stilgar.
URL obfuscated by modus_operandi, EE Moderator

0
Author Commented:

don't sure what i need to learn from your code, it is GET(i need post)+responsetext(i need server2server,no screen output)+do not iclude other needed variables(i got 10 of them- ID: 20858223),Server.URLEncode(i already told that i was having the same problem with it)...

those all variables need to be send via POST
0
Commented:
These snippets above are everything you need believe me. Its enough to get you started.

set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", "http://00.00.00.00:0000", False
Set xmlServerHttp = Nothing

This should work. If its not post the error here.

Stilgar.
0
Author Commented:
what with
x-up-subno: 123456789_yuc3.vont.com
x-up-ntfn-ttl: 0
x-up-ntfn-channel: push

what is the syntax for them
?
0
Author Commented:

?
0
Commented:
Yes, if you want them accessed using request.querystring / request.form (or parallels in different server side technologies) from the remote page.

If you want to set them as headers (which I think thats the case since they start with x- ), use:

Stilgar.
0
Author Commented:
like this?
  set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", "http://00.00.00.00:0000", False

Set xmlServerHttp = Nothing

0
Commented:
Yes
0
Author Commented:
msxml4.dll error '80072efd'

A connection with the server could not be established

:(((((
Dim xmlServerHttp
set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", "http://00.00.00.00:0000", False

Set xmlServerHttp = Nothing

0
Commented:
Can you open the URL you're posting to in a browser? If you can, the component might have some permission issues on your server - try using a different version. If you can't, well, what would you expect?

Stilgar.
0
Author Commented:
if i will make response.redirect "http://00.00.00.00:0000" on asp page and save it on the server...and will view the page from another computer...will it count as connecting to this url?

(i am working from hpst acount)
0
Commented:
You lost me somewhere there... lets just say that as long as the IP and Port are open for HTTP and you can access it the issue is with the XMLHTTP object, but you'll need to make sure the XMLHTTP object on the server can connect to that IP and Port.
0
Author Commented:
why do i need "http:/"
when i remove it i get:

msxml4.dll error '80072ee6'

The URL does not use a recognized protocol

0
Author Commented:
i mean http:/ is port80 and i need to send to diffrent port...
0
Commented:
No HTTP is the protocol. Ports 80, 81 and 8081 are its default ports. Keep it.

Stilgar.
0
Author Commented:

i was told to include this but i got no idea wht it is, may be that is the reason - how we can set the protocol that is not recognized here?
0
Author Commented:
how can i make sure the XMLHTTP object on the server can connect to that IP and Port if i am connecting to the server via ftp from my home?

i can create a file that will check this...i asked i can check this with response.redirect?
0
Commented:
Look, I'm trying to help you but you will not let me do that. Stop going off the track. When working with high-level language such as ASP and objects like XMLHTTP all you need to do is create an object and call "Send" after setting some properties. You need not include that statement above, as it is being generated by XMLHTTP object in the packets it sends.

Stilgar.
0
Author Commented:
i will do everything you will tell me to do...
how can i check if my server can connecte the ip+port as you told me if if i am using web host acount?
(if it was my home server i would just open browser and view but here i got no access, i just can create files and store them on the server with ftp connection)
0
Commented:
Try to access this address first using the net connection on your local machine, see if returns anything at all.

0
Author Commented:
yes but i don't know what i got to do than?
0
Author Commented:
when i am opening my browser and type:
http://00.00.00.00:0000 i get The page cannot be displayed
but my ip is not the servers ip...
0
Commented:
Can you access that URL or not?

Also, look here: http://www.experts-exchange.com/Web/Web_Languages/XML/Q_21229518.html

Stilgar.
0
Commented:
>>http://00.00.00.00:0000 i get The page cannot be displayed

This should come as no surprise...

Change the URL to that of your other server and give it a shot?
0
Author Commented:
stilgar, please tell me how can i check this?
i told you when i open my browser at home and go to the  http://ip:port , i see "The page cannot be displayed"
0
Commented:
This is probably why you're getting that error, since the IP:Port is invalid or unreachable. Make sure you make a post to a valid address. For example, just to test your code point it to some page you can access from home and see if it still errors or not.

Stilgar.
0
Commented:
>>when i am opening my browser and type: http://00.00.00.00:0000 i get The page cannot be displayed but my ip is not the servers ip
This is definitely the source of the problem. You MUST provide the correct ip or domain with the correct port. The IP gets the request to the remote machine. The port number identifies the program/service on the remote machine that should server/"respond to" your request. Typically when you type http://www.yoursite.com/, the browser aut0matically sends the request to http://www.yoursite.com:80/ but if the web server on the remote machine is not running on port 80, your request will not be "serviced". Your problem is that You are providing the incorrect IP or domain or port OR the remote machine may be accepting requests on the specified port only from a few select clients, one of which is not you!
0
Author Commented:
i am sending this and get no error, does it means that the connection with the remote server is fine?

<%

Dim params,mydata

mydata = getPage("http://00.000.000.00:4445",params)

function getPage(sourceURL,params)
set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", sourceURL, False

Set xmlServerHttp = Nothing
end function

%>
0
Author Commented:
by the way,
i used :  getPage = xmlServerHttp.responsetext
in my original code...

why do i have to sent responsetext if i don't wait for response and not sending via\to screen?
0
Commented:
getPage = xmlServerHttp.responsetext

This waits for the server to complete your transaction, and stuffs the TEXT value into getPage.
0
Commented:
>>i am sending this and get no error, does it means that the connection with the remote server is fine?
Print the whatever was returned by getPage:
mydata = getPage("http://00.000.000.00:4445",params)
Response.Write( "Returned data from remote server : " & mydata)
0
Author Commented:
msxml4.dll error 'c00c023f'

This method cannot be called until the send method has been called.

<%
Dim params,mydata

mydata = getPage("http://00.000.000.00:4445",params)
Response.Write( "Returned data from remote server : " & mydata)

function getPage(sourceURL,params)
set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", sourceURL, False
getPage = xmlServerHttp.responsetext
Set xmlServerHttp = Nothing
end function
%>

0
Commented:
This:
function getPage(sourceURL,params)
set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", sourceURL, False
getPage = xmlServerHttp.responsetext
Set xmlServerHttp = Nothing
end function

Is NOT what I gave you. What did you do with xmlServerHttp.send(params)? Why must you break the working code that I give you? :)

This:
>>getPage = xmlServerHttp.responsetext
>>This waits for the server to complete your transaction, and stuffs the TEXT value into getPage.
is misleading. The FALSE argument in:
xmlServerHttp.Open "POST", sourceURL, False
is what makes YOUR server wait for the REMOTE server to finish. When this executes:
getPage = xmlServerHttp.responsetext

The remote server already sent the data to YOUR server. That line is just assigning the returned data to getPage, since getPage is a function and in VB function need to return something.
0
Commented:
0
Commented:
Sorry, hielo, I'll bow out.
0
Author Commented:
sorry i try to learn by heart all the commands and i write them, this time i fix it...

i recieved the error:
msxml4.dll error '80072efd'

A connection with the server could not be established

where is the problem than? my server\remote server?
<%
Dim params,mydata

mydata = getPage("http://00.000.000.00:4445",params)
Response.Write( "Returned data from remote server : " & mydata)

function getPage(sourceURL,params)
set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
xmlServerHttp.Open "POST", sourceURL, False
xmlServerHttp.send params
getPage = xmlServerHttp.responsetext
Set xmlServerHttp = Nothing
end function
%>

0
Commented:
Sasha, it all comes to the same error every time, and both me and hielo told you what to do with it. As far as I can tell, your URL is invalid/not connected.

Stilgar.
0
Author Commented:
i just have to ask one more time to be sure, can it be the problem of my server?
0
Commented:
I'm 99% sure the problem is with the server you're posting TO, and not FROM.

Stilgar.
0
Commented:
One last comment:

getPage = xmlServerHttp.responsetext

should be:

getPage = xmlServerHttp.responseText
0
Author Commented:
t>T?
why?
0
Commented:
Because that is how the property is accessed, that's why. "responsetext" is not a valid property name; "responseText" is.
0
Author Commented:
that could be the problem for : "A connection with the server could not be established "?
0
Commented:
It could be the problem where the server appears to not return data from the Ajax call.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.