|
Hi all,
I'm trying to find the best/easiest way to consume a WebService in my application which is written in C/C++. I've seen and tried numerous examples over the course of the last few days, and there seems to be pros and cons no matter which way I go. I thought I'd ask you folks your opinion.
I turned on the "/crl" option on in my project, and added a WebReference. I was able to call the WebService without any problems, but I'm unsure how to handle exceptions when something goes wrong (ie: address is no longer valid). If everything is up and running and things are successful, there are no problems.
Test_WSService obtws;
try
{
obtws.Url = "http://localhost:8088/mockObtain_WSSoapBinding1";
obtws.UpdateObject ( "A", "B", "C" );
}
catch ( ??? )
{
}
With whatever route I go with, I'd like to be able to change the destination url on the fly as this will be specified in a user-modifiable configuration file.
My knowledge of COM is almost nil.
I've seen examples where a developer did all the WebService consuming in a C# dll, and just called that from the C++ application as well.
Whats your past experiences, recommendation?
Anything you could forward would be helpful.
Cheers.
Mike.
|
|
|
|
|
Mike Doner wrote: With whatever route I go with, I'd like to be able to change the destination url on the fly as this will be specified in a user-modifiable configuration file.
Mike Doner wrote: I've seen examples where a developer did all the WebService consuming in a C# dll, and just called that from the C++ application as well.
Mike Doner wrote: Whats your past experiences, recommendation?
Yes, we have done the same thing. I used WSDL[^] to generate a C# proxy source file then built that into an assembly with a wrapper class that changes the URL based on incoming parameters. This wrapper is then used by C++/CLI DLL Project that exports a native C++ class that is used by native EXE projects.
The WSDL generated class derives from System.Web.Services.Protocols.SoapHttpClientProtocol which has a .URL property.
|
|
|
|
|
Thank you for your reply.
As I said, this is all pretty new to me, so I'm doing a bit of feeling around for getting it to work. I was able to create a C# proxy without any problems, and from a C# project, I can call the WebService. I've created a C# Class that has a WebService, with all the parameters I need, including setting the URL.
Now, to call this from the C++ side... Were you suggesting all the C# stuff being in a .DLL, then calling those functions from the C++ side? Is there a way to put a .cs into a project and have it all compile together into one project?
I found a sample online (may have been here on CP), that has a MFC project, and it shows how to use a C# object from the MFC side, including all the string marshalling. Is there an easier way?
Thanks again... I'm getting closer! ![Wink | ;-)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_wink.gif)
|
|
|
|
|
Mike Doner wrote: Were you suggesting all the C# stuff being in a .DLL, then calling those functions from the C++ side?
Sort of. C++/CLI provides the combined use of Native Code and Managed Code. So it creates a very natural environment for marshalling. By building your C# proxy into an assembly it becomes available to C++/CLI projects as a Managed class when you add the Reference to the assembly.
Mike Doner wrote: Is there an easier way?
An easier way to perform Marshalling? No, marshalling is nothing new[^]. It is what it is, we can't change it.
|
|
|
|
|
Hello!
I have developed an Pocket PC 2003 SDK application using embedded visual c++ in My Xp system, in order to check it i have always build the .exe, then connect the device and execute the .exe in that device to check whether every thing is working properly or not!
Is there any way through which i can run the application in my XP system itself, so that i can debug and know where the errors are etc.. without connecting the device.
Thanks!
|
|
|
|
|
Isn't there a Pocket PC 2003 emulator? This emulator image download[^] certainly implies as much.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks!
There is an option during building of .exe i.e Win 32 (WINCE emulator).
Shall i have to use this to run in the emulator image.
Then how can i debug my code?
Thanks !
|
|
|
|
|
Once you start debugging, the emulator will be displayed on the screen and you'll be able to interact with it (click on your app for instance). To debug, well, it is similar as debugging a desktop application: you can set break points, inspect variables, ...
|
|
|
|
|
I've never used Windows MObile, Pocket PC or the emulator - can I suggest you look at the documentation, starting here[^] at the emulator section?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes, you can use the emulator for that purpose. You can't run it directly on windows XP, only through the emulator.
|
|
|
|
|
Hi all,
please tell me how can i Convert a DWORD value in CString.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
|
I dont know which type is used here.
please explain me with example.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: I dont know which type is used here.
What do you mean ? You don't know what is contained in your DWORD ? What are you trying to achieve exactly ?
|
|
|
|
|
My DWORD variable has some numeric value.
i mean like %d use for int conversion,wat can i use for Dword conversion.
thanks
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: i mean like %d use for int conversion,wat can i use for Dword conversion.
DWORD is unsigned long . printf tutorial[^] for you.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
"_$h@nky_" wrote: wat can i use for Dword conversion.
Have you tried to find what a DWORD resolves to (hint: in VS6, use F12)? It took you more time to make two posts here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
DavidCrow wrote: Have you tried to find what a DWORD resolves to (hint: in VS6, use F12)? It took you more time to make two posts here.
Post count matters, you know. Mine just went up by 1 with this post.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
CString::Format [^] usage is pretty strightforward...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
DWORD d;
CString cstrExample;
cstrExample.Format(_T("%d"), d);
|
|
|
|
|
Hello,
I have a project which is not Doc-View Architecture. Now in the basic project the view class is derived from CWnd whereas I want to derive from CView .Will this have any problem with the basic functionality of the application since I want to write code in the OnDraw() of CView and not in OnPaint().
Prithaa
|
|
|
|
|
There are lots of differences, and CView makes many assumptions about it's environment.
(see Inserting a Doc/Frame/View in a dialog using a custom control[^])
If all you're interested in is OnDraw instead of OnPaint, why don't you look at the CView::OnPaint in the MFC code, and imitate that in your CMyWnd?
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.
|
|
|
|
|
you need Mouse and Keyboard Hooks[^]
See SetWindowsHook etc.
Correction!
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
modified on Thursday, April 16, 2009 7:43 AM
|
|
|
|
|
Mouse and keyboard hooks will be of absolutely no use in retrieving text. (A keyboard hook might be of benefit, to trap the hotkeys however.)
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|