Getting a Proxy Class into VBA

P

Paul Hastings

Hi All -

I am trying to build a Web Service that can be accessed using an Excel
spreadsheet. I have been able to do this for relatively simple access to the
Web Service. But now I need to add authentication using a client certificate
and that is where I am stuck.

It seems like the web reference that is created by the Web Reference thing
in Excel is not quite what I need. I looked at some of the articles on
client authentication and it said I need a web service proxy class like the
one that can be generated with WSDL.exe. I was able to generate the proxy
class using WSDL outside of Excel VBA.

My question: How do I get the Web Service proxy class into Excel? If I just
paste the code into a new module it has all kinds of compile errors. What am
I doing wrong?

I am including the code generated by WSDL for a HelloWorld example but I
dont know how to get this code into VBA.

Thanks,

Paul Hastings
Principal Computer Scientist
Jorge Scientific Corporation




- - - Web Service Proxy Class for HelloWorld example - - -

'---------------------------------------------------------------------------
---
' <autogenerated>
' This code was generated by a tool.
' Runtime Version: 1.1.4322.573
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </autogenerated>
'---------------------------------------------------------------------------
---

Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'This source code was auto-generated by wsdl, Version=1.1.4322.573.
'

'<remarks/>
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="HelloWorldSoap",
[Namespace]:="http://PTH/HelloWorld/HelloWorld")> _
Public Class HelloWorld
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

'<remarks/>
Public Sub New()
MyBase.New
Me.Url = "https://pth/HelloWorld/HelloWorld.asmx"
End Sub

'<remarks/>

<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://PTH/Hello
World/HelloWorld/HelloWorld",
RequestNamespace:="http://PTH/HelloWorld/HelloWorld",
ResponseNamespace:="http://PTH/HelloWorld/HelloWorld",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
_
Public Function HelloWorld() As String
Dim results() As Object = Me.Invoke("HelloWorld", New Object(-1) {})
Return CType(results(0),String)
End Function

'<remarks/>
Public Function BeginHelloWorld(ByVal callback As System.AsyncCallback,
ByVal asyncState As Object) As System.IAsyncResult
Return Me.BeginInvoke("HelloWorld", New Object(-1) {}, callback,
asyncState)
End Function

'<remarks/>
Public Function EndHelloWorld(ByVal asyncResult As System.IAsyncResult)
As String
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0),String)
End Function
End Class

- - - End of Web Service Proxy Class for HelloWorld example - - -
 

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

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top