2016-07-06 7 views
1

APIを使用してXMLファイルをダウンロードして読み込みますが、これは完全に機能します。XML-FileをAPIに送信すると、コード化されます。どのように防止するのですか?

私は何かを追加してこのXMLファイルの新しいバージョンをアップロードしたいが、それはエンコードされ、XMLリーダーでそれを読むことはできない。 それは次のようになります。

% 3C%3Fxml%20version%3D%の221.0パーセント22%3F%の3Eの%0D%0A%の私は、私はちょうどそれがHttpUtility.UrlDecodeを使用してエンコードすることができ知っ3C

、 XMLは私が望むものではないサーバー上にこの方法で格納されるので、私はより良いソリューションを持っていたいと思います。ここで

私はリクエストの送信に使用するコード:

string test = xmlFile.Insert(index, topic); 
// byte[] bytes = Encoding.Default.GetBytes(test); 
// test = Encoding.UTF8.GetString(bytes); 

MessageBox.Show(test); 

IConsumerRequest getFileRequest = consumerSession 
    .Request() 
    .ForMethod("PUT") 
    .ForUri(new Uri(apiEndpoint + "/1/documents/" + documentid + "/upload")) 
    .WithBody(test) 
    .SignWithToken(accessToken); 

string getFileResponse = getFileRequest.ToString(); 

私はDevDefined.OAuth.Frameworkを使用します。

答えて

0

は、それを手に入れたお奨めは、このようにそれを実行します。

IConsumerRequest getFileRequest = consumerSession 
    .Request() 
    .ForMethod("PUT") 
    .ForUri(new Uri(apiEndpoint + "/1/documents/" + documentid + "/upload")) 
    .WithRawContent(test, Encoding.UTF8) 
    .WithRawContentType("text/xml") 
    .SignWithToken(accessToken); 
関連する問題