Consuming .Net Web Services with Access 2000

N

Nick

I have created the follow web service on our web server.
(This is actually an example from ASP.NET Unleashed by
Stephen Walther)

************** TemperatureService.asmx *************
<%@ WebService Class="TemperatureService" %>

Imports System
Imports System.Web.Services

Public Class TemperatureService : Inherits WebService

<WebMethod()> Public Function ToCelsius( TF As
Double ) AS Double
Return ( 5/9 ) * ( TF - 32 )
End Function

<WebMethod()> Public Function ToFahrenheit( TC As
Double ) AS Double
Return ( 9/5 ) * TC + 32
End Function

End Class
******************** End *************************

Then I created the following PostInvoke.html page to call
the service.

************* PostInvoke.html *******************
<form method="post"
action="/Services/TemperatureService.asmx/ToCelsius">
<input name="TF" value="32">
<input type="submit" value="Convert!">
</form>
******************** End *************************

Everything up to this point works great.

Now I would like to have my Access 2000 app consume the
same web service and display the return value in a MsgBox.
I know MSXML2.xmlHTTP works just fine, because I have used
it before with standard .asp pages as a psudo web service.

************** Access 2000 Code *******************
Public Function TempServ() As Boolean

Dim TF As Double
Dim strURL AS String

Dim xmlHTTP As MSXML2.xmlHTTP
Set xmlHTTP = New MSXML2.xmlHTTP

strURL
= "http://www.MyDomain.com/Services/TemperatureService.asmx
/ToCelsius"
TF = 32

xmlHTTP.Open "POST", strURL, False

xmlHTTP.send TF

MsgBox xmlHTTP.responseText

Set xmlHTTP = Nothing

End Function
******************** End *************************

Here is the error that is returned from the web service to
the Access 2000 app and displayed in the message box.

************ Error with Access 2000 ***************
System.InvalidOperationException: Request format is
invalid: .
at
System.Web.Services.Protocols.HttpServerProtocol.ReadParame
ters()
at
System.Web.Services.Protocols.WebServiceHandler.Invoke()
at
System.Web.Services.Protocols.WebServiceHandler.CoreProcess
Request()
******************** End *************************

This was the same error I was getting when I first created
the PostInvoke.html page and I fixed it with the following
addition to my web.config file. See MKBA - 819267

************ Web.Config **************************
....
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
....
******************** End *************************

What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top