by clemerson » Wed Apr 05, 2006 6:22 pm
Hi,
I got to set up this way below, I think and the road...
This giving this mistake in the return of the function GetLastError () =12007:
If HttpSendRequest(hRequest, "",0,sBuffer,Alltrim(Str(Len(sBuffer)))) == 0
? "error3",GetLastError ()
Endif
ERROR_INTERNET_NAME_NOT_RESOLVED
12007
The server name could not be resolved.
example:
sBuffer:=""
oTxt:=tTxtFile():New("c:\Autorizador.wsdl")
For x=1 to oTxt:Reccount()
sBuffer:=sBuffer+Alltrim(oTxt:readline())+chr(13)+chr(10)
otxt:Skip()
Next
oTxt:END()
xError :=LoadLib32("Kernel32.dll")
xdllnet:=LoadLib32("WinINet.Dll")
hOpen:=InternetOpen("Sysfar", INTERNET_OPEN_TYPE_DIRECT,"","",0)
if (hConect:=InternetConnect(hOpen,"https://200.214.130.41:9443/farmaciahomologa/services/ServicoSolicitacaoWS";
,4,"","",3,0,0)) == 0
msginfo("Não consegue conectar com servidor, conectar Internet e executar novamente o envio do arquivo ..."+str(Getlasterror()))
endif
hRequest:=HttpOpenRequest(hConect,"POST","","","","","INTERNET_FLAG_SECURE",0)
If hRequest==0
? "error1",GetLastError()
Endif
If HttpSendRequest(hRequest,"",0,sBuffer,Alltrim(Str(Len(sBuffer)))) == 0
? "error3",GetLastError()
Endif
hFile:=InternetOpenUrl(hOpen,"https://200.214.130.41:9443/farmaciahomologa/services/ServicoSolicitacaoWS",,0,,0)
If empty(hFile)
? "Não foi possivel conectar."
else
//InternetWriteFile(hFile, @sBuffer, 3200, @Ret)
sBuffer:= Space(3200)
InternetReadFile(hFile, @sBuffer, 3200, @Ret)
InternetCloseHandle(hFile)
InternetCloseHandle(hOpen)
If Empty(sBuffer)
MsgStop("Erro conectar servidor ...","Informação !!!")
else
MsgInfo("Retorno recebito com Sucesso, em desenvolvimento ...","Informação")
? sBuffer
Endif
Endif
FreeLib32(xdllnet)
FreeLib32(xError)
---------------------
Dll32 Function InternetReadFile(hFile As 7, @sBuffer As 8, lNumBytesToRead As 7, @lNumberOfBytesRead As 7) As 7 PASCAL Lib xdllnet
Dll32 Function InternetWriteFile(hFile As 7, @sBuffer As 8, lNumBytesToWrite As 7, @lNumberOfBytesWrite As 7) As 7 PASCAL Lib xdllnet
Dll32 Function InternetOpenUrl(hInternetSession As 7, lpszUrl As 8, lpszHeaders As 8, dwHeadersLength As 7, dwFlags As 7, dwContext As 7) As 7 FROM "InternetOpenUrlA" PASCAL Lib xdllnet
DLL32 FUNCTION InternetOpen( cApp as LPSTR, n1 AS DWORD, n2 AS LPSTR, n3 AS LPSTR,n4 AS DWORD ) AS LONG PASCAL FROM "InternetOpenA" LIB xDllNet
DLL32 FUNCTION HttpSendRequest(hRequest As 7,@lpszHeaders as LPSTR,dwHeadersLength as DWORD,@lpOptional as VOID,dwOptionalLength as DWORD) AS LONG FROM "HttpSendRequestA" PASCAL LIB xDllNet
DLL32 FUNCTION HttpOpenRequest(hConnect As 7,lpszVerb as LPSTR,lpszObjectName as LPSTR,lpszVersion as LPSTR,lpszReferer as LPSTR,lpszAcceptTypes as LPSTR,dwFlags as DWORD,dwContext as DWORD) AS LONG FROM "HttpOpenRequestA" PASCAL LIB xDllNet
DLL32 FUNCTION InternetConnect( hSession AS LONG, cHost AS LPSTR, nPort AS LONG,cUserName AS LPSTR, cPassword AS LPSTR, n4 AS DWORD, n5 AS DWORD,n6 AS DWORD ) AS LONG PASCAL FROM "InternetConnectA" LIB xDllNet
DLL32 FUNCTION GetLastError() AS LONG PASCAL LIB xError
DLL32 FUNCTION HttpAddRequestHeaders(HINTERNET as 7,lpszHeaders AS LPSTR,dwHeadersLength as DWORD,dwModifiers as DWORD) AS LONG PASCAL FROM "HttpAddRequestHeadersA" LIB xDllNet
Clemerson