
Posted on comments
Soap Request And Response Example In Asp.net
Every SOAP request and response are made of SOAPEnvelope. SOAPEnvelope has SOAPHeader, SOAPBody, SOAPFault.
SOAP uses Http Post method and the SOAPEnvelope is submitted as MessageBody.
A Webservice created in .Net could be used by an Http Client also. Here the method name is submitted as the PathInfo and the parameters are posted as a string of Name-Value pairs..
http:// ServerName/ApplicationName/ DemoService.asmx/ MethodName
SOAP Request
POST /DecWebServices/DemoService.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: “http://tempuri.org/Add”
<?xml version=”1.0″ encoding=”utf-8″?>
<soap:Envelopexmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>
<soap:Body>
<Add xmlns=”http://tempuri.org/”>
<a>int</a>
<b>int</b>
</Add>
</soap:Body>
</soap:Envelope>
SOAP Response
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version=”1.0″ encoding=”utf-8″?>
<soap:Envelopexmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>
<soap:Body>
<AddResponse xmlns=”http://tempuri.org/”>
<AddResult>int</AddResult>
</AddResponse>
</soap:Body>
</soap:Envelope>
Note: To view the WSDL document we can use the following URL
http://localhost/SepWebServices/Service.asmx?wsdl
Client Application: (In New Instance of VS.NET)
Step 3: File –> New Project –> Windows Application
Step 4: In the Solution Explorer –> References –> Right Click –> Add Service Reference –> In URL give the Url of Web Service(can copy from browser where we can see the webservice methods) –> Click on Go.
Step 5: In the same dialog:Namespace = localhost (name of the domain on which the web service is hosted is used)
To note: When a WebService reference is added in VS.Net that is using add Web reference it automatically creates a proxy class in the current project using a utility program called asWSDL.EXE. The same can be viewed by opening the file Reference.cs.
Step 6:
Use WebServiceClientAppName.localhost
private void btnDemo_Click(object sender, EventArgs e)
{
DemoServiceSoapClient ds = new DemoServiceSoapClient();
MessageBox.Show(ds.Add(20, 50).ToString());
}
Step 7: Run the Client Application
To note: If a new method is added to the webservice class, right click on web reference of the webservice and choose Update service Reference to reflect the new method in the proxy class.
We conclude for now. Keep coding!!
Let us know your opinion in the comments sections below. And feel free to refer Microsoft’s site to gather more information.
If you want to improve your skill in ASP.Net and excel yourself in ASP.NET training program; our institute, CRB Tech Solutions would be of great help and for you. Come and join us with our well-structured program for ASP .Net.
Stay connected to CRB Tech for more technical optimization and other updates and information.
Enquire Now
Student Speaks

Celoxis Technologies Pvt. Ltd.

ZS Associates Pvt. Ltd.

Symphony Fintech Solutions Pvt. Ltd.

Saama Technologies Pvt. Ltd.

Network Components Pvt. Ltd.

Symphony Fintech Solutions Pvt. Ltd.

Jade Global Software Pvt. Ltd.

Jade Global Software Pvt. Ltd.

Accenture

Fujitsu Consulting India Pvt. Ltd.

Ross Process Equipment Pvt. Ltd.

Fujitsu Consulting India Pvt. Ltd.

Fujitsu Consulting India Pvt. Ltd.

Syneos Health Pvt. Ltd.

Syneos Health Pvt. Ltd.

Saba Software Pvt. Ltd.

Syneos Health Pvt. Ltd.

Fujitsu Consulting India Pvt. Ltd.

DressRand (Payroll CADtech) Pvt. Ltd.

C. C. Engineers Pvt. Ltd.

C. C. Engineers Pvt. Ltd.

Arora Technologies Pvt. Ltd.

Syneos Health

Syneos Health Pvt. Ltd.

Fujitsu Consulting India Pvt. Ltd.

Aquatech System Pvt. Ltd.

LIEBHERR CMCtec

Macart Equipments Pvt. Ltd.

Bobst India Pvt. Ltd.

Rendered Idea Softgame Pvt. Ltd.

Bobst India Pvt. Ltd.

Ubitech Systems Pvt. Ltd.

Fujitsu Consulting India Pvt. Ltd.

Design Tech Systems Pvt. Ltd.

ZS Associates Pvt. Ltd.

Tetra Pak India

Infosys

Zerebral IT Solutions Pvt. Ltd.

Inspeero Technologies Pvt. Ltd.

Extentia Information Technology Pvt. Ltd.

Centurysoft Pvt. Ltd.

ZS Associates Pvt. Ltd.

ZS Associates Pvt. Ltd.

Adsparx Pvt. Ltd.

SRKay Consulting Group

SLABS Engineering Pvt. Ltd.

Pubmatic Software Pvt. Ltd.

Media Agility Pvt. Ltd.

SLABS Engineering Pvt. Ltd.

SLABS Engineering Pvt. Ltd.

Cleantech Systems Pvt. Ltd.

Sears IT & Management Services Pvt. Ltd.

Vishay Components India Pvt. Ltd.

Extentia Information Technology Pvt. Ltd.

Gartech Equipment Pvt. Ltd.

Extentia Information Technology Pvt. Ltd.

Indovance Solutions Pvt. Ltd.

Black & Veatch Pvt. Ltd.

KPIT Technologies Pvt. Ltd.

Black & Veatch Pvt. Ltd.

IQVIA

GARTECH EQUIPMENT PVT. LTD

Microverse Automation Pvt. Ltd

GARTECH Equipments Pvt. Ltd. Pune

Manav Gases Pvt. Ltd

Hi-Physix Laboratory Pvt. Ltd.

Gartech Equipments Pvt. Ltd., Pune

THUSE ELEKTRONICS PVT. LTD

PAYPER BAGGING SYSTEMS PVT. LTD

Thuse Elecktronics Pvt. Ltd

Saama Technologies Pvt. Ltd

Stockholding DMS Ltd

Saama Technologies Pvt. Ltd

Vyom Labs

Saama Technologies Pvt. Ltd

HunkJet Technocraft Pvt Ltd

VANtage Systech Pvt. Ltd

Stockholding DMS Ltd

Twenty Twenty Interior Design Software Pvt. Ltd.

Twenty Twenty Interior Design Software Pvt. Ltd.

Twenty Twenty Interior Design Software Pvt. Ltd.

BISIL, Pune

FIGmd India Pvt. Ltd.

Eternus Solutions

Nelito Systems Ltd

Hoerbiger India Pvt. Ltd.

BISIL, Pune

Swan Aluminium Pvt Ltd.

Hyva India Pvt. Ltd.

Audi Germany

Twenty Twenty Interior Design Software Pvt.Ltd.

Eternus Solutions Pvt. Ltd.

CloudAction Tecchnology Services Pvt. Ltd.

Eternus Solutions Pvt. Ltd.

Eternus Solutions Pvt. Ltd.

Capegemini

eClinicalWorks India Private Limited

Sparken IT solution

ETLhive

Swaroop Techno Components

Covenant Solutions

FIGmd India Pvt. Ltd.

FIGmd India Pvt. Ltd.

Appotex

Fidel Softech Pvt. Ltd., Pune.

Stock Holding DMS Ltd., Mumbai

Eternus Solution, Pune

Fidel Softech Pvt. Ltd. Pune.

Quick Heal

CenturySoft Pvt. Ltd. Pune

Syntel