Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Connecting to verisign from SQL 7.0

Author  Topic 

sherrer

64 Posts

Posted - 2004-03-11 : 13:05:55
Has anyone out there used Payflow Pro to connect to verisign using T-SQL? I can connect to it with no problem using the COM object from VB, but I am having problems using SQL Server. Currently, I am using my local machine to run SQL Server which is also the machine that I used to connect with VB. Here is the code...

DECLARE @object int
DECLARE @hr int
DECLARE @src varchar(255), @desc varchar(255)
DECLARE @Context int
DECLARE @ParamList varchar(255)
DECLARE @ParamListLen int
DECLARE @Response varchar(255)

EXEC @hr = sp_OACreate 'PFProCOMControl.PFProCOMControl.1', @object OUT
print 'call result: ' + convert(varchar(50),@hr)
print 'object token: ' + convert(varchar(50),@object)
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END
ELSE
BEGIN
--Creat Context
EXEC @hr = sp_OAMethod @object, 'CreateContext', @Context OUT, 'test-payflow.verisign.com', 443, 30, '', 0, '', ''
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
else print 'Context Created: ' + convert(varchar(50),@Context)

--Submit transaction
SET @ParamList = 'USER=user&VENDOR=vendor&PARTNER=verisign&PWD=password&TRXTYPE=S&TENDER=C&ACCT=5105105105105100&EXPDATE=1209&AMT=1.23&ZIP=12345'
SET @ParamListLen = LEN(@ParamList)
EXEC @hr = sp_OAMethod @object, 'SubmitTransaction', @Response OUT, @Context, @ParamList, @ParamListLen
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
else print 'Verisign Response: ' + convert(varchar(50),@Response)

--destroy context
EXEC @hr = sp_OAMethod @object, 'DestroyContext', NULL , @Context
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
else print 'Context Destroyed'

--destroy object
EXEC @hr = sp_OADestroy @object
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
else print 'Object Destroyed'
END


And the results...

call result: 0
object token: 16711422
Context Created: 269290928
Verisign Response: RESULT=-1&RESPMSG=Failed to connect to host
Context Destroyed
Object Destroyed

Thanks.
   

- Advertisement -