H
hbhxj
Unregistered / Unconfirmed
GUEST, unregistred user!
各位高手,我现在和别人对接的一接口,对方告诉我调用windows中的Msxml2.XMLHTTP调用,但是我怎么调用都提示参数不正确,急。。。procedure TForm1.ButtonClick(Sender: TObject);var url, tempStr, str_result, user, pass: WideString;
responseText: WideString;
xmlHttp: OLEVariant;
xmlDoc: IXMLDOMDocument;
xmlNode: IXMLDOMNode;
i: Integer;begin
user := Trim(Edit2.Text);
pass := Trim(Edit3.Text);
xmlHttp := CreateOleObject('Msxml2.XMLHTTP');
//url := 'http://localhost:8080/cdxtclient/cdxtjumbo?returntype=xml';
url := Trim(Edit1.Text);
xmlHttp.open('post', url, false);
tempStr := '<?xml version=''1.0'' encoding=''utf-8''?>' + '<request>' + '<action_name>authen
ticateAction</action_name>' + '<method_name>authen
ticate</method_name>' + '<list> ' + '<object name=''Users''>' + '<param name=''code''>' + user + '</param>' + '<param name=''password''>' + pass + '</param>' + '</object>' + '</list>' + '</request>';
tempStr := 'abc';
//xmlHttp.setRequestHeader('CONTENT-LENGTH', tempStr.Length);
// xmlHttp.setRequestHeader('CONTENT-TYPE', 'text/xml;
charset=utf-8');
ShowMessage(tempStr);
xmlHttp.send(tempStr);
Memo1.Lines.Add(xmlHttp.responseText);
responseText := xmlHttp.responseText;
if ParseXML(responseText, 'result') <> 'success' then
begin
ShowMessage('登陆失败');
end;
xmlHttp := Unassigned;end;
responseText: WideString;
xmlHttp: OLEVariant;
xmlDoc: IXMLDOMDocument;
xmlNode: IXMLDOMNode;
i: Integer;begin
user := Trim(Edit2.Text);
pass := Trim(Edit3.Text);
xmlHttp := CreateOleObject('Msxml2.XMLHTTP');
//url := 'http://localhost:8080/cdxtclient/cdxtjumbo?returntype=xml';
url := Trim(Edit1.Text);
xmlHttp.open('post', url, false);
tempStr := '<?xml version=''1.0'' encoding=''utf-8''?>' + '<request>' + '<action_name>authen
ticateAction</action_name>' + '<method_name>authen
ticate</method_name>' + '<list> ' + '<object name=''Users''>' + '<param name=''code''>' + user + '</param>' + '<param name=''password''>' + pass + '</param>' + '</object>' + '</list>' + '</request>';
tempStr := 'abc';
//xmlHttp.setRequestHeader('CONTENT-LENGTH', tempStr.Length);
// xmlHttp.setRequestHeader('CONTENT-TYPE', 'text/xml;
charset=utf-8');
ShowMessage(tempStr);
xmlHttp.send(tempStr);
Memo1.Lines.Add(xmlHttp.responseText);
responseText := xmlHttp.responseText;
if ParseXML(responseText, 'result') <> 'success' then
begin
ShowMessage('登陆失败');
end;
xmlHttp := Unassigned;end;