I have an ASMX service, which has the below method. I want to debug this method, so I have put a breakpoint on it. But I am not able to send a request to it successfully, It gives a 404 error.
[WebMethod]
public void RequestNotification()
{
I have tried these options so far.
Page screenshots for reference.
This is how I am calling from the C# code, and this is also not hitting the breakpoint on the method RequestNotification
of service. and it's not giving any exceptions also in the C# code.
MyService myService= new MyService ();
myService.RequestNotification();
Update: I have tried as described in the below answer, I am still getting 404.
Please find below the request screenshot.
CodePudding user response:
Using POST call from Postman with XML Body
POST URL
http://www.dneonline.com/calculator.asmx
In body with XML
ray selection
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Add xmlns="http://tempuri.org/">
<intA>100</intA>
<intB>200</intB>
</Add>
</soap:Body>
</soap:Envelope>
I got response this from service
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<AddResponse xmlns="http://tempuri.org/">
<AddResult>300</AddResult>
</AddResponse>
</soap:Body>
</soap:Envelope>
If you click code
button from Postman, you can get the curl
command too.
curl --location --request POST 'http://www.dneonline.com/calculator.asmx' \
--header 'Content-Type: text/xml; charset=utf-8' \
--header 'SOAPAction: http://tempuri.org/Add' \
--data-raw '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Add xmlns="http://tempuri.org/">
<intA>100</intA>
<intB>200</intB>
</Add>
</soap:Body>
</soap:Envelope>
'
CodePudding user response:
@Bench Vue's answer has helped me in solving the issue. I am able to solve the issue with the below request.
Request and Response: