Skip to content

Instantly share code, notes, and snippets.

@joncloud
Created November 1, 2016 23:06
Show Gist options
  • Select an option

  • Save joncloud/e257f986e931a57d9f0ef17b15a7f19d to your computer and use it in GitHub Desktop.

Select an option

Save joncloud/e257f986e931a57d9f0ef17b15a7f19d to your computer and use it in GitHub Desktop.
ASMX Validation Testing
C:\Users\jberube>http -f POST webapplication1720161101035312.azurewebsites.net/WebService1.asmx/HelloWorld value=3
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Encoding: gzip
Content-Length: 207
Content-Type: text/xml; charset=utf-8
Date: Tue, 01 Nov 2016 23:05:14 GMT
Server: Microsoft-IIS/8.0
Set-Cookie: ARRAffinity=285bc567c6481ca66c5f08029c563f66111719cb927bc7752fb1492dc8679956;Path=/;Domain=webapplication1720161101035312.azurewebsites.net
Vary: Accept-Encoding
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">Hello World: 3</string>
C:\Users\jberube>http -f POST webapplication1720161101035312.azurewebsites.net/WebService1.asmx/HelloWorld value=1
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Length: 29
Content-Type: text/plain; charset=utf-8
Date: Tue, 01 Nov 2016 23:04:53 GMT
Server: Microsoft-IIS/8.0
Set-Cookie: ARRAffinity=285bc567c6481ca66c5f08029c563f66111719cb927bc7752fb1492dc8679956;Path=/;Domain=webapplication1720161101035312.azurewebsites.net
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
message from soap exception
C:\Users\jberube>http -f POST webapplication1720161101035312.azurewebsites.net/WebService1.asmx/HelloWorld value=2
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Length: 42
Content-Type: text/plain; charset=utf-8
Date: Tue, 01 Nov 2016 23:05:01 GMT
Server: Microsoft-IIS/8.0
Set-Cookie: ARRAffinity=285bc567c6481ca66c5f08029c563f66111719cb927bc7752fb1492dc8679956;Path=/;Domain=webapplication1720161101035312.azurewebsites.net
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
message from invalid operation exception
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld(int value)
{
switch (value)
{
case 1:
throw new SoapException("message from soap exception", SoapException.ClientFaultCode);
case 2:
throw new InvalidOperationException("message from invalid operation exception");
}
return $"Hello World: {value}";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment