Calling webservice with parameters using ServerXMLHTTP object

  • Thread starter Thread starter Ramya A
  • Start date Start date
R

Ramya A

Hi All:

I have a .NET webservice accepting an XML request document as a
parameter
How do I call this webservice with ServerXMLHTTP object from my VB6.0
client?

I have enabled the HttpPost and HttpGet protocols in the web.config
file.

This is the calling part:

Set xmlHTTPRequest = New MSXML2.ServerXMLHTTP40
xmlHTTPRequest.open "POST",
"http://localhost/WebService2/QueueList.asmx/QueueList", True
sParam = "strXMLRequest:=" & xmlDom.xml
xmlHTTPRequest.send (sParam)


It keeps throwing the error "Request format is invalid: ."

Please Help!

Thanks,
Ramya Ashok
 
Ramya, this is a c# newsgroup you are posting to. I understand your
Webservice is .NET, but you're asking for classic VB help.

1) you could get the SOAP Toolkit which provides classic VB Support.

2) take a look at this sample code from an ASP page:

<%@ Page aspcompat=true Debug="true"%>
<%
Dim objXMLHTTP, xml, flightnumber, url
' Create an Server xmlhttp object:
xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
url = cstr("http://www.imdb.com/Find")
xml.Open ("POST", url , False)
xml.Send ("select=All&for=My Big Fat Greek Wedding")
Response.Write ("<h1>This generated results from IMDB using ServerXMLHTTP
</h1>")
Response.Write (xml.responseText)
xml = Nothing
%>

Peter
 
Hi Peter,

Thanks for your reply. The following code worked from the client.
Set xmlHTTPRequest = New MSXML2.XMLHTTP40
With xmlHTTPRequest
.open "GET",
"http://localhost/WebService2/QueueList.asmx/QueueList?strXMLRequest="
& xmlDom.xml, False
.setRequestHeader "Content-type", "text/xml"
.setRequestHeader "HTTPGET", "HTTP://localhost/QueueList/QueueList"
.send
End With
If xmlHTTPRequest.readyState = 4 Then
Text1.Text = xmlHTTPRequest.responseText & vbCrLf
End If
While writing web services, since it makes no difference whether you do
it in C# or VB.NET, I posted this in C# discussion group.
 
Back
Top