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
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=US-ASCII" 
objXMLHTTP.setRequestHeader "Content-Location", "http://www.domain.com"
 
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

Open in new window

sasha85Asked:
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.

_Stilgar_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

Your issues matter to us.

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

Start your 7-day free trial
sasha85Author 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.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=US-ASCII"
objXMLHTTP.setRequestHeader "Content-Location", "http://www.domain.com"

objXMLHTTP.Send params
 
Response.Write objXMLHTTP.responseText
%>

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

Open in new window

0
_Stilgar_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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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

0
_Stilgar_Commented:
What are you trying to do exactly?
0
sasha85Author 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.Open "POST", URL & "?Type=alert&Title=anything&URL=http://adf.kolou.com" & params, False
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=US-ASCII"
objXMLHTTP.setRequestHeader "Content-Location", "http://adf.kolou.coml"
 
objXMLHTTP.Send params
 
Response.Write objXMLHTTP.responseText
%>

Open in new window

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


when i use
URL = "http://ip:port"
 without all ?Type=alert&Title=anything&URL=http://abc.domain.com"
i get

msxml3.dll error '800c0005'

The system cannot locate the resource specified.
<%
Dim objXMLHTTP, URL, params
URL = "http://00.00.00.00:0000?Type=alert&Title=anything&URL=http://abc.domain.com"
 
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
 
objXMLHTTP.Open "POST", URL, False
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=US-ASCII" 
objXMLHTTP.setRequestHeader "Content-Location", "http://abc.domain.com"
 
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 
%>

Open in new window

0
sasha85Author Commented:
i am need to http post to another server ip: 00.000.000.00 port 1111
variables:
POST /ntfn/add HTTP/1.0
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
Content-Type: application/x-up-alert;charset=US-ASCII

Type=alert&Title=anything&URL= http://www.domain.com
URL obfuscated by modus_operandi, EE Moderator

Open in new window

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

Not with XMLHTTP, you don't :-(
0
_Stilgar_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
BadotzCommented:
oh, sorry - same DOMAIN, different servers - my bad.
0
sasha85Author Commented:
friends, any chance that you can help me here?:)
0
hieloCommented:
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

Open in new window

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

Stilgar.
0
sasha85Author Commented:
stilgar, ethat the same as mt xml code...what exactly do i need to change?
0
_Stilgar_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
sasha85Author Commented:
msxml4.dll error '80072efd'

A connection with the server could not be established


why??
0
sasha85Author Commented:
i need to send those:
Type=alert&Title=anything&URL=http://abc.domain.com

when i use:
URL = "http://00.00.00.00:0000?Type=alert&Title=anything&URL=http://abc.domain.com"

i have:
msxml4.dll error '80072ee5'

The URL is invalid

why?

URL obfuscated by modus_operandi, EE Moderator

Open in new window

0
_Stilgar_Commented:
Try this:

URL = "http://00.00.00.00:0000?Type=alert&Title=anything&URL="& Server.URLEncode("http://abc.domain.com")

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

Open in new window

0
sasha85Author Commented:
what do you mean-my title need to have the word "anything"
and the type = "alert"

is that not the right way to send those words?

i tried that:
URL = "http://00.00.00.00:0000?Type=alert&Title=anything&URL="& Server.URLEncode("http://abc.potam.com")

=
msxml4.dll error '80072ee5'

The URL is invalid
0
_Stilgar_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"
  xmlServerHttp.send "Type=alert&Title=anything&URL="& Server.URLEncode("http://abc.domain.com")"
  getPage = xmlServerHttp.responsetext
  Set xmlServerHttp = Nothing

Stilgar.
URL obfuscated by modus_operandi, EE Moderator

Open in new window

0
sasha85Author Commented:
i masked the ip+port...

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
_Stilgar_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
  xmlServerHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  ' Add all your variables to the following line.
  xmlServerHttp.send "Type=alert&Title=anything&URL="& Server.URLEncode("http://abc.potam.com")"
  Set xmlServerHttp = Nothing

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

Stilgar.
0
sasha85Author 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
sasha85Author Commented:
 xmlServerHttp.send "x-up-ntfn-channel=push&x-up-ntfn-ttl=0&x-up-subno=123456789_yuc3.vont.com&Type=alert&Title=anything&URL="& Server.URLEncode("http://abc.potam.com")"

