PDA

Click to See Complete Forum and Search --> : WCF : Invoking Methods from VBA through LAN


pavan
Feb 4th, 2010, 07:49 AM
Hi All,

I have created a WCF Service, with net.tcp binding. Now I made a call to this service from MS Word Macro Through VBA. For this After creating the WCF service using VS 2008, running of which started the default WCF hosting client.

Then in the VBA macro, I have used the following code to connect to the service

Dim addr As String
addr = "service:mexAddress=""net.tcp://192.168.1.53:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/Mex"","
addr = addr + "address=""net.tcp://192.168.1.53:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/"","
addr = addr + "contract=""IService1"", contractNamespace=""http://tempuri.org/"","
addr = addr + "binding=""NetTcpBinding_IService1"", bindingNamespace=""http://tempuri.org/"""


Dim service1 As Object
Dim dataSrc As String
Set service1 = GetObject(addr)
dataSrc = service1.GetData()


This was connecting to the service and invoking the mehtod GetData() and the dataSrc variable is holding the expected value.

All this was done on my local machine but Now I want to deploy the WCF service on the LAN environment on a server so that all the MS Word Clients (for which I'll update the VBA macro) will be able to connect to the service. Also the MS Word clients in the network are varying not all are on MS Word 2003, some are on MS Word 2007 but I think there will be no issue with VBA macro execution

I am not sure on how to acheive this. Any help would be appreciated.

Thanks in Advance.

pavan
Feb 8th, 2010, 11:09 AM
^^^^^^^^^

Any One?????

mendhak
Feb 17th, 2010, 05:17 PM
I'm not sure what your question is - are you asking how to host your net.tcp service? If you have IIS 7, you can host it there, or if you don't, you can host it as a windows service on your production box. How is it hosted currently?

belle
Feb 18th, 2010, 11:36 AM
hey could any one please tell me how to debug a client server application, rather a wpf - wcf application on the same system?? meanin debuggin the participant code n the host code on the same system.... thnx in adv.

mendhak
Feb 24th, 2010, 12:07 AM
This should ideally be in its own thread so as to not hijack the original question.

To debug - assuming you have the code open - set a breakpoint on your line of choice (F9) and press F5 to run.

belle
Feb 24th, 2010, 03:13 AM
sori for posting in the question in the wrong thread bt i dint have the time to find a proper one for my question.. well yeah debugin is done thru f9 n f5 bt then i wanted to know if thers a way of testing a client server application on the same system..

tho thank u for ya help. ..
God bless

mendhak
Feb 25th, 2010, 02:06 AM
Yeah, it's commonly done too.

You have Visual Studio open with your client application. You have another Visual Studio open with the service in it. Run the service solution first. It opens up in a browser and you can see its URL.

You take that URL, put it in your client code (so when you declare the proxy class, you point it at this localhost:2394234 URL) and then run the client app. Now you've got both running locally and the client app points at the service, so you can set breakpoints and debug.

belle
Feb 25th, 2010, 06:02 PM
thank u.. il try that out pretty soon.. thank u for the help once again.. :)

pavan
Mar 8th, 2010, 02:11 AM
Apologies for the delayed response.


It is currently hosted as a windows service, but then I dont know what to use in VBA code to call a Windows Service on the network server from a client machine.



I'm not sure what your question is - are you asking how to host your net.tcp service? If you have IIS 7, you can host it there, or if you don't, you can host it as a windows service on your production box. How is it hosted currently?