This is an old revision of the document!
The following actions should only be performed by persons familiar with SQL Server Management Studio and understand how to manipulate objects in a database.
Execute the SQL statements that follow against the Master database. These steps, until the “Configure Target Database” section, MUST be performed on the server where SQL Server is located.
sp_configure 'show advanced options', 1 GO RECONFIGURE GO sp_configure 'clr enabled', 1 GO RECONFIGURE GO
-- Create asymmetric key CREATE ASYMMETRIC KEY [bwws] AUTHORIZATION [dbo] FROM EXECUTABLE FILE = 'C:\Program Files\Bizweaver\BWPortal\BWSQLSP\SQLWSCall.dll' -- Create login CREATE LOGIN TWBS FROM ASYMMETRIC KEY [bwws] -- Modify login GRANT UNSAFE ASSEMBLY TO TWBS
The remaining steps, which create & update various SQL Stored Procedures, can be done from any instance of SQL Server Management Studio that has access to the target (SAP) database.
This procedure handles the web service call to Bizweaver. It is used for both POST and GET transactions.
CREATE PROCEDURE [dbo].[spCallBizweaverWS] @wsMethod NVARCHAR (MAX), @wsUrl NVARCHAR (MAX), @wsPort NVARCHAR (MAX), @wsContent NVARCHAR (MAX), @wsAuthToken NVARCHAR (MAX), @wsTaskId INT, @wsStartAfter INT, @wsParameters NVARCHAR (MAX) AS EXTERNAL NAME [SQLWSCall].[StoredProcedures].[spCallBizweaverWS]
A sample of the code used in SAP Business One to call a Bizweaver workflow is found here.
Contact Third Wave support for assistance with this configuration
A basic database trigger to initiate Bizweaver processing for payments will look like this.
CREATE TRIGGER [dbo].[twbs_tr_VersagoPayments] ON [dbo].[Versago_Payments] AFTER INSERT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- DECLARE @vgo_BatchID INT, @object INT, @url VARCHAR(5000), @bw_url nvarchar(100), @bw_WorkflowID INT, @bw_port INT, @pArgVariableName nvarchar(50) -- /* It may be necessary to change all instances of "vgoCommon" to a different name if you have used a different name */ SELECT t0.BW_URL, t0.BW_Port, t0.BW_WorkflowID FROM vgoCommon..twbs_vgo_payment_InfoMapping t0 -- SET @pArgVariableName = 'vgo_BatchID' SET @vgo_batchid = (SELECT vgo_batchid FROM inserted) SET @bw_url = (SELECT t0.bw_url FROM vgoCommon..twbs_vgo_payment_InfoMapping t0) SET @bw_port = (SELECT t0.bw_port FROM vgoCommon..twbs_vgo_payment_InfoMapping t0) SET @bw_Workflowid = (SELECT t0.BW_WorkflowID FROM vgoCommon..twbs_vgo_payment_InfoMapping t0) -- SET @url = @bw_url + '/BWService/api/workflow/InvokeWorkFlow?pTaskID=' + CAST(@bw_WorkflowID AS VARCHAR) + '&pStartAfter=0&pArguments={' + @pArgVariableName + ':' + CAST(@vgo_BatchID AS VARCHAR) + '}' EXEC sp_OACreate 'MSXML2.XMLHTTP', @object OUT; EXEC sp_oamethod @object, 'open', NULL, 'get', @url EXEC sp_oamethod @object, 'send'SELECT @url --select @responsetext as [Response] --select @url EXEC sp_oadestroy @object END
The following video illustrates this process.
.
Create a trigger on the table where records are saved by your Versago multi-select report.
Values in <YourValue> are specific to your installation and need to be changed accordingly. The < and > symbols are removed when the desired value is entered.
CREATE TRIGGER [dbo].[<YourTriggerName>] ON [dbo].<TableNAme> AFTER INSERT AS DECLARE @vgo_Batchid nvarchar(8), @arguments nvarchar(100) --- SELECT @vgo_BatchID = vgo_BatchID FROM inserted BEGIN SET @Arguments = '{"vgo_BatchID":' + '"' + @vgo_BatchID + '"' + '}' EXECUTE [dbo].[spCallBizweaverWS] @wsMethod='POST' -- add your URL. Be sure to use http or https as appropriate. ,@wsURL='https:<YourURL>' ,@wsContent='application/json' -- Add your Auth Token from Bizweaver ,@wsAuthToken='<YourBizweaverToken>' -- Add your workflow ID from Bizweaver ,@wsTaskId='<YourWorkflowID>' ,@wsStartAfter='' ,@wsParameters= @Arguments -- Add your port number ,@wsPort='<YourPort>' END