Home RIO Delphi error
Reply: 0

RIO Delphi error

user4522
1#
user4522 Published in June 21, 2018, 10:17 am

I have made several application where I use SOAP, but this one is giving me an error I haven't seen before.

Here is function in the WSDL that was created in Delphi.

function GetueSoapServerPortType(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ueSoapServerPortType;


implementation
  uses System.SysUtils;

function GetueSoapServerPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ueSoapServerPortType;
const
  defWSDL = 'https://sandbox.usaepay.com/soap/gate/1412E031/usaepay.wsdl';
  defURL  = 'https://sandbox.usaepay.com/soap/gate/1412E031';
  defSvc  = 'usaepayService';
  defPrt  = 'ueSoapServerPort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as ueSoapServerPortType);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;

Here is my function:

function TEWBModule1.ProcessCreditcard(card,Exp,cvv, Amount, name: String): Boolean;
var
  NewToken: usaepay.ueSecurityToken;
  tran: usaepay.TransactionRequestObject;
  response: usaepay.TransactionResponse;
  Wclient: usaepay.ueSoapServerPortType;
  CData: usaepay.CreditcardData;
  CDetails: usaepay.TransactionDetail;
  NewAmount: Double;
  RIO: TRIO;
begin
     try
        NewAmount := StrToFloat(Amount);

     NewToken := usaepay.ueSecurityToken.Create;
     NewToken := CreateToken(MasterTbl.FieldByName('Merchantnum').AsString, MasterTbl.FieldByName('Mlogin').AsString);

     tran := usaepay.TransactionRequestObject.Create;
     CData:= usaepay.CreditcardData.Create;
     CDetails:= usaepay.TransactionDetail.Create;
     CData.CardNumber := card;
     CData.CardExpiration := Exp;
     CData.CardCode := cvv;
     CDetails.Amount := NewAmount;
     CDetails.AllowPartialAuth := False;
     CDetails.Description := 'Web Payment';
     tran.Command := 'sale';

     Wclient := GetueSoapServerPortType(False,'');

     RIO := (Wclient as IRIOAccess).RIO;
     if RIO is THTTPRIO then
        begin
             THTTPRIO(RIO).HTTPWebNode.ConnectTimeout := 1000 * 30;
             THTTPRIO(RIO).HTTPWebNode.SendTimeout := 1000 * 15;
             THTTPRIO(RIO).HTTPWebNode.ReceiveTimeout := 1000 * 60;
        end;

     response := usaepay.TransactionResponse.Create;

     response := Wclient.runTransaction(NewToken,tran);
     if response.ResultCode = 'A' then
        begin
             result := True;
        end
     else if response.ResultCode = 'D' then
          begin
               //Declined   response.error;
          end
     else
         begin
              // error response.error;
         end;

     finally
     NewToken.Free;
     tran.Free;
     Cdata.Free;
     CDetails.Free;
     response.Free;
     end;
end;

Here is where I get the error:

response := Wclient.runTransaction(NewToken,tran);

The error is:

Project myapp.exe raised exception class ESOAPDomConvertError with message 'Conversion from class TRIO.QueryInterface$1093$ActRec to SOAP is not supported - SOAP classes must derive from TRemotable.

Could this be that the md5 token is wrong or this something else?

Here is how I create the token:

function TEWBModule1.CreateToken(Key, Pin: String): usaepay.ueSecurityToken;
var
  Token: usaepay.ueSecurityToken;
  PinH: usaepay.ueHash;
  PreHasValue: String;
begin
     Token := usaepay.ueSecurityToken.Create;
     Token.SourceKey := Key;
     Token.ClientIP := '127.0.0.1';

     PinH := usaepay.ueHash.Create;
     PinH.Seed := '5678';
     PinH.Type_ := 'md5';
     PreHasValue := Token.SourceKey + PinH.Seed + Pin;
     PinH.HashValue := MD5String(PreHasValue);

     Result := Token;
     Token.Free;
     PinH.Free;
end;

function TEWBModule1.MD5String(myStr: String): String;
var
  HashMessageDigest: TIdHashMessageDigest5;
begin
     HashMessageDigest := nil;
     Try
       HashMessageDigest := TIdHashMessageDigest5.Create;
       Result := IdGlobal.IndyLowerCase(HashMessageDigest.HashStringASHex(myStr));
     Finally
       HashMessageDigest.Free;
     End;

end;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.387514 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO