QUrl url(urlLineEdit->text());
QHttpRequestHeader header("POST", url.path() );
header.setValue("Host", url.host() );
header.setContentType("text/xml; charset=utf-8");
header.setValue("SOAPAction", ""http://tempuri.org/HelloWorld"");
QString content("<?xml version="1.0" encoding="utf-8"?>"
"<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">"
" <soap:Body>"
" <HelloWorld xmlns="http://tempuri.org/">sdafwer</HelloWorld>"
" </soap:Body>"
"</soap:Envelope>"
);
//header.setValue("Content-Length", tr("%1").arg(11) );
http->setHost( url.host() );
httpRequestAborted = false;
httpGetId = http->request( header, content.toUtf8 (), buffer);
这个是我在网上看见的代码,希望哪位高手,能帮忙解决下。谢谢