web services - Call webservice on outside server from javascript using asp.net and C# -


I'm trying to test the web service call using an ASP.Net page which is the username and password Creates a form with the field and the "Depository Button." (Both JQuery and JS files are included in script tags in the head element.)

"Submit" button calls a call Behind the file calls a call created in the C # code which calls a different Java Script file.

  Secure Zero mSubmit_Click (Object Sender, EventArgs eventArgs) {String Authentication = String.Format ("Authentication (\" {0} \ ", \" {1} \ ") ; ", This.mU.name text, this.mPassword.Text); Page Client Script.Registering StartSupcript (this .gate type)," client script ", authenticate, true);}  

JavaScript function, authenticate , creates web service calls, using JSON and Ajax on a different server, sending JSON parameters, and so on JSON is returning back in response.

Authentication (uname, pwd) {// gets the search parameter and puts them in json format var params = '{"Header": "'+ +" "," Credentials ":" Soft Tokens ":" Sutton " : Blank, "version": 1}, "return retardation": true, "password": false) '; Var xmlhttp = $ .ajax ({async: incorrect, type: "post", url: 'https://myHost.com/V1/Identity/Authenticate', data: parameters, content type: 'application / jason'}) ; Warning (xmlhttp.statusText); Warning (xmlhttp.responseText); Return; }

However, because the web service I'm calling is on a separate server than ASP.NET, C # and Javascript files, I have no statusText or feedback text warning

Either way, nothing is being sent to the web service and I can not get anything back, even one Not even an error. I tried to put the function in attribute before , but it was not a fire, do I need to call off-server web service in a special way?

Update!

On the advice of jjnguy, Janie and Nathan, I am now trying to make a server-side call for web service using HTTP WebBurist. By using code along with Jjnguy's code, I came with it.

  public static zero authentication (string pwd, string anam) {string ret = null; HttpWebRequest request = (HttpWebRequest) WebRequest.Create ("https://myhost.com/V1/Identity/Authenticate"); Request.ContentType = "App / Jason"; request. Method = "post"; String data = "{\" Header \ ": {\" AuthToken \ ": null, \" ProductID \ ": \" NOR \ ", \" SessToken \ ": blank, \" version \ ": 1}, \ "Returns authentication \": true, \ "password \": \ "" + pwd + "\", \ "username \": \ "" + anonymous + "\", \ "return credentials \": false} '; Byte [] Byte Data = UTF 8 encoding.Utf 8.Getbaytes (Data); Request.ContentLength = byteData.Length; (stream poststream = request. Gaterequesteststream ()) using {postStream.Write (byte data, 0, ByteData.Lang);} HttpWebResponse response = (HttpWebResponse) request.Get Using Response (Response) (// Response Stream Stream Streamer Receiver = New Streammorder (Reaction GateresonsStream ()); // Console Application Output Ret = reader.ReadToEnd ();} Console.light Line ( However, when I try to get feedback from my HttpWebRequest, I get a  (400) bad request  error from remote server The answer to the exception is the property The value is  {System.Net.HttpWebResponse}  and the status property value is  protocol error . I'm pretty sure this URL is using the HTTP SSL protocol except the ASP.NET page URL to start with HTTPS (not an option) apart from that, what can I do for it? String Data = "{\"} "" Header \ ": {\, \" \ " "AuthToken \": Null, \ "ProductID \": \ "neither \", \ "SessToken \": null, \ "version \": 1}, \ "ReturnAuthentication \": true, \ "password \ ": \" "+ Pwd +" \ ", \" user name \ ": \" "+ + +" \ ", \" return credentials \ ": true}";  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -