Solved

SOAP request with ASP

Posted on 2004-04-14
6
704 Views
Last Modified: 2007-12-19
I have the following ASP that:

<%@ Language=VBScript %>
<%Response.Buffer=true%>
<%
const SoapServer = "http://notlocalhost/Services/Test.asmx"

set xmldom = server.CreateObject("Microsoft.XMLDOM")
set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")

xmlhttp.open "POST", SoapServer, false
xmlhttp.setRequestHeader "Man", POST & " " & SoapServer & " HTTP/1.1"
xmlhttp.setRequestHeader "MessageType", "CALL"
xmlhttp.setRequestHeader "ContentType", "text/xml"
xmlhttp.send(SoapStr)

Set xmldom = xmlhttp.responseXML
Response.write(xmldom.xml)

set xmlhttp = nothing
set xmldom = nothing

function SoapStr()
      SoapStr = SoapStr & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
      SoapStr = SoapStr & "<soap:Body>"
      SoapStr = SoapStr & "<VerifyUser xmlns=""http://tempuri.org/"">"
      SoapStr = SoapStr & "<pstrUserName>someone@notlocalhost</pstrUserName>"
      SoapStr = SoapStr & "<pstrPassword>pass</pstrPassword>"
      SoapStr = SoapStr & "<pstrChannel>DIRECT</pstrChannel>"      
      SoapStr = SoapStr & "</VerifyUser>"
      SoapStr = SoapStr & "</soap:Body>"
      SoapStr = SoapStr & "</soap:Envelope>"      
end function      
%>

But I can not get it to work... I keep getting:

  <?xml version="1.0" ?>
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body>
- <soap:Fault>
  <faultcode>soap:Client</faultcode>
  <faultstring>Unable to handle request without a valid action parameter. Please supply a valid soap action.</faultstring>
  <detail />
  </soap:Fault>
  </soap:Body>
  </soap:Envelope>

Any insight is most appriciated as I am fairly new at using ASP w/ SOAP

0
Comment
Question by:just1coder
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 10824676
My guess is that in the soap-XML you need to insert some more information (which the SOAP server is expecting).
Didn't you get an example of how the SOAP message you send should look like?
0
 
LVL 2

Author Comment

by:just1coder
ID: 10824747
Yes, I did. And I wrote it into this function:

function SoapStr()
     SoapStr = SoapStr & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
     SoapStr = SoapStr & "<soap:Body>"
     SoapStr = SoapStr & "<VerifyUser xmlns=""http://tempuri.org/"">"
     SoapStr = SoapStr & "<pstrUserName>someone@notlocalhost</pstrUserName>"
     SoapStr = SoapStr & "<pstrPassword>pass</pstrPassword>"
     SoapStr = SoapStr & "<pstrChannel>DIRECT</pstrChannel>"    
     SoapStr = SoapStr & "</VerifyUser>"
     SoapStr = SoapStr & "</soap:Body>"
     SoapStr = SoapStr & "</soap:Envelope>"    
end function    
0
 
LVL 4

Expert Comment

by:anderson22
ID: 10824841
A Soap request requires the SoapAction header with a value for the method.

-rca
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Author Comment

by:just1coder
ID: 10824976
How do I do that?
0
 
LVL 4

Accepted Solution

by:
anderson22 earned 100 total points
ID: 10825027
0
 
LVL 2

Author Comment

by:just1coder
ID: 10825446
After adding:
xmlhttp.setRequestHeader "SOAPAction", "http://tempuri.org/VerifyUser"

I get a new error...
Server found request content type to be '', but expected 'text/xml'.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Gridview does not exist in the current context 14 63
Imported characters from spreadsheet look strange on ASP page 6 66
Select distinct 25 83
If-Then-Else ASP problem 6 49
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now