-
Pri 2 om poste (IdHTTP.Post(p_url, v_Request2, response2);) polucayu osibki http/1.1 500 internal server error . Kto nibut smojet naytiosibku?
Function GetSoapXMLResult(p_url,p_username,p_password,p_barcode: AnsiString;p_salepoint:string): Integer; var IdHTTP : TIdHTTP; v_tt : WideString; XML_Result1 : WideString;
XML_Result2 : WideString; V_Url : String; F : TextFile; response1 : TStringStream; response2 : TStringStream; v_XmlData1 : wideString; v_XmlData2 : wideString; v_Request1 : TStream; v_Request2 : TStream; v_result : Integer; LHandler: TIdSSLIOHandlerSocketOpenSSL; begin v_XmlData1 :=CreateSoapRequestWeb(p_username,p_password,p_barcode,1,p_salepoint ); v_XmlData2 :=CreateSoapRequestWeb(p_username,p_password,p_barcode,2,p_salepoint); v_Request1 := TStringStream.Create(v_XmlData1, TEncoding.UTF8, true); v_Request2 := TStringStream.Create(v_XmlData2, TEncoding.UTF8, true); response1 := TStringStream.Create('', TEncoding.UTF8); response2 := TStringStream.Create('', TEncoding.UTF8);
LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); IdHTTP := TIdHTTP.Create(); IdHTTP.IOHandler:=LHandler; IdHTTP.ConnectTimeout:=30000; IdHTTP.Request.ContentType :='application/soap+xml'; IdHTTP.Request.BasicAuthentication:= true; IdHTTP.Request.Username := p_username; IdHTTP.Request.Password := p_password;
IdHTTP.Response.ContentType :='application/soap+xml'; IdHTTP.Response.ContentEncoding :='UTF-8';
try IdHTTP.Post(p_url, v_Request1, response1); XML_Result1 :=response1.DataString; except v_Request1.Free; v_Request2.Free; response1.Free; response2.Free; IdHTTP.Free; GetSoapXMLResult:=-3; Exit; End; v_result:=XML_Result1 Sleep(500); if v_result='200' then Begin try IdHTTP.Post(p_url, v_Request2, response2); XML_Result2 :=response2.DataString; except v_Request1.Free; v_Request2.Free; response1.Free; response2.Free; IdHTTP.Free; GetSoapXMLResult:=-4; Exit; End; v_Request1.Free; v_Request2.Free; response1.Free; response2.Free; IdHTTP.Disconnect(); IdHTTP.Free; v_result:=XML_Result2; if v_result='200' then GetSoapXMLResult:=2 else GetSoapXMLResult:=-v_result;
end else Begin v_Request1.Free; v_Request2.Free; response1.Free; response2.Free; IdHTTP.Disconnect(); IdHTTP.Free; GetSoapXMLResult:=-v_result; End;
end;
|