No se que ha Pasado os Pongo el post Original:
Buenas gente:
Estoy haciendo una mini aplicacion que sincronice con gdata desde Delphi, y de momento me loqueo, y retorno informacion con get, pero a la hora de usar el comando POST, y enviarle una estructura para que cree un registro, siempre me da error, y no encuentro solucion, he probado de todo, y por ultimo, lo que he hecho ha sido intentar dar de alta un grupo de contactos con el ejemplo de google pero nada, os pongo el ejemplo por si alguien me puede echar una mano.
Gracia de antemano:
Código Delphi
[-]function CreateGroup(Titulo: PAnsiChar): PChar; stdcall;
var
XMLDoc: TNativeXml;
ListaNodos: TXmlNodeList;
Node: TXmlNode;
NodeExt: TXmlNode;
createRequest: string;
Send: Thttpsend;
RetornoString: AnsiString;
I: Integer;
lPostData: TStringList;
begin
Result := PChar('-1');
if ((AuthID <> '') and (Titulo <> '')) then
begin
XMLDoc := TNativeXml.Create;
XMLDoc.CreateName('atom:entry');
XMLDoc.Root.WriteAttributeString('xmlns:gd',
'http://schemas.google.com/g/2005');
XMLDoc.Root.WriteAttributeString('xmlns:atom',
'http://www.w3.org/2005/Atom');
Node := XMLDoc.Root.NodeNew('atom:category');
Node.WriteAttributeString('scheme',
'http://schemas.google.com/g/2005#kind');
Node.WriteAttributeString('term',
'http://schemas.google.com/contact/2008#group');
Node := XMLDoc.Root.NodeNew('atom:title');
Node.WriteAttributeString('type', 'text');
Node.ValueAsUnicodeString := String(Titulo);
NodeExt := XMLDoc.Root.NodeNew('gd:extendedProperty');
NodeExt.WriteAttributeString('name', 'more info about the group');
Node := NodeExt.NodeNew('info');
Node.ValueAsUnicodeString := 'Nice people.';
XMLDoc.SaveToFile('C:\CarlosP.xml');
Send := Thttpsend.Create;
Send.MimeType := 'application/atom+xml';
Send.Headers.Clear;
Send.Headers.Add('GData-Version: 3.0');
Send.Headers.Add('Authorization: GoogleLogin auth=' + AuthID);
XMLDoc.SaveToStream(Send.Document);
try
if (Send.HTTPMethod('POST','https://www.google.com/m8/feeds/groups/default/full')) then
begin
Application.MessageBox(PChar(inttostr(Send.ResultCode)), '', 0);
end;
Application.MessageBox(PChar(inttostr(Send.ResultCode)), '', 0);
except
on e: Exception do
Application.MessageBox(PChar(e.ToString), '', 0); end;
end;
end;