Revision | 42 (tree) |
---|---|
Zeit | 2019-07-10 06:43:10 |
Autor | derekwildstar |
- Ajustes para ignorar problemas com certificados do TJPE
@@ -54,10 +54,34 @@ | ||
54 | 54 | |
55 | 55 | implementation |
56 | 56 | |
57 | +uses | |
58 | + SOAPHTTPTrans, WinInet; | |
59 | + | |
60 | +// quando o certificado do tj está fodido, a url do serviço precisa ser https e | |
61 | +// é preciso ignorar autoridade certificadora. Para isso, é preciso usar o | |
62 | +// evento THTTPReqResp.OnBeforePost | |
63 | +type | |
64 | + THTTPReqRespEvents = class | |
65 | + public | |
66 | + class procedure DoBeforePost(const AHTTPReqResp: THTTPReqResp; AData: Pointer); | |
67 | + end; | |
68 | + | |
69 | +class procedure THTTPReqRespEvents.DoBeforePost(const AHTTPReqResp: THTTPReqResp; AData: Pointer); | |
70 | +var | |
71 | + FlagsLen: DWORD; | |
72 | + Flags: DWORD; | |
73 | +begin | |
74 | + FlagsLen := SizeOf(DWORD); | |
75 | + InternetQueryOption(AData, INTERNET_OPTION_SECURITY_FLAGS, @Flags, FlagsLen); | |
76 | + | |
77 | + Flags := Flags or SECURITY_FLAG_IGNORE_UNKNOWN_CA or SECURITY_FLAG_IGNORE_REVOCATION; | |
78 | + InternetSetOption(AData, INTERNET_OPTION_SECURITY_FLAGS, @Flags, FlagsLen); | |
79 | +end; | |
80 | + | |
57 | 81 | function GetmnwsPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): mnwsPortType; |
58 | 82 | const |
59 | - defWSDL = 'http://192.168.251.88/mnws/index.php?wsdl'; | |
60 | - defURL = 'http://sdwebtjpetemp.tjpe.gov.br/mnws/index.php'; | |
83 | + defWSDL = 'https://desenvolvimento.tjpe.gov.br/mnws/index.php?wsdl'; | |
84 | + defURL = 'https://desenvolvimento.tjpe.gov.br/mnws/index.php'; | |
61 | 85 | defSvc = 'mnws'; |
62 | 86 | defPrt = 'mnwsPort'; |
63 | 87 | var |
@@ -72,9 +96,13 @@ | ||
72 | 96 | Addr := defURL; |
73 | 97 | end; |
74 | 98 | if HTTPRIO = nil then |
75 | - RIO := THTTPRIO.Create(nil) | |
99 | + begin | |
100 | + RIO := THTTPRIO.Create(nil); | |
101 | + RIO.HTTPWebNode.OnBeforePost := THTTPReqRespEvents.DoBeforePost; | |
102 | + end | |
76 | 103 | else |
77 | 104 | RIO := HTTPRIO; |
105 | + | |
78 | 106 | try |
79 | 107 | Result := (RIO as mnwsPortType); |
80 | 108 | if UseWSDL then |
@@ -92,7 +120,7 @@ | ||
92 | 120 | |
93 | 121 | |
94 | 122 | initialization |
95 | - InvRegistry.RegisterInterface(TypeInfo(mnwsPortType), 'http://sdwebtjpetemp.tjpe.gov.br/soap/mnws', 'UTF-8'); | |
96 | - InvRegistry.RegisterDefaultSOAPAction(TypeInfo(mnwsPortType), 'http://sdwebtjpetemp.tjpe.gov.br/mnws/index.php/%operationName%'); | |
123 | + InvRegistry.RegisterInterface(TypeInfo(mnwsPortType), 'https://desenvolvimento.tjpe.gov.br/mnws/', 'UTF-8'); | |
124 | + InvRegistry.RegisterDefaultSOAPAction(TypeInfo(mnwsPortType), 'https://desenvolvimento.tjpe.gov.br/mnws/index.php/%operationName%'); | |
97 | 125 | |
98 | 126 | end. |
\ No newline at end of file |