TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rahul Patil
1.5k
183
31.1k
Issue With WebService in asp.net?
Dec 25 2019 12:30 AM
I m working with web services using store procedure and when I m inserted a record using Webservice then inserted successfully but when I click on service description than data not display but the record is inserted successfully in the database and when I test my web service in postman then get an error see below:
In PostMan:
(post) http:
//localhost:25880/PaymentMode.asmx?op=login
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
soap:Envelope
xmlns:soap
=
"http://www.w3.org/2003/05/soap-envelope"
xmlns:xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd
=
"http://www.w3.org/2001/XMLSchema"
>
<
soap:Body
>
<
soap:Fault
>
<
soap:Code
>
<
soap:Value
>
soap:Receiver
</
soap:Value
>
</
soap:Code
>
<
soap:Reason
>
<
soap:Text
xml:lang
=
"en"
>
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---
>
System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.Read()
at System.Xml.XmlReader.MoveToContent()
at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.MoveToContent()
at System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement()
at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
--- End of inner exception stack trace ---
</
soap:Text
>
</
soap:Reason
>
<
soap:Detail
/>
</
soap:Fault
>
</
soap:Body
>
</
soap:Envelope
>
[WebMethod]
public
string
login(
string
uname,
string
pass)
{
cn.Open();
SqlCommand cmd =
new
SqlCommand(
"loginsp"
, cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue(
"@username"
,uname);
cmd.Parameters.AddWithValue(
"@password"
, pass);
try
{
cmd.ExecuteNonQuery();
return
"inserted data successfully"
;
}
catch
(Exception)
{
return
"
inserted data not successfully
"
;
throw
;
}
finally
{
cn.Close();
}
}
store procedure:
CREATE
PROCEDURE
loginsp
@username
varchar
(50),
@
password
varchar
(50)
AS
BEGIN
Insert
Into
studlogin
values
(@username,@
password
);
END
GO
problem is that click on service description than data not display but the record is inserted successfully in the database and when I test my web service in postman then get an error??
what I m doing wrong in my above code??help??
Reply
Answers (
9
)
How to handle database datas in List<>
Access to control in Detailsview By Javascript