私はPHPを経由してC#のアプリに文字列を送信しようとしていますが、ここに私のコードは次のとおりです。のHttpRequest(C#にPHP) - 文字列をデシリアライズ
PHP
//set up variables
$theData = 'test
to see if a string can be deserialized';
$url = 'http://localhost:5900/';
//create the httprequest object
$httpRequest_OBJ = new httpRequest($url, HTTP_METH_POST, $options);
//add the raw post data
$httpRequest_OBJ->setRawPostData ($theData);
//send the http request
$result = $httpRequest_OBJ->send();
//get the object
$response = $result->getBody();
C#
ここそれが失敗した場合:
var methodRequestSerializer = new XmlSerializer(typeof(MethodRequest));
var methodRequest = methodRequestSerializer.Deserialize(reader) as MethodRequest;
PHPは次のエラーをバックスロー:
致命的なエラー:C:\ xampp \ htdocs \ httpreq.phpにメッセージ 'Empty or too short HTTP message:' 'が含まれているキャッチされていない' HttpInvalidParamException '例外:39'内部エラー 'HttpRequestException'ヘッダー、データなし)。 C:\ xampp \ htdocs \ httpreq.php:29スタックトレース:#0 C:\ xampp \ htdocs \ httpreq.php(39):HttpRequest-> C:\ xampp \ htdocs \ httpreq.php 39行目にスローされたsend()#1 {main}
ありがとうございました。
通常、あなたはASPX/ASHXファイルにデータを送信していませんか? –
とにかくC#アプリケーションにデータを直接送信して、そのデータを即座に脱灰することができますか? – bobo
C#の 'リーダー'はどこから来たのですか? –