Hello Jason,
From your post, my understanding on this issue is: You wonder whether there
will be any substitute when SOAP Toolkit support is retired on March 31,
2008. If I'm off base, please feel free to let me know.
As we know, Office can consume Web services in two basic ways: using the
SOAP toolkit with VBA; and using managed Web service proxies. Though the
Microsoft SOAP Toolkit will be deprecated by the .NET Framework soon, we
(Newsgroup) will continue to support Microsoft Office Web Service Toolkit.
The following note is quoted from Microsoft Office 2003 Web Service Toolkit
download page:
"Note:The Microsoft Office 2003 Web Services Toolkit is not a supported
Microsoft product. The code is provided on an "as-is" basis and support is
provided through a peer-to-peer newsgroup,
microsoft.public.office.developer.vba."
Therefore, you can still get the newsgroup support if you use Microsoft
Office web service toolkit. A substitute for the web service toolkit is to
use .net web service. We are glad to be of assistance if you plan to
migrate your vba codes to .NET codes.
Below, I demo how to connect to a .net web service in a Excel COM add-in:
1. To start, create a Shared Add-in project called WebAddin. Select only
Excel as the application host, and supply a suitable name and description.
Don't select either of the final check boxes-we don't want this add-in to
load when the host application loads because that would load it as a COM
add-in, not as an Automation add-in.
2. Automation add-ins need a couple of extra registry entries over and
above the normal entries for COM add-ins. So, once the wizard has generated
the add-in project, select the setup project, and click the Registry Editor
button. In the registry editor, create an additional subkey of
HKEY_CLASSES_ROOT named CLSID and leave all properties at their defaults.
Create another new key that is a child of CLSID, with the GUID of the
Connect class, delimited with braces, such as:
{EE337219-ADD7-4FF9-86AE-C31111B281E4}. Set the AlwaysCreate property to
True. Create a final key that is a child of this GUID key, named
Programmable. This key needs no value. Set the AlwaysCreate property to
True for this key also.
3. The Connect class is already attributed with a Guid and a ProgId. Add a
third attribute for ClassInterface, specifying AutoDual as the type. Recall
that using AutoDual class interfaces is normally discouraged because such
interfaces allow clients to bind to a specific interface layout that might
change as the class evolves, thereby breaking the client. However, using an
AutoDual class interface gives us a registered type library, which is
essential for an Automation add-in.
[GuidAttribute("EE337219-ADD7-4FF9-86AE-C31111B281E4"),
ProgId("WebAddin.Connect"),
ClassInterface(ClassInterfaceType.AutoDual)]
public class Connect : Object, Extensibility.IDTExtensibility2
{
4. Add stubs for two public methods that we'll expose to Excel and that
will act as wrappers for the Web service methods.
public double FtoC(double val)
{
}
public double CtoF(double val)
{
}
5. Now we're ready to add a reference to our chosen Web service.
Right-click the project in Solution Explorer, and select Add Web Reference.
In the Add Web Reference dialog box, type the URL for the Web service
(
http://localhost/WebTempConv/Service1.asmx) and click Go. When the wizard
returns with the Service1 information, change the Web reference name from
localhost to WebTempConv:
6. Then click Add Reference. This generates a C# source file based on the
Web service WSDL. By default, you cannot see this file, but if you click
the Show All Files button and expand the WebTempConv node in the tree,
you'll see it listed as Reference.cs.
The generated class is a client-side proxy to the Web service and is
derived from SoapHttpClientProtocol. The significant features of this class
are listed below (with comments and attributes removed for brevity). It's
worth noting that the constructor sets up the URL for the Web service and
that there are wrapper methods for the Web service methods. You'll see that
there are in fact both synchronous and asynchronous wrappers for each
method.
7. Note the namespace given in the generated code. Back in the Connect
class, add a using statement for this namespace. Then flesh out the stubs
we created earlier: instantiate the service proxy, and call the appropriate
Web method proxy:
public double FtoC(double val)
{
Service1 s = new Service1();
return s.F2C(val);
}
public double CtoF(double val)
{
Service1 s = new Service1();
return s.C2F(val);
}
8. Change the add-in project properties-go to Configuration Properties |
Debugging, and set the Start Application value to launch Excel instead of
Visual Studio. Then build the add-in project.
Please let me know if you have any other concerns, or need anything else.
Sincerely,
Jialiang Ge (
[email protected], remove 'online.')
Microsoft Online Community Support
==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document:
http://blogs.msdn.com/msdnts/pages/postingAlias.aspx
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.