We have a three-tier architecture consisting of Classic ASP Frontend, VB COM+ Objects and MSSql Database.
We are going to replace the VB COM by ASP.NET Webservice layer soon but we are not in the position to replace the Classic ASP with new .NET code (yet) and we're therefore going to need a way to consume webservices in Classic ASP...
We know it's possible but unsure what the best way is to do this...
Can we return VBScript RecordSets in a webservice call? (All of our Classic ASP Frontend uses Recordsets at the moment). If not what would the easiest way to use consume the results?
Are there any libraries / classes that make it easier?
All advice, links, code examples and comments are welcome!
Here is an article on codeproject which should solve your problem.
I suggest that you write a .NET client and compile it with a COM interface so that you can invoke it from classic asp just like any other COM component.
Depending on what your webservice returns/requires you may need to write a layer around the the .NET client to make the input\output VB Script friendly. If you are using recordsets in your VB code you could fabricate these inside this layer.
Since it's a Webservice, is there a reason to avoid using ASP.NET for just that layer?
It is certainly possible to return a recordset using VBscript, but I'm not sure why you would want to go this route since you would have to convert the recordset to XML, etc.
Just kicking this out in VB.NET, which is extremely well documented, will probably take less time and energy than all of the crazy debugging you will end up doing in VBScript.
There is a Microsoft SOAP client COM component you can use in ASP/VBScript, called MSSOAP.SoapClient, you can get it here - http://www.driverskit.com/dll/mssoap30.dll/2342.html
I don't think MS is particularly supporting this component anymore, the link to the download on their site now redirects to the WCF home page. You'd have to dig for some documentation on it's use as well...
Related
I am building a server-client application that involves heavy signal processing (e.g. FFT). I have a working application written in C++/Qt, where everything (signal processing and other calculations) is done in client and server just sends raw data. Now I feel it would be easier to implement these features on the server. So, that maintenance becomes easier.
As I am doing signal processing, I think I should stick to C++ for performance. But I am open to new ideas.
Constraints:
I need type checking so javascript is out of discussion.
Scaling includes adding more server and each server will have at the max
10-12 users. So, Hardware cost is important. I cannot use x number of
i7 processors.
No option of using cloud services.
So, right now my question is as follows:
How can I create web services using C++ for Linux server? (Although cross platform is not important, I would appreciate if I can achieve it.)
EDIT [02:09:2015]
Right now, I think the choice is between poco and C++ Rest SDK. I feel I should go for C++ Rest SDK. Mainly because it has only those features that I need. And Also it is supported by microsoft and uses boost internally. So, I feel in future, this might be well integreated with standard.
You could use cross-platform Poco library to implement HTTP server, it is really straightforward with this framework, and they have a lot of examples. You can also use JSON serialization (like rapidjson library) to implement REST service on top of HTTP - this way your Web service will be accesable by most of the modern Web frameworks.
You might want to take a look at the C++ Rest SDK, an open source, cross platform API from Microsoft.
Like #nogard suggested, I also recommend POCO for now. It's the most serious and feature-full solution. Given you mentioned Qt, I suggest you to take a look at Tufão.
EDIT:
I forgot to mention one comparison of mine on the C++ HTTP server frameworks.
If you directly handle HTTP requests, you might loose the functionality what Web Servers does well what it was build to do. I had a similar issue, what I did was wrap up my Qt c++ code inside a PHP extension. In your case you can do the same. Wrap your logic inside what ever technology you are about to use, doesn't matter it's PHP, net , Java or anything else.
I have a some web services that my app needs to communicate with by sending json with REST over HTTP POST/GET. The only way I can see to do this is with the iXMLHTTPRequest2 framework but geeze oh man is it uglier than I want to deal with.
Is this the only option I have to look at with c++?
Would this be easier with c#? I know most of the things are the same across the languages, but if c# has a better way to do this, I'd be willing to make the jump.
You should also look into Project Casablanca - it's a fully native C++ library that also is adapted for use with Metro apps (I believe it wraps IXHR2). I've been using it to perform http REST calls and to parse JSON very successfully.
That's the interface you have to use in C++. It is more difficult than in C#. Given that, there is a good sample that will make using that interface a bit more bearable.
I am planning to use yui or jquery ui as front end for native c++ applications. I found no bindings present for this purpose. Will it be feasible/possible to do this ? If it is so, then how shall i proceed? please suggest advice.thanks
#rwik - I can see your point and desire to do what you intend and I would presume it to be a wise move to be making at this point in time considering the vast facilities browsers bring to the table as well as other aspects... I know we are in September now and I have come across this pretty late, but this is also for others who have a similar problem...
As far as I know, descending from JavaScript in to C++ is pretty murky, mostly due to the heterogenous nature of Javascript engines [Rhino, Tracemonkey, Spidermonkey, V8, Caracan,Charka, etc] employed by different browsers. But there are indeed ways to do this - depending on how dirty you want to get your hands and, indeed, on your abilities...
If you were to go with Google as a browser, you should take a look at projects such as cproxyv8 - http://code.google.com/p/cproxyv8/ or v8-juice - http://code.google.com/p/v8-juice/ which both offer interesting facilities...
My preference however is with Mozilla - simply because of XML User-Interface Language (XUL) which, if you do not know, allows you to speedily create your own user interfaces by giving direct access to its layout engine. I.e., you can even do away with the browser look and have your own independent layout while still having all browser facilities at your disposal.
With respect to C++/Javascript interaction - projects should exist for all alternatives - it pays to check.
I wish you good luck if you haven't already solved this problem.
I'd recommend QT instead.
However since native C++ has nothing to do with GUI I'm going to assume you are making a library in C++. However Yui is basically just JavaScript as is jQuery. So if you're asking can a web page or script be a C++ application the answer is not really.
What you could do is create a web service which uses your C++ library and exposes an interface for your web based application to call it indirectly.
One way to accomplish this is to embed WebKit into your application and provide your custom C++ functionality via a plugin. Both the WebKit framework on OSX and the Chromium Embedded Framework on Windows allow this style of application development. This allows you to write a UI using local Javascript/HTML files without the need for a webserver.
There are no direct bindings in JQuery and YUI because these libraries run in a web browser. Thus unless you’re planning to write your own browser plugins, the integration with the C++ will happen at the webserver that serves the data to the browser.
You could feed the data from your C++ code directly into JQuery/YUI by building web services directly in C++. But you might want to build a web application that will be serving your JQuery/YUI pages and that act as user interface controller (like in the MVC pattern). Web application languages like Java, PHP, etc. all have ways to call native code. Java has JNDI and in PHP you build extensions that link to C++ code.
I am curious to know if there is a way of connecting a flash front-end to a C++ driven backend? I'm not currently working on a project that involves this, but I found out about an application used in the gaming industry, called Scaleform, that requires knowledge on doing such things in order to create menus in games.
Another way to resolve the problem would be to create webservices using C++ and consume them on the flash side. It is a more naive approach and certainly not as good as Scaleform but it is certainly simpler to implement.
You could also have a look at FluorineFx which is an implementation of Flex/Flash Remoting services for the .NET framework. The project is open-source so it could help you get started. Basically, FluorinexFx catches the remote calls in AMF from the flash player and pipes it through the corresponding .NET method and corresponding arguments. It also helps you convert back to flash native .Net objects such as ArrayList, DataTable and even lists of typed objects.
Scaleform implement their own custom Flash Player, thats probably not what you had in mind.
What you can do in a reasonable amount of time is pretending to Adobes flash player that you are a NPAPI-compatible browser - see e.g. here how screenweaver-hx does it.
I need to consume an external web service from my VB6 program. I want to be able to deploy my program without the SOAP toolkit, if possible, but that's not a requirement. I do not have the web service source and I didn't create it. It is a vendor-provided service.
So outside of the SOAP toolkit, what is the best way to consume a web service from VB6?
I use this function to get data from a web service.
Private Function HttpGetRequest(url As String) As DOMDocument
Dim req As XMLHTTP60
Set req = New XMLHTTP60
req.Open "GET", url, False
req.send ""
Dim resp As DOMDocument
If req.responseText <> vbNullString Then
Set resp = New DOMDocument60
resp.loadXML req.responseText
Else
Set resp = req.responseXML
End If
Set HttpGetRequest = resp
End Function
.NET has a good support for Web Services since day one, so you can develop your Web Service client logic in .NET as a .dll library/assembly and use it in VB6 app via COM Interop.
Assuming that you're running on Windows XP Professional or above, one interesting method is to use the SOAP moniker. Here's an example, lifted from some MSDN page. I don't know if this particular service works, but you get the idea...
set SoapObj = GetObject
("soap:wsdl=http://www.xmethods.net/sd/TemperatureService.wsdl")
WScript.Echo "Fairbanks Temperature = " & SoapObj.getTemp("99707")
This mechanism also works from VBScript. Which is nice.
Pocketsoap works very well. To generate your objects use the WSDL generator. Using this you don't have to parse anything yourself, plus everything is nice and strongly typed.
Check out this article by Scott Swigart on the MSDN VB 6.0 Resource Center.
Calling Web Services from Visual Basic 6, the Easy Way
I've had some measure of success so far using PocketSOAP to connect to the Salesforce API. I could not use the WSDL Wizard because it generates wrapper class filenames using the first 23 characters of the call names, and this results in duplicates. Nevertheless, PocketSOAP has been working well enough for me without the wizard, and it's much more straightforward than using XMLHTTP with DOMDocument.
I also looked into making a wrapper in .NET or using one of the "MS Office {MSO version} Web Services Toolkit" libraries, but there were significant deployment hassles with those options. PocketSOAP is a simple COM DLL, not dependent on some particular version of MS Office, and is licensed under MPL.
The SOAP toolkit is arguably the best you could get. Trying to do the same thing without it would require considerable extra effort. You need to have quite serious reasons to do that.
The format of the SOAP messages is not really easy to read or write manually and a third-party library is highly advised.