webinvoke

Invoke an application using webservice

馋奶兔 提交于 2020-01-06 19:59:43
问题 I'm trying to write a web service on my server windows server2008 to invoke some applications on my server. I user system.diagnostics.process class to invoke exe files. It works fine on server itself, but when i use the webservice over a different pc, I got error message which is specified file not found. But when I just launch cmd.exe it works fine too. As far as i understand I have access to server which i can run at least cmd.exe on. But when it comes to invoke different exe's it just

WebInvoke Parameter is NULL

眉间皱痕 提交于 2020-01-06 19:39:35
问题 I have a service where the operation contract looks like the following. I have a WebInvoke attribute and the method is set to POST. I do have a UriTemplate. The actual service method name is SaveUser. I am trying to pass in a User object (a data contract with properties annotated as data member attributes). [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "SaveUser", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json)] User SaveUser(User user);

WebInvoke Parameter is NULL

拈花ヽ惹草 提交于 2020-01-06 19:38:24
问题 I have a service where the operation contract looks like the following. I have a WebInvoke attribute and the method is set to POST. I do have a UriTemplate. The actual service method name is SaveUser. I am trying to pass in a User object (a data contract with properties annotated as data member attributes). [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "SaveUser", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json)] User SaveUser(User user);

c# API “Unexpected character encountered while parsing value: S. Path '', line 0, position 0”

走远了吗. 提交于 2019-12-12 03:23:51
问题 I use multiple API coded in c# that works well. I want to use one receiving an anonymous object (I don't want to create a Class). I have a problem when I try to deserialize the object. I have an API following this scheme, it works well when it's called from python using the json_dumps function. But when I try with JSON.stringify (from an a or even POSTMAN, I have a 400 bad request. Here is my code, I have tried a lot of things : [WebInvoke(Method = "POST", UriTemplate = "myUrl")]

Passing XML string in the body of WCF REST service using WebInvoke

怎甘沉沦 提交于 2019-12-10 14:18:20
问题 I'm a newbie to WCF, REST etc. I'm trying to write a service and a client. I want to pass xml as string to the service and get some response back. I am trying to pass the xml in the body to the POST method, but when I run my client, it just hangs. It works fine when I change the service to accept the parameter as a part of the uri. (when I change UriTemplate from "getString" to "getString/{xmlString}" and pass a string parameter). I'm pasting the code below. Service [ServiceContract] public

Accepting form fields via HTTP Post in WCF

拈花ヽ惹草 提交于 2019-12-07 00:21:10
问题 I need to accept form data to a WCF-based service. Here's the interface: [OperationContract] [WebInvoke(UriTemplate = "lead/inff", BodyStyle = WebMessageBodyStyle.WrappedRequest)] int Inff(Stream input); Here's the implementation (sample - no error handling and other safeguards): public int Inff(Stream input) { StreamReader sr = new StreamReader(input); string s = sr.ReadToEnd(); sr.Dispose(); NameValueCollection qs = HttpUtility.ParseQueryString(s); Debug.WriteLine(qs["field1"]); Debug

How pass multiple body parameters in wcf rest using webinvoke method(Post or PUT)

荒凉一梦 提交于 2019-12-06 22:40:17
问题 I have written a REST Service in WCF in which I have created a method(PUT) to update a user. for this method I need to pass multiple body parameters [WebInvoke(Method = "PUT", UriTemplate = "users/user",BodyStyle=WebMessageBodyStyle.WrappedRequest)] [OperationContract] public bool UpdateUserAccount(User user,int friendUserID) { //do something return restult; } Although I can pass an XML entity of user class if there is only one parameter. as following: var myRequest = (HttpWebRequest

WCF Post with Query String

时光毁灭记忆、已成空白 提交于 2019-12-06 08:09:42
问题 I am currently developing a Windows Service hosted WCF service. One of the methods has a URI which is set up to receive a callback from a payment provider. This is the interface contract... [OperationContract] [WebInvoke(UriTemplate = "3DSecureCallback?TrxId={id}", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare)] void ThreeDSecureCallBack(string id, Stream body); This issue I am having is that the 3rd party provider posts to our service. I have to provide a callback url to it. So we

Is WebGet functionally equivalent to WebInvoke(Method = “GET”)?

风格不统一 提交于 2019-12-06 05:25:08
问题 This question already asks what I'm asking, but I want some clarification on the answer. The answer states that WebGet and WebInvoke are similar, and that the primary difference is the Method parameter. But if the Method parameter is set to "GET" , is it actually functionally equivalent, or are there other differences? 回答1: They are simply marker attributes and end up being 100% functionally equivalent. The only thing that interprets these attributes is the WebHttpBehavior::GetWebMethod

Accepting form fields via HTTP Post in WCF

此生再无相见时 提交于 2019-12-05 05:05:06
I need to accept form data to a WCF-based service. Here's the interface: [OperationContract] [WebInvoke(UriTemplate = "lead/inff", BodyStyle = WebMessageBodyStyle.WrappedRequest)] int Inff(Stream input); Here's the implementation (sample - no error handling and other safeguards): public int Inff(Stream input) { StreamReader sr = new StreamReader(input); string s = sr.ReadToEnd(); sr.Dispose(); NameValueCollection qs = HttpUtility.ParseQueryString(s); Debug.WriteLine(qs["field1"]); Debug.WriteLine(qs["field2"]); return 0; } Assuming WCF, is there a better way to accomplish this besides parsing