Solved

SOAP request with ASP

Posted on 2004-04-14
6
701 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

20 Experts available now in Live!

Get 1:1 Help Now