banner



Do I Have To Register .asmx

API Testing Tools

What is a Web Service?

Spider web Services are defined in many means.

Web Services are client-server applications or components. Some other fashion to think of them is that web services are methods of communication between two devices over the network.

There are two types of web services: SOAP and REST (You'll learn more about them later on)

But how exercise you lot test them?

How to Test a Spider web Service

I often get asked the question "How do I go near testing web services?" and the answer I ever give may surprise you – the same way y'all would examination any other application!

In this testing web services guide, you'll discover:

  • Questions to ask earlier automating a web service
  • Web Service Testing Terminology
  • What about Residuum Services?
  • How To Create a Web Service
  • Why create a web service?
  • Create a Web Service
  • Verify that the web service works
  • Information technology's All About the WSDL
  • Looking at a WSDL
  • The iv primary sections of a WSDL
  • Web Service Testing Response and Requests
  • Web Service Request/Response
  • What does Lather have to do with Web Services
  • Soap Faults
  • Open up Source API Testing Tools for Remainder and WSDL based services

In full general, the all-time arroyo to normal functional testing is the same for web services (except for the fact that dissimilar most other applications, web services don't have GUI user interfaces). So have comfort in knowing the functional testing techniques that yous have always used yet apply. But remember of a web service as a business process without a UI, and write your test example accordingly.

Questions to inquire before automating a web service

Because web services can be used by many different clients and used in multiple ways, performance testing and negative testing become more disquisitional. I would suggest you make sure there is good test coverage in those areas.

Some skillful question to enquire when automating a web service is:

  • Does the service answer with the correct values?
  • How quickly does the service send a response to the user?
  • Can the service handle expected and unexpected user loads?
  • Tin can the service handle invalid values and exceptions caused past bad information?
  • API Testing Tools

What is a Web Service Testing Terminology

The biggest hurdle for most testers is acclimating to the terminology used when talking about web services. For instance:

  • WSDLs – an XML format that tells you lot how to access a web service. A WSDL is automatically generated for you. Most test tools read in a WSDL and nowadays all the information you demand to collaborate with it.
  • SOAP (Simple Object Access Protocol) – a protocol that uses XML format to exchange info to and from a Spider web service.
  • SOA (Service-oriented architecture) – a manner in which companies tin can organize software that can be quickly changed to respond to the requirements of the marketplace.
  • Web Service – units of software that run in a network. Typically written to handle a specific business organisation process. Web services can be strung together in multiple ways and used by different applications to create desired functionality.

I believe that once the above terms are demystified, the chore of testing web services is pretty straightforward. I too feel that the all-time way to demystify something is to interruption it downwardly into simple, hands-on examples.

In this serial, I hope to present some simple hands-on examples that break down what a spider web service actually is, and how ane works in general. Hopefully, noesis plus know-how will equal automation awesomeness!

What about Balance Services?

REST (Representational State of Transfer) is a lightweight choice for developing web services the use the HTTP protocol –a fact that makes information technology simpler with less overhead than a web service that uses the SOAP protocol.

Most folks have moved from this older method of using a WSDL web service to using REST instead.

For this post, we'll be looking at WSDL-based services, non Remainder. For communication on how to get started testing REST APIs check out my post on rest-bodacious.

How To Create a Spider web Service

Ok to get started – allow's create our very own web service. We will then utilise the spider web service we created as the basis for the rest of this series.

When we first testing and looking at the WSDL and the services request, and response the information should brand more sense since we will exist able to map the values back to the source where they came from.

Why create a spider web service?

If you're anything similar me, the best way for you to larn is by actually doing.

I've establish that to understand how something works it sometimes helps to really try it yourself –then I devised a simple instance of how to create a web service to help teach some of the concepts of web service testing.

Create a Web Service

Now nosotros volition create a simple service that contains one method that adds 2 numbers together. Okay… I admit it's not the coolest web service, merely it will serve our purpose. Before you commencement, brand sure you lot have the following setup:

  • Microsoft's Internet Information Services (IIS) is up and running on your machine
  • The latest.Net Framework SDK is installed
  • Create a directory nether your C:\Inetpub\www.root named WebServices (wwroot epitome)

Next, go ahead and re-create the following code into notepad:

Basically, the first line s saying that this a web service, and the language used is C#.

And so we import two namespaces Organisation and System.Web.Services.

Next, we create our form DEMOAddNumbers and add our method named AddThis that accepts two parameters of type integer — x and y. Finally, we add the values together and return an integer value mySum that contains the sum of the passed parameters.

Save the file equally DEMOAddNumbers.asmx and identify information technology under your wwwroot/WebServices directory. FYI asmx is the file extension used for ASP.NET.

Create a web.config file

To get this to work on my motorcar I as well had to add a web.config file to my C:\Inetpub\wwwroot directory. Open notepad and re-create the following:

Proper noun the fileweb.config and relieve it under C:\Inetpub\wwwroot

Verify that the web service works

Adjacent, open up up your browser and enter the following accost:

http://localhost/WebServices/DEMOAddNumbers.asmx/AddThis?10=xl&y=two

The folio should return the value of 42 (Which past the way is besides the reply to the pregnant of life – hehe)


Sweet – we now have a working web service! In Part two of this series, we will apply this web service to help answer the question of what is a WSDL?

It's All Nigh the WSDL

Nosotros're at present going to take a look at what is WSDL is. A WSDL is an XML certificate that describes the methods, method parameters, namespace, and treatment URL for a web service.

WSDLs, forth with some other forms of documentation, are generated automatically whenever an HTTP-Go asking is received by a .asmx file. For an case, navigate to:

http://localhost/WebServices/DemoAddNumbers.asmx


This should bring upwards an HTML page that describes the methods of the DEMOAddNumbers spider web service along with some other info.

Clicking on the link for the AddThis method from this page will bring up another HTML page that allows you to test the operations of the service.

Pretty absurd, huh?!? And at present, allow's take a wait at the actual WSDL.

Looking at a WSDL

For our web service, enter the following URL into your browser:

http://localhost/Webservice/DEMOAddNumbers.asmx?WSDL

The WSDL for our spider web service (DEMOAddNumbers) should appear. Observe, over again, that nosotros didn't do annihilation special to generate the WSDL — it was created for united states of america automatically. As you tin see, a WSDL document is really merely an XML document that contains information about a web service.

The four main sections of a WSDL

A WSDL is broken upwards into 4 main sections: elements types, letters, portType, and bounden.

element types – Is the data types that are used by the web services.
Detect how the data in the WSDL matches the lawmaking in our web services.

 message element – This section describes the letters used by the web service and defines the data elements of an functioning:

the binding chemical element describes the communication protocols used by the web service:

portType element – The fourth element, portType, is more often than not considered to be the most of import element because it describes the web services and all the operations that can be performed, likewise equally all the messages of the service:

In the section higher up, the portType element defines DEMOAddNumbersSoap, DEMOAddNumbersHttpGet, and DEMOAddNumbersSoapPost every bit the proper name of the ports, and "AddThis" as the proper noun of the operation.

Besides notice that the ports are a Request-Response operation, meaning that our web service tin can receive a asking and will return a response. For case:

Request a request called AddThisHttpGetIn
wsdl:input message="tns:AddThisHttpGetIn"
Return a response called AddThisHttpGetIn
wsdl:output message="tns:AddThisHttpGetOut"

Next, let's look at the process of sending and receiving a request from a web service using a exam tool.

Web Service Testing Response and Requests

Now that we have a working web service and understand a basic WSDL, let's take a look at a spider web service's asking and response.

Start, permit's import our WSDL into our examination tool of selection. I volition be using SOAPUI (a costless open source tool), but you can use whatever tool you like.

In SoapUI, click on 'File\New soupUI project'. In the New soapUI projection, enter the Project Proper name: AddNums, and for Initial WSDL/WADL enter:

http://localhost/Webservice/DEMOAddNumbers.asmx?WSDL

SoapUI should import the "AddThis" method under projects AddNums\DEMOAddNumbersSOAP. Double-clicking on the AddThis 'Request 1' will show the following:

*Remember — the WSDL should include all the info needed to interact with a spider web service. That'south why soapUi was able to read in the WSDL and automatically generate a asking with the correct inputs for you.

Spider web Service Request/Response

Our DEMOAddNumbers web service is the most typical kind, in that, a requester (in this case our test tool) sends a request to the service and waits.

The service so processes the request and sends a reply. Let's come across this in action:

For our request, let's do a positive test past sending the service valid values:

This is the response I become back when I send the request from SOAPUI:

What does Soap have to do with Web Services

How does this communication take identify? Basically, SOAP — which is an XML-based protocol used for communicating with a Web Service — sends info to the request over HTTP. Lather stands for Unproblematic Object Access Protocol. If nosotros await at our request, we volition see soap elements such as SOAP Envelope, Header, and Body.

This is what a typical Lather XML message contains.

Soap Faults

For a Negative Test — if we send bad data in the request, a SoapFault should occur. So, if we send:

We should go back a soapFault:

As we can see, the SOAP XML is the aforementioned as our previous response, but now it also contains a Fault element. A Fault chemical element contains errors and condition info.

Open Source API Testing Tools for REST and WSDL based services

Remember Selenium is just for browser-based testing, you may be wondering which tool to utilize for Residue and Soap web service-based testing.

Check out my article on xv Open Source API Testing Tools For Residual & SOAP Service

Testing Web Services Wrap Upwards

And that'southward my take on spider web services in a nutshell. For a deeper dive, I recommend checking out the site www3school. I've as well found SOA for the Business Programmer: Concepts, BPEL, and SCA (Business organisation Developers series)
to be a great resource book.

If you are using Unified Functional Testing as well check out my latest Pluralsight video course

Quick Guide to API Testing with HP's Unified Functional Testing

Do I Have To Register .asmx,

Source: https://testguild.com/test-web-services/

Posted by: seeberseetumbrave.blogspot.com

0 Response to "Do I Have To Register .asmx"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel