Getting a Proxy Class into VBA

Discussion in 'ASP .Net Web Services' started by Paul Hastings, Sep 23, 2004.

  1. 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 - - -
    Paul Hastings, Sep 23, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Iulian Dan Repolschi

    pass VBA class module to c# objects

    Iulian Dan Repolschi, May 20, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,826
    Eric Marvets
    May 22, 2004
  2. vidy5300
    Replies:
    0
    Views:
    807
    vidy5300
    Jun 7, 2004
  3. Replies:
    0
    Views:
    1,630
  4. Karsten Wutzke
    Replies:
    1
    Views:
    870
    Steven Simpson
    Aug 20, 2007
  5. Li Chen
    Replies:
    3
    Views:
    141
Loading...

Share This Page