Click here to Skip to main content
15,902,938 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Need help using PostBackURL Pin
Meena T Shivaram19-Sep-06 3:56
Meena T Shivaram19-Sep-06 3:56 
GeneralRe: Need help using PostBackURL Pin
minhpc_bk20-Sep-06 0:26
minhpc_bk20-Sep-06 0:26 
GeneralRe: Need help using PostBackURL Pin
Meena T Shivaram20-Sep-06 5:06
Meena T Shivaram20-Sep-06 5:06 
Questionusing javascript with Textbox in composite controls of asp.net Pin
deepaks318-Sep-06 9:35
deepaks318-Sep-06 9:35 
AnswerRe: using javascript with Textbox in composite controls of asp.net Pin
Not Active18-Sep-06 10:33
mentorNot Active18-Sep-06 10:33 
QuestionSOAP Message Pin
Amit Kumar G18-Sep-06 8:06
Amit Kumar G18-Sep-06 8:06 
AnswerRe: SOAP Message Pin
Not Active18-Sep-06 8:54
mentorNot Active18-Sep-06 8:54 
GeneralRe: SOAP Message Pin
Amit Kumar G18-Sep-06 18:33
Amit Kumar G18-Sep-06 18:33 
Thanks for your reply. I need other help from your side. Thanks in advance for your inputs.

I have two probelems

a) I am getting error "The remote server returned an error: (500) Internal Server Error." whenever i tried to call web service.

b) I need to pass my web method name as runtime paramter. As web service can contain multiple web methods.....I am trying to pass as SOAPACTION but i am not sure syntax or infact is it correct way or not....

FYR i am sharing source code as below
Client Code:
'Create a new HttpWebRequest to the mentioned URL.
'hard code for time being
httpRequest = WebRequest.Create("http://localhost/XYZWS/XYZCustomerService/XYZCustomerService.asmx")
' Set Request information (Header, ContentLength, ContentType, etc)
'hard code for time being. Passing sxml here.
Dim bodyData As Byte() = Encoding.UTF8.GetBytes(sXML)
httpRequest.ContentLength = bodyData.Length
httpRequest.ContentType = "text/xml; charset=utf-8"
'hard code for time being in future it will be thru parameter
httpRequest.Headers.Add("SOAPAction", "SaveCustomerService")
httpRequest.Method = "POST"
' Set 'Preauthenticate' property to true. Credentials will be sent with 'the request.
httpRequest.PreAuthenticate = True

' Create a New 'NetworkCredential' object.
Dim networkCredentials As NetworkCredential = New NetworkCredential("A", "b")

' Associate the 'NetworkCredential' object with the 'HttpWebRequest' object.
httpRequest.Credentials = networkCredentials

' Create a new RequestStream to POST info (Synchronous call)
requestStream = httpRequest.GetRequestStream()
requestWriter = New StreamWriter(requestStream)

'Write Soap message into RequestStream
requestWriter.Write(sXML)

' Cleanup
requestWriter.Close()
requestStream.Close()

' Create a new HttpWebResponse (Synchronous call)
'HttpWebResponse response = httpRequest . GetResponse ( ) as HttpWebResponse

'Dim httpResponse As System.net.HttpWebResponse
'httpResponse = httpRequest.GetResponse()

Dim httpResponse As HttpWebResponse
httpResponse = CType(httpRequest.GetResponse(), HttpWebResponse)


' Extract normal SOAP response.
responseStream = httpResponse.GetResponseStream()
responseReader = New StreamReader(responseStream)

'Fetch the XML.
Dim httpResult As String = responseReader.ReadToEnd()

' Cleanup
responseReader.Close()
responseStream.Close()

' Return XML.
'Return httpResult

