Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Consuming a web service from a c++ windows service application


This question is answered.


Permlink Replies: 2 - Last Post: Jul 2, 2015 7:08 AM Last Post By: Michelle Courtn...
Michelle Courtn...

Posts: 3
Registered: 2/4/12
Consuming a web service from a c++ windows service application  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 30, 2015 2:33 AM
I am trying to consume a c# web service in a c++ windows service application.
I first wrote a c++ VCL forms app and consumed the web service using WSDL importer.
This worked perfectly and gave me access to all the web methods.
Then I wrote the c++ service application and again used WSDL importer to import the web service. The c++ service compiles and I can install the service, but as soon as I use any of the web methods the service hangs.

I cannot find any information online regarding service applications and web services - is it even possible to import a web service to a windows service application? Can anyone explain if this is possible and how to do it?

Thanx!
Mica
Zou Lander

Posts: 5
Registered: 6/11/15
Re: Consuming a web service from a c++ windows service application
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 30, 2015 11:00 PM   in response to: Michelle Courtn... in response to: Michelle Courtn...
Michelle Courtnage wrote:
Then I wrote the c++ service application and again used WSDL importer to import the web service. The c++ service compiles and I can install the service, but as soon as I use any of the web methods the service hangs.

I cannot find any information online regarding service applications and web services - is it even possible to import a web service to a windows service application? Can anyone explain if this is possible and how to do it?

Have you tried to debug your service? You can add a slight delay (some seconds) upon starting the service in order to have time to attach the debugger to the service's process.

Do you have a logging subsystem inside your service application? Which error is reported?

In services, as opposed to (or like they do into the) desktop applications, you must initialize the COM subsystem for each thread that uses COM-based APIs. You did it, isn't it?

bye
Michelle Courtn...

Posts: 3
Registered: 2/4/12
Re: Consuming a web service from a c++ windows service application  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 2, 2015 7:08 AM   in response to: Zou Lander in response to: Zou Lander
Zou Lander wrote:
Michelle Courtnage wrote:
Then I wrote the c++ service application and again used WSDL importer to import the web service. The c++ service compiles and I can install the service, but as soon as I use any of the web methods the service hangs.

I cannot find any information online regarding service applications and web services - is it even possible to import a web service to a windows service application? Can anyone explain if this is possible and how to do it?

Have you tried to debug your service? You can add a slight delay (some seconds) upon starting the service in order to have time to attach the debugger to the service's process.

Do you have a logging subsystem inside your service application? Which error is reported?

In services, as opposed to (or like they do into the) desktop applications, you must initialize the COM subsystem for each thread that uses COM-based APIs. You did it, isn't it?

bye

Thanx for your help. I had to initialize the COM subsystem using the CoInitialize function!
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02