[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 791
  • Last Modified:

Get SOAP to work in classic ASP

I'm trying to get SOAP to work in classic asp.

Here's the code:
<%
set xmldom = server.CreateObject("Microsoft.XMLDOM")
set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")

const SoapServer = "http://fedex.com/ws/rate/v2"
xmlhttp.open "POST", SoapServer, false
xmlhttp.setRequestHeader "Man", POST & " " & SoapServer & " HTTP/1.1"
xmlhttp.setRequestHeader "MessageType", "CALL"
xmlhttp.setRequestHeader "Content-Type", "text/xml"
xmlhttp.send("soap_rate_request.xml")

'Anything other than 200 means error.
if xmlhttp.Status = 200 then
  'collects the data returned.
  Set xmldom = xmlhttp.responseXML
 
  'writes it to the screen.
  Response.write(xmldom.xml)

'Just some error checking. I use this to see why its messing up.
Else
  Response.Write("Didn't Work")

 'Writes the error code  returned by the server.
  Response.Write("status="&xmlhttp.status)

  'Writes the accompanying text.
  Response.write(""&xmlhttp.statusText)
  Response.Write(""&Request.ServerVariables("ALL_HTTP"))
End if

set xmlhttp = nothing
set xmldom = nothing

%>

Here's the response:
Didn't Workstatus=405Method Not AllowedHTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-us HTTP_HOST:rkassociates.com HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727) HTTP_X_FORWARDED_FOR:68.111.161.143

soap_rate_request.xml is an xml file with the soap envelope. I could show that but there is no way to attach files in Experts Exchange
0
Richard Korts
Asked:
Richard Korts
1 Solution
 
RimvisCommented:
Two things:
1) Are you sure http://fedex.com/ws/rate/v2 is valid address? It doesn't seem to host any web service

2) xmlhttp.setRequestHeader "Man", POST & " " & SoapServer & " HTTP/1.1"
What is POST? Are you sure you aren't missing quotes?
xmlhttp.setRequestHeader "Man", "POST " & SoapServer & " HTTP/1.1"
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now