Solved

SOAP request with ASP

Posted on 2004-04-14
6
711 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
UTC (timezone) without using an API 16 51
Using Classic ASP inside HTML pages 2 64
Questions about INCLUDE FILES 2 37
Select record with the most recent date 14 67
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 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