{: url="http://aa.aabo.cn:8088/WebService/QRService.asmx/GetHgzForALL", "account" : "user1", "password" : "user123", "data" : [{" productCode ":" 010059252 ", "quantity" : "2"}]}
'Jsonstr:=IdHTTP Get (url);
Which side is wrong prompt "HTTP/1.1 400 bad request"
CodePudding user response:
Is a web service, it is not necessary to use the HTTP control to get the results, it is ok to directly invoke the webservice,CodePudding user response:
Refer to the writtenhttp://blog.csdn.net/cb168/article/details/8817830
CodePudding user response:
Can you give an example of ah, not learningCodePudding user response:
This is because the return to the status of the interface code: 400, but you use post method does not support this kind of state of the problem! Do you want to solve is how to request support code=400 return, settled, can share, I now also in the pit, hahaCodePudding user response:
Send a general version of mySendrecord=record
Word: integer;
Num: string;
Url: string;
Host: string;
Refer: string;
Useragent: string;
Accept: string;
Myheader: string;
Cookie: a string;
Postdata: string;
Acceptencoding: string;
Contenttype: string;
ProxyServer: string;
ProxyPort: integer;
Image: tmemorystream;
Yzm: string;
Tag: a string;
end;
Var
Send: sendrecord;
Send the url:='http://aa.aabo.cn:8088/WebService/QRService.asmx/GetHgzForALL';
Send the postdata:='{" account ":" user1 ", "password" : "user123", "data" : [{" productCode ":" 010059252 ", "quantity" : "2"}]}' ';
If (send) postdata=' ') and (post=false) then gethttp. Get (send url, response)
The else
The begin
Postd:=tstringstream. Create (");
Try
Postd. WriteString (send. Postdata);
HTTP. Request. ContentLength:=postd. Size;
HTTP post (send url, postd, response);
The finally
Postd. Free;
end;
end;
With get should also can directly to change the format, the send. Url:=send. Url + '& amp; User1 account='+' a '+' & amp; Password='+' user123 '+...
CodePudding user response:
Send me the website, can do a sample to you