How to expose Stored Procedure in Teiid OData - stored-procedures

I have created a virtual procedure in JBoss Teiid ,i want to call it using odata protocol.
I have tried to call it by
.....url/odata/PROCEDURE NAME
It is not working .
Can anyone please tell me the corect syntax to call stored procedure in odata.

I believe this will work:
http://127.0.0.1:8080/odata/<vdbname>/FunctionImportName?Parameter1Name='Parameter1Value'&Parameter2Name='Parameter2Value'

Try locahost:8080/odata/vdbname/FunctionInportName(Parameter1Name=Parameter1Value, Parameter2Name=Parameter2Value)

Related

Access Violation on Accessing a UserSession in Intraweb

I'm new to IntraWeb and have a problem.
In order to implement a Login Form, i stored Datasets in the Usersession.
But when it comes to access the Datasets i get an Access Violation Error.
I figured out, that the Useresession is not created. Now i'm a bit confused, because in the Intraweb Documentary it is said, that the Usersession is created automatically by the ServerController.
I access (respectively want to) the Dataset like this
UserSession.Dataset.open;
I use the IntraWeb Trial included in Rad Studio XE5. May that be the Problem?
In case, that this is not the Problem, how can i create a Usersession manually?
Thank you very much
[Edit 13.4.16]
The problem was the Evaluation Version I used. After installing the Full Version my problem vanished. They changed their Usersession.create procedure by adding another Parameter. So make sure you use the actual Version if u have the same Problem:
Thanks for all the responses
You need to create the 'data' inside session
procedure TIWServerController.IWServerControllerBaseNewSession(
ASession: TIWApplication; var VMainForm: TIWAppForm);
begin
ASession.Data := TUserSession.Create;
end;
be aware that in this example
TUserSession
is an user defined class
type
TUserSession = class
public
UserCount: Integer;
end;
take a look at this tutorial which explains how the sessions management is done in IW - http://etutorials.org/Programming/mastering+delphi+7/Part+IV+Delphi+the+Internet+and+a+.NET+Preview/Chapter+21+Web+Programming+with+IntraWeb/Building+IntraWeb+Applications/
or consult the technical documentation provided by atozed.
I tried adding just a comment, apparently I need more points for that.
The answer will be found if you go into the response given by RBA, but here is the short form:
IW does create and manage the user session automatically. The TIWUserSession, however, is only your part of that. In order to have your own data in the session, .Create the TIWUserSession and add it as the .Data of the session. In IWServerControllerBaseNewSession do this with:
ASession.Data := TIWUserSession.Create(nil, ASession);
Note that the ASession parameter of the procedure is the session managed by IW.
In order to access your TIWUserSession, create a procedure in ServerController:
function UserSession: TIWUserSession;
begin
Result := TIWUserSession(WebApplication.Data);
end;
Expose that procedure in the interface section.
Dan
It occurred to me that we might be "solving the wrong problem".
You indicated that this occurred when you were implementing a login form. You also indicated that a break set in WServerControllerBaseNewSession() did not hit.
In ServerController, do you have "AuthBeforeNewSession" set to True? If so, set it to False and see if the behavior changes.
Dan

Crystal Report: Call stored procedure using sql expression

Apologies if this shouldn't be asked here, but I'm desperately wanted to know if it's possible to call a stored procedure from sql expression in Crystal Report.
Thank you so much!
You can call a function. Stored procedure does not return anything.

Delphi: Datasnap Identifying User from Server Methods Unit

How can I determine the User that initiated one of my functions that I have created in my Server Methods Unit?
in the ServerContainerUnit or WebModuleUnit (ISAPI),
DSAuthenticationManager.onUserAuthenticate procedure or TDSServer.onConnect ect...,
use TDSSessionManager.GetThreadSession.PutData('UserName',User); identify current user to DSSession,
in your Servermethods unit functions, you can use TDSSessionManager.GetThreadSession.GetData('UserName')from the DSSession what you saved onUserAuthenticate or other procedure.
Tested on DataSnap REST ISAPI, work fine.
Just use TDSSessionManager.GetThreadSession.Username if you have authentication enabled.

Calling IOfflineFilesCache.IsPathCacheable with Delphi

I need to use the method IsPathCacheable in the IOfflineFilesCache interface to check to see if a UNC path is being cached:
http://msdn.microsoft.com/en-us/library/bb530497%28v=VS.85%29.aspx
Has anyone defined this interface for use in Delphi (I'm using Delphi 2010) or know of another way to achieve this (aside from defining it myself)?
Thanks
You can use WMI to access offline files: The Win32_OfflineFilesItem class can be used to enumerate them and inspect their properties.
To spare you the hassle of setting up WMI for yourself I would suggest the excellent Delphi WMI Class Generator. It will generate the unit uWin32_OfflineFilesItem.pas containing a wrapper class called TWin32_OfflineFilesItem which can be used as follows:
uses uWin32_OfflineFilesItem;
var
OfflineItems: TWin32_OfflineFilesItem;
i: Integer;
begin
OfflineItems:= TWin32_OfflineFilesItem.Create;
for i:= 0 to OfflineItems.GetCollectionCount-1 do
begin
OfflineItems.SetCollectionIndex(i);
Memo1.Lines.Add(OfflineItems.ItemPath); // <-- this gives the UNC path
end;
end;
(There is one other unit involved, uWmiDelphiClass.pas, which comes with the Delphi WMI Class Generator download.)
You can use the same approach to access the methods of Win32_OfflineFilesCache (which corresponds to IOfflineFilesCache). Unfortunately there the method IsPathCacheable is missing, thus the need to use above approach.

WSDL importer generates faulty server

I've been trying to get a soap server up that implements (is that the correct term?) a wsdl specification made by a third party. I have used Delphi's wsdl importer. (Part of) the generated code looks like this:
miniPortType = interface(IInvokable)
['{824D172A-9C1F-D202-5B21-4C324553BCF0}']
// Cannot unwrap:
// - Input element wrapper name does not match operation's name
function miniService(const aMessage: MiniMessageType): MiniAnswerType; stdcall;
end;
When called, the server says that "No method named 'MiniMessageType' is supported by interface 'miniPortType'".
I can only get this to work by making the name of the function and name of the main element of the message the same.
I think it should be possible to have different names. At least soapUI doesn't complain. And I actually have no choice but to implement the wsdl as is. Does anybody know how I can work around this?
I'm using Delphi 2007.
Thanks, Miel.
If I recall correctly, the SOAP interface is actually defined in a "table" at the bottom of the definitions, and it is this which is used to do the conversion between Delphi types and SOAP types in the communications. I've "corrected" this sort of thing in the past by manually changing the table building calls, but you have to be careful, and may also need to mangle the SOAP text at the appropriate point to make it all fit.

Resources