Home > Net >  Rest WCF how to preach to participate
Rest WCF how to preach to participate

Time:10-24

This is kingdee official WCF interface
 [WebInvoke (the UriTemplate="upload2attachment/? FileName={fileName} & amp; count={count} & amp; token={token} & amp; last={last}", BodyStyle.=WebMessageBodyStyle Wrapped, RequestFormat=WebMessageFormat. Json, ResponseFormat=WebMessageFormat. Json)] 
FileUploadResult Upload2Attachment (string filename, string count, string token, bool last, Stream, Stream).


I always suggest a 400 error, front desk call calling code below
 
Public string Upload (string fileName, string count, byte [] fileContent, char last='1')
{
Var the req=HttpWebRequest. Create (${_uploadAttachUrl}?" FileName={fileName} & amp; A count={count} & amp; Token={_token} & amp; As HttpWebRequest last=1 ");
The req. Method="POST";
The req. ContentType="application/json";
The req. CookieContainer=cookies;
Using (var reqStream=the req. GetRequestStream ())
{
//var postData=https://bbs.csdn.net/topics/new {fileName=fileName, count=count, token=_token, last=1, stream=fileContent};
//var bytes=UnicodeEncoding. UTF8. GetBytes (JsonConvert. SerializeObject (postData));
//reqStream. Write (0 bytes, bytes. The Length).
ReqStream. Write (fileContent, 0, fileContent. Length);
ReqStream. Flush ();
}
Using (var responseStream=the req. The method GetResponse (). The GetResponseStream ())
{
Using (var reader=new StreamReader (responseStream))
{
Return reader. ReadToEnd ();
}
}
}




Brother help some directions

CodePudding user response:

WCF interface is regardless of the post or get, that you would be wrong to call way WCF interface similar to the webservice call way, local agent, can you need a reference to a local call

CodePudding user response:

reference 1/f, keep home paste mouth reply:
WCF interface is regardless of the post or get, that you would be wrong to call way WCF interface similar to the webservice call way, local agent, you need a reference to a local can call

This is in the form of a RESTFUL WCF interface, can post, get, put operations, such as front end can be called directly, do not need to reference

CodePudding user response:

reference 2 floor indifferent response: 888
Quote: refer to 1st floor keep home paste mouth reply:
WCF interface is regardless of the post or get, that you would be wrong to call way WCF interface similar to the webservice call way, local agent, you need a reference to a local can call

This is in the form of a RESTFUL WCF interface, can post, get, put, etc, the front can be called directly, do not need to reference


With general json request

CodePudding user response:

I think you are the first stream should not be put into using
  • Related