Home > Net >  POST to send the JSON data, data check wrong??????
POST to send the JSON data, data check wrong??????

Time:03-08

///& lt; Summary>
Asynchronous request///send POST
///& lt;/summary>
///& lt; Param name="jsonText & gt;"
Public async void Upload (string jsonText)
{
MainWindow MainWindow=(MainWindow) App. Current. MainWindow.
HttpClient client=new HttpClient ();
Try
{
Using (var httpClient=new httpClient ())
{
HttpClient. BaseAddress=m_uri;
HttpContent HttpContent=new StringContent (jsonText, Encoding UTF8, "application/json");
HttpResponseMessage respond=await httpClient. PostAsync (m_uri, httpContent);
Respond. EnsureSuccessStatusCode ();
String MSG=await respond. Content. ReadAsStringAsync ();
MainWindow. SetListView (MSG);
}
}
The catch (Exception ex)
{
MainWindow. SetListView (ex. Message);
}
}
///& lt; Summary>
///stitching Json
///& lt;/summary>
///& lt; Param name="data" & gt;
///& lt; Param name="XML" & gt;
///& lt; Returns>
Public string MakeUploadJson (caseData v, XML string)
{
XmlDocument xmlDoc=new XmlDocument ();//create the XmlDocument
XmlDoc. LoadXml (XML);

Var jsonObject=new JObject ();
The dynamic dynObject=jsonObject;
DynObject. ServiceId="5001";
DynObject. UserId="9746 f59d4b2e8807c901cf13aaff89ca";
DynObject. Nonce="";
DynObject. SiginMethod="1";
DynObject. SignData=https://bbs.csdn.net/topics/GetMD5 (" 10175 b993630aa0b36de413a5aa889b59746f59d4b2e8807c901cf13aaff89ca ");

JObject data=https://bbs.csdn.net/topics/new JObject ();
JObject Medical=new JObject ();
Data. The Add (" Medical ", Medical);
JsonObject. Add (" data ", data);
Return JsonConvert. SerializeObject (jsonObject);
}

CodePudding user response:

The dynamic dynObject=jsonObject;
DynObject. ServiceId="5001";
DynObject. UserId="9746 f59d4b2e8807c901cf13aaff89ca";
DynObject. Nonce="";
DynObject. SiginMethod="1";
DynObject. SignData=https://bbs.csdn.net/topics/GetMD5 (" 10175 b993630aa0b36de413a5aa889b59746f59d4b2e8807c901cf13aaff89ca ");

This operation is the process of calibration data generated,

This kind of thing, you should let each other to send a they still validated data, then compare what you generate, and the family of a validated, have what different
If the same, you need to continue to contrast to send packets, view the submitted packets exactly what are the similarities and differences between

Ps: these actions can only be your own work, we won't be able to help you solve the problem, only tell how to troubleshoot the problem
  •  Tags:  
  • C#
  • Related