none
Call WCF from excel2003 with VBA

    Question

  • Can anyone help me how I can call my simple WCF from Excel 2003?  My example-WCF look like:

    I will use basicHttpBinding...
    Look at the code down (my config shows last down),



    Namespace Microsoft.ServiceModel.Samples

        <ServiceContract(Namespace:="http://Microsoft.ServiceModel.Samples")> _
    Public Interface IService1

            <OperationContract()> _
            Function GetData(ByVal value As Integer) As String

            <OperationContract()> _
            Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType

            ' TODO: Add your service operations here

        End Interface

        ' Use a data contract as illustrated in the sample below to add composite types to service operations.
        <DataContract()> _
        Public Class CompositeType

            Private boolValueField As Boolean
            Private stringValueField As String

            <DataMember()> _
            Public Property BoolValue() As Boolean
                Get
                    Return Me.boolValueField
                End Get
                Set(ByVal value As Boolean)
                    Me.boolValueField = value
                End Set
            End Property

            <DataMember()> _
            Public Property StringValue() As String
                Get
                    Return Me.stringValueField
                End Get
                Set(ByVal value As String)
                    Me.stringValueField = value
                End Set
            End Property

        End Class


    End Namespace



    CONFIG:

      <system.serviceModel>
        <services>
          <service behaviorConfiguration="Microsoft.ServiceModel.Samples.Service1Behavior"
            name="Microsoft.ServiceModel.Samples.Service1">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="Binding1"
              contract="Microsoft.ServiceModel.Samples.IService1" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>

        <bindings>
          <!-- 
                Following is the expanded configuration section for a BasicHttpBinding.
                Each property is configured with the default value.
                See the TransportSecurity, and MessageSecurity samples in the
                Basic directory to learn how to configure these features.
                -->
          <basicHttpBinding>
            <binding name="Binding1"
                     hostNameComparisonMode="StrongWildcard"
                     receiveTimeout="00:10:00"
                     sendTimeout="00:10:00"
                     openTimeout="00:10:00"
                     closeTimeout="00:10:00"
                     maxReceivedMessageSize="65536"
                     maxBufferSize="65536"
                     maxBufferPoolSize="524288"
                     transferMode="Buffered"
                     messageEncoding="Text"
                     textEncoding="utf-8"
                     bypassProxyOnLocal="false"
                     useDefaultWebProxy="true" >
              <security mode="None" />
            </binding>
          </basicHttpBinding>
        </bindings>

        <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
        <behaviors>
          <serviceBehaviors>
            <behavior name="Microsoft.ServiceModel.Samples.Service1Behavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>

      </system.serviceModel>


    Thanks

    Alle
    Tuesday, December 08, 2009 8:38 AM

Answers