WebService Soap Response in C# - javascript

I am new to web services so please help me to sort out my issue. I have a requirement to create a web service in C#. This web service will return the soap response.
my webservice should send response as a soap message, Is there any exmple of client and server which send an receive soap message , it is a non wcf webservice i tried with msdn but cant grab it.
thanks for any help....

You can try Fiddler or SOAPUI tool.
Using Fiddler, You can issue requests and get response from your Webservices locally.
Very efficient for testing your webservices locally on your m/c.

You can create a web service as an "ASP.Net Website" project in visual studio. Then you can add .asmx (web service code behind file) to your project. You can define your web methods in asmx file which may return xml as response. Then you have to publish and host the web service in IIS.
In client side project, you can add the reference to the webservice by using "Add Service reference" option in visual studio that will generate classes through which you can access your web service. Then you can call your web methods through those classes.
when you are adding service reference in client side, you have to give the url of the wsdl file of your web service to locate it.

Related

Connecting Server and Client with Javascript and C#

I need to create a web page that gets data from an SQL database, and can run certain executables (that have already been written from previous projects).The code to retrieve data from SQL was written in C#, as it was used previously with ASP.NET. Is it possible to reuse all of this code the way it is with my current application (using Angular)?
How to set up the server side? I know I probably have to create a web server, and then use "get" and "post" requests from the client side, am I on the right track. Can JavaScript client side communicate with a C#-written server side?
Unequivocally yes, you can have a JavaScript frontend communicate with a C# backend. There are two primary MS provided technologies that can be used:
ASP.NET WebAPI
SignalR
And lots of 3rd party ones (like Nancy).
WebAPI is a simple HTTP server typically used to build RESTful backends. Given your description its probably what you want to use.
SignalR is a protocol for "push" applications (though it can be used for server invocations). If you don't need to call client-side code its a bit overkill.
On the client side, if using WebAPI or similar on the backend, you just do HTTP requests as you would against any standard API. For AngularJS that's done with the $http service, for Angular (2+) that's Http and for 4+ HttpClient.

How to consume a .net web service from a remote server with javascript

How to build a .net web service to communicate with a remote server (different domain) using javascript. It's better soap or rest? What HEADERS must be defined so that my server accect to recover the data. Like this web service that I believe made the already well https://api.github.com/users/peterbe/gists
Just to be sure:
You want to build a webservice with .net and build a client JavaScript, right.
For building a webservice in .net have look at a framework. IMHO these helps a lot.
ASP.NET Web API or Servicestack to start with.
For client, search for: "javascript consuming web service"
you will find a lot of samples.
I found! I did a Web service with web api and:
Install-Package Microsoft.AspNet.WebApi.Cors//In Nu get
config.EnableCors();//In WebApiConfig Register
[EnableCors(origins: "*", headers: "*", methods: "*")]//Above of Controller class
It's work

making SOAP request over HTTPS - Javascript, Phonegap

I'm building a PhoneGap mobile application and I need to make a SOAP request over HTTPS to a WebService and receive the SOAP response in JavaScript. I can choose to get a Java Application Key Store file (.JKS) or a Windows .NET Application file (.PFX) as the SSL certificate from the WebService to install on the client mobile application.
Can you please help me where to start to do such a task? How to make the SOAP request in JavaScript using SSL and how to use the certificate file? Can I use either one of these two file types as the certificate to connect to the WebService directly or do I need to have a middle WebService of my own (written in JAVA or .NET) that facilitates this functionality?(I'd rather to talk to the WebService directly with my mobile application of course).
Any help would be appreciated.
Thanks
You can use AJAX (XMLHttpRequest) with cordova, there are a jQuery Soap module.
For allow requests you need add the URL on config.xml:
<access origin="https://webserviceurl.com"/>
For the certificate, you can generate a CA key for sign your owns certificates, and install the CA PEM.
From android configuration menu -> security -> credential storage -> Install from SD Card

JavaScript client for Restful webservice with SSL

I want to connect to a Java Restful webservice that uses SSL from a Javascript client.
I could write standalone Java client that connects to the keystore and imports the certificates and could connect successfully.
How can I achieve the same thing using Javascript, XMLHttpRequest.
Thanks in advance for any pointers.
I'm not entirely sure I understand your question. But, to make a SSL asynchronous request against a server with JavaScript, the only change you need to make is to use https in your RESTful target URL instead of http.

SOAP - Google Maps and Javascript - Connecting to a webservice

I need to connect to an asmx webservice using javascript. the webservice accepts and returns a soap response. im looking for an example bit of code of how i can connect to the webservice using javascript. it returns lat and long details which i'll then use to plot markers on a google map. i also have the issue of cross domain scripting...
should i provide and example of the soap response?
thanks.
There are some JavaScript SOAP client libraries out there:
jQuery SOAP Client
JavaScript SOAP Client
Those libraries will allow you to easily make a SOAP Request and handle the results.
I strongly suggest that you implement the SOAP client on your web domain. Let the JS call your server, which in turn calls the ASMX. The response of the web service should then be converted to a suitable JSON on your server before sending it down to the client.
This way, you get rid of your cross-domain problems, you don't load a SOAP client in the browser, you transmit less wordy data to the client, and you have the option of caching web service calls at your server to speed things up if you want to.

Categories

Resources