Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SOAP request with ASP

Posted on 2004-04-14
6
Medium Priority
?
724 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Author Comment

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

Accepted Solution

by:
anderson22 earned 200 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

Industry Leaders: 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!

Question has a verified solution.

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

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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

972 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