?
0
_Stilgar_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:

 xmlServerHttp.setRequestHeader "x-up-ntfn-channel", "push"

Stilgar.
0
sasha85Author Commented:
like this?
  set xmlServerHttp = server.createObject("MSXML2.ServerXMLHTTP.4.0")
  xmlServerHttp.Open "POST", "http://00.00.00.00:0000", False
  xmlServerHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
 
 xmlServerHttp.setRequestHeader "x-up-subno", "123456789_yuc3.vont.com"
 xmlServerHttp.setRequestHeader "x-up-ntfn-ttl", "0"
 xmlServerHttp.setRequestHeader "x-up-ntfn-channel", "push"
 
  xmlServerHttp.send "Type=alert&Title=anything&URL="& Server.URLEncode("http://abc.potam.com")"
  Set xmlServerHttp = Nothing

Open in new window

0
_Stilgar_Commented:
Yes
0
sasha85Author 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
  
 xmlServerHttp.setRequestHeader "Content-Type", "application/x-up-alert;charset=US-ASCII"
 xmlServerHttp.setRequestHeader "Content-Location", "http://abc.potam.com"
 xmlServerHttp.setRequestHeader "Content-Length", "100"
 xmlServerHttp.setRequestHeader "x-up-upnotifyp-version", "upnotifyp/3.0"
 xmlServerHttp.setRequestHeader "x-up-subno", "123456789_yuc3.vont.com"
 xmlServerHttp.setRequestHeader "x-up-ntfn-ttl", "0"
 xmlServerHttp.setRequestHeader "x-up-ntfn-channel", "push"
 
  xmlServerHttp.send "Type=alert&Title=anything&URL="& Server.URLEncode("http://abc.potam.com")
  Set xmlServerHttp = Nothing

Open in new window

0
_Stilgar_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?

Read the following:
http://www.sitepoint.com/forums/showthread.php?t=450806 (Ctrl+F for 80072efd)

Stilgar.
0
sasha85Author 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
_Stilgar_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
sasha85Author 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
sasha85Author Commented:
i mean http:/ is port80 and i need to send to diffrent port...
0
_Stilgar_Commented:
No HTTP is the protocol. Ports 80, 81 and 8081 are its default ports. Keep it.

Stilgar.
0
sasha85Author Commented:
POST /ntfn/add HTTP/1.0

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
sasha85Author 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
_Stilgar_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.

Please stick to your question and try what I'm suggesting.

Stilgar.
0
sasha85Author 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
_Stilgar_Commented:
Try to access this address first using the net connection on your local machine, see if returns anything at all.

Have you read the link I posted above?
0
sasha85Author Commented:
yes but i don't know what i got to do than?
0
sasha85Author 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
_Stilgar_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
BadotzCommented:
>>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
sasha85Author 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
_Stilgar_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
hieloCommented:
>>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
sasha85Author Commented:
i am sending this and get no error, does it means that the connection with the remote server is fine?

<%

Dim params,mydata
params = "Type=alert&Title=anything&URL=http://opo.soltek.com"
 
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
sasha85Author 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
BadotzCommented:
getPage = xmlServerHttp.responsetext

This waits for the server to complete your transaction, and stuffs the TEXT value into getPage.
0
hieloCommented:
>>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
sasha85Author Commented:
msxml4.dll error 'c00c023f'

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

<%
Dim params,mydata
params = "Type=alert&Title=anything&URL=http://anm.domain.co.il"
 
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
%>

Open in new window

0
hieloCommented:
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
BadotzCommented:
Where is your "xmlServerHttp.send" statement?
0
BadotzCommented:
Sorry, hielo, I'll bow out.
0
sasha85Author 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
params = "Type=alert"
 
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
%>

Open in new window

0
_Stilgar_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
sasha85Author Commented:
i just have to ask one more time to be sure, can it be the problem of my server?
0
_Stilgar_Commented:
I'm 99% sure the problem is with the server you're posting TO, and not FROM.

Stilgar.
0
BadotzCommented:
One last comment:

getPage = xmlServerHttp.responsetext

should be:

getPage = xmlServerHttp.responseText
0
sasha85Author Commented:
t>T?
why?
0
BadotzCommented:
Because that is how the property is accessed, that's why. "responsetext" is not a valid property name; "responseText" is.
0
sasha85Author Commented:
that could be the problem for : "A connection with the server could not be established "?
0
BadotzCommented:
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.