The interface of each courier is different for docking express orders, but basically the same, the main algorithms are md5 and Base64. The demo provided generally does not have Delphi. In fact, md5 and Base64Delpi come with it.
Base64 generally does not have problems, mainly md5, many use Delphi docking, the main problem is here. Below I share and connect two different express interfaces, the md5 processing used is different.
procedure TForm1.SpeedButton1Click(Sender: TObject); where Str:String; M5Str,BaseStr:AnsiString; begin str:=StringReplace(Trim(Edit1.Text),' ','',[rfReplaceAll]); Memo1.Lines.Add ('original' + str); M5Str:=THashMD5.GetHashString(Str); Memo1.Lines.Add('MD5:'+M5Str); Memo1.Lines.Add('QDAC,URL:'+qstring.UrlEncode(str,False,true)); Memo1.Lines.Add('TNET,URL:'+TURLEncoding.URL.Encode(str)); BaseStr:=TNetEncoding.Base64.Encode(M5Str); Memo1.Lines.Add('Base64(MD5):'+BaseStr); Memo1.Lines.Add('QDAC,URL(Base64(MD5)):'+qstring.UrlEncode(BaseStr,True,true)); Memo1.Lines.Add('TNET,URL(Base64(MD5)):'+TNetEncoding.URL.Encode(BaseStr)); end;
procedure TForm1.SpeedButton2Click(Sender: TObject); where md5: TIdHashMessageDigest5; base64: TIdEncoderMIME; sMD5:TIdBytes; Str:String; fStr:AnsiString; aMD5:TBytes; MStream,OStream:TMemoryStream; begin Memo1.Lines.Clear; MStream:=TMemoryStream.Create; OStream:=TMemoryStream.Create; str:='<order></order>123456'; aMD5:=THashMD5.GetHashBytes(Str); var s:=TNetEncoding.Base64.EncodeBytesToString(aMD5); Memo1.Lines.Add('TNetEncoding.Base64.EncodeBytesToString:'+s); Memo1.Lines.Add('UrlEncode:'+qstring.UrlEncode(s,True,true)); md5 := TIdHashMessageDigest5.Create; base64 := TIdEncoderMIME.Create(nil); try base64.FillChar := '='; sMD5:=md5.HashString(str); Memo1.Lines.Add(base64.EncodeBytes(sMD5)); finally base64.Free; md5.Free; end;
If you are using Delphi to connect to other express interfaces, if there is a problem, use one of these two should be no problem