Forum Discussion

robertsommer621's avatar
robertsommer621
New Contributor
5 months ago

Create a REST TestServer with, Get, Post, Delete, Push

Getting Started with REST Testing in SoapUI | SoapUI

Hello!

Do you know a good guide for a test server
step by step guide.
I need to access a test server from C# Desktop WPF application, query data, store data.

Thanks in advance.

I have no experience with the tool. There are so many settings. How do I start?

 

Regards Robert

    • GET   Read or retrieve data
    • POST  Add new data
    • PUT   Update data that already exists
    • DELETE Remove data

    I need to test this via a C# WPF desktop application. For this I need a SERVER. How can I achieve this quickly and easily? 
    There is so much information that is difficult for a beginner to understand.

    static async Task Main(string[] args)
    {
    	// Your XML string
    	string xmlData = @"<Request><Data>Hello, REST Interface!</Data></Request>";
    
    	// The URL to send the POST request to (update with your local server URL)
    	string url = "https://localhost:5044/api/MyHomeController";
    
    	// Create a new HttpClient instance
    	using (HttpClient client = new HttpClient())
    	{
    		// Set the content type to XML
    		HttpContent content = new StringContent(xmlData, Encoding.UTF8, "application/xml");
    
    		// Send the POST request
    		HttpResponseMessage response = await client.PostAsync(url, content);
    
    		// Ensure the response was successful, or throw an exception
    		response.EnsureSuccessStatusCode();
    
    		// Read the response content
    		string responseContent = await response.Content.ReadAsStringAsync();
    	}
    }