[firebase-br] Re: Preciso de ajuda (SOAP) ACHEIIIII!!!!!!
Ederson Selvati
asaederson em asaeggs.com.br
Qui Mar 3 08:28:05 -03 2005
Eu fiquei perdido com soap nesta situacao por isso escrevi o artigo e postei
no clubedelphi, legal saber q tem tido utilidade...
Ederson
"Francisco Thiago" <jeandeadlucky em yahoo.com.br>
escreveu na mensagem news:000c01c51a7a$4c1712c0$4601a8c0 em bancada10...
> Pessoal, encontrei!!!!
>
> No fórum da ClubeDelphi havia uma dica dizendo para reescrever um trecho
> de código num Unit do Delphi.
> Refiz conforme o dito e dei um Build All... mas não adiantou.
>
> Então eu fiz uma busca por tudo o que era TypeTrans (o nome da unit) e
> percebi que as .dcu não foram trocadas com a recompilação. O que fiz?
> Adicionei esta unit em um projeto qqr e peguei o .dcu dela e substitui
> pelos antigos. (Exceto as do delphi 2005)
>
> E, senhoras e senhores.... FUNCIONOU!
> Passo para você o código: // Comentem a rotina anterior e confiram o
> erro... Eu pensei que só eu fizesse isso... hehehe
>
> function TTypeTranslator.CastSoapToNative(Info: PTypeInfo; const SoapData:
> WideString; NatData: Pointer; IsNull: Boolean): Boolean;
> var
> ParamTypeData: PTypeData;
> SavedDecSep: Char; //criei a variavel
> begin
> SavedDecSep := DecimalSeparator; //salvei o separador decimal
> try //eu criei este try...finally para voltar o separador original
> DecimalSeparator := '.'; //nesta funcao o delphi muda p/ '.'
> Result := True;
> if IsNull and (Info.Kind = tkVariant) then
> begin
> Variant(PVarData(NatData)^) := NULL;
> Exit;
> end;
> ParamTypeData := GetTypeData(Info);
> case Info^.Kind of
> tkInteger:
> case ParamTypeData^.OrdType of
> otSByte, otUByte:
> PByte(NatData)^ := StrToInt(Trim(SoapData));
> otSWord, otUWord:
> PSmallInt(NatData)^ := StrToInt(Trim(SoapData));
> otSLong, otULong:
> PInteger(NatData)^ := StrToInt(Trim(SoapData));
> end;
> tkFloat:
> case ParamTypeData^.FloatType of
> ftSingle:
> PSingle(NatData)^ := StrToFloatEx(Trim(SoapData));
> ftDouble:
> begin
> if Info = TypeInfo(TDateTime) then
> PDateTime(NatData)^ := XMLTimeToDateTime(Trim(SoapData))
> else
> PDouble(NatData)^ := StrToFloatEx(Trim(SoapData));
> end;
> ftComp:
> PComp(NatData)^ := StrToFloatEx(Trim(SoapData));
> ftCurr:
> PCurrency(NatData)^ := StrToFloatEx(Trim(SoapData));
> ftExtended:
> PExtended(NatData)^ := StrToFloatEx(Trim(SoapData));
> end;
> tkWString:
> PWideString(NatData)^ := SoapData;
> tkString:
> PShortString(NatData)^ := SoapData;
> tkLString:
> PString(NatData)^ := SoapData;
> tkChar:
> if SoapData <> '' then
> PChar(NatData)^ := Char(SoapData[1]);
> tkWChar:
> if SoapData <> '' then
> PWideChar(NatData)^ := WideChar(SoapData[1]);
> tkInt64:
> PInt64(NatData)^ := StrToInt64(Trim(SoapData));
> tkEnumeration:
> { NOTE: Here we assume enums to be byte-size; make sure (specially
> for C++)
> that enums have generated with the proper size }
> PByte(NatData)^ := GetEnumValueEx(Info, Trim(SoapData));
> tkClass:
> ;
> tkSet, tkMethod, tkArray, tkRecord, tkInterface, tkDynArray:
> raise ETypeTransException.CreateFmt(SUnexpectedDataType, [
> KindNameArray[Info.Kind]] );
> tkVariant:
> CastSoapToVariant(Info, SoapData, NatData);
> end;
> finally
> DecimalSeparator := SavedDecSep; //voltando o decimal separator
> end;
> end;
>
>
>
>
> ______________________________________________
> FireBase-BR (www.firebase.com.br) - Hospedado em www.bavs.com.br
> Para editar sua configuração na lista, use o endereço
> http://mail.firebase.com.br/mailman/listinfo/lista_firebase.com.br
>
Mais detalhes sobre a lista de discussão lista