Catch myerr As WebException
' Populate the table with the exception details.
ErrorTable.Rows.Add(BuildNewRow("Source", myerr.Source))
ErrorTable.Rows.Add(BuildNewRow("Error Message", myerr.Message))
ErrorTable.Rows.Add(BuildNewRow("Status", myerr.Status))
'ErrorTable.Rows.Add(BuildNewRow("Response", myerr.Response))
ErrorTable.Rows.Add(BuildNewRow("Detail", myerr.StackTrace))
Return
Catch myerr As SoapException
' Populate the table with the exception details.
ErrorTable.Rows.Add(BuildNewRow("Fault Code Namespace", myerr.Code.Namespace))
ErrorTable.Rows.Add(BuildNewRow("Fault Code Name", myerr.Code.Name))
ErrorTable.Rows.Add(BuildNewRow("SOAP Actor that threw Exception", myerr.Actor))
ErrorTable.Rows.Add(BuildNewRow("Error Message", myerr.Message))
ErrorTable.Rows.Add(BuildNewRow("Detail", HttpUtility.HtmlEncode(myerr.Detail.OuterXml)))
Return
End Try

</code>

Now here is web service code and GetXMlValue is custom function to read xml node value

<WebMethod(MessageName:="SaveCustomerService")> _
Public Function SaveCustomerService(ByVal CustomerService As String) As String
Try
Dim sUserName, sEmail, sCategory, sSubject, sMessage As String
sUserName = GetXmlValue(CustomerService, "username")
sEmail = GetXmlValue(CustomerService, "email")
sCategory = GetXmlValue(CustomerService, "category")
sSubject = GetXmlValue(CustomerService, "subject")
sMessage = GetXmlValue(CustomerService, "message")
SaveCustomerService(sUserName, sEmail, sCategory, sSubject, sMessage)
Catch ex As Exception
Dim a As New ThrowSoapException
a.myThrow()
End Try


FYI
For probelm one i added below line of code in web.config of web service also

<webServices>
<protocols>
<add name="HttpPost" />
</protocols>
</webServices>

Thanks in advance....

Amit
GeneralRe: SOAP Message Pin
Not Active18-Sep-06 18:44
mentorNot Active18-Sep-06 18:44 
GeneralRe: SOAP Message Pin
Amit Kumar G18-Sep-06 18:55
Amit Kumar G18-Sep-06 18:55 
AnswerRe: SOAP Message Pin
Neeraj Arora18-Sep-06 18:35
Neeraj Arora18-Sep-06 18:35 
QuestionMemory management Pin
harshActsw18-Sep-06 7:31
harshActsw18-Sep-06 7:31 
AnswerRe: Memory management Pin
deepaks318-Sep-06 9:41
deepaks318-Sep-06 9:41 
GeneralLearning VS 2005 Pin
wEb GuRu...18-Sep-06 7:04
wEb GuRu...18-Sep-06 7:04 
GeneralRe: Learning VS 2005 Pin
minhpc_bk18-Sep-06 15:08
minhpc_bk18-Sep-06 15:08 
QuestionOutlook Calendar using ASP.NET 2.0 Pin
student_rhr18-Sep-06 6:57
student_rhr18-Sep-06 6:57 
QuestionView state Pin
amaneet18-Sep-06 6:54
amaneet18-Sep-06 6:54 
AnswerExplain ur Question Pin
wEb GuRu...18-Sep-06 7:39
wEb GuRu...18-Sep-06 7:39 
GeneralRe: Explain ur Question Pin
amaneet18-Sep-06 7:58
amaneet18-Sep-06 7:58 
GeneralRe: Explain ur Question Pin
Christian Graus18-Sep-06 18:11
protectorChristian Graus18-Sep-06 18:11 
AnswerRe: View state Pin
deepaks318-Sep-06 9:36
deepaks318-Sep-06 9:36 
AnswerRe: View state Pin
_AK_18-Sep-06 18:28
_AK_18-Sep-06 18:28 
Question2.0 Questions Pin
cisco210318-Sep-06 5:47
cisco210318-Sep-06 5:47 
AnswerRe: 2.0 Questions Pin
minhpc_bk18-Sep-06 15:22
minhpc_bk18-Sep-06 15:22 
QuestionHiearchial representation in Grid Pin
Balji18-Sep-06 5:42
Balji18-Sep-06 5:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.