Solved

SOAP request with ASP

Posted on 2004-04-14
6
714 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 
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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
age from date of birth 4 63
ASP server side get value 15 50
Read text on Table 7 49
Getting robots.txt Error 9 57
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 demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

751 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