473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

specified cast is not valid

I haven't the slightest idea what is causing this problem. I get an error
in calling the Invoke method in my Web Reference to my Web Service. The
error is...
-----------
An unhandled exception of type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: System.Web.Services.Protocols.SoapException: Server
was unable to process request. ---> System.InvalidCastException: Specified
cast is not valid.
-----------

My web method has two string arguments and returns an integer....

<System.Diagnostics.DebuggerStepThroughAttribute() , _
System.ComponentModel.DesignerCategoryAttribute("c ode"), _
System.Web.Services.WebServiceBindingAttribute(Nam e:="ProxyServiceSoap",
[Namespace]:="http://www.myorg.org/MyService")> _
Public Class ProxyServiceWse
Inherits Microsoft.Web.Services2.WebServicesClientProtocol

'<remarks/>
Public Sub New()
MyBase.New
Me.Url = "http://www.myorg.org//proxy.asmx"
End Sub

'<remarks/>
<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://www.myorg.org/MyService/Authenticate",
RequestNamespace:="http://www.myorg.org/MyService",
ResponseNamespace:="http://www.myorg.org/MyService",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)>
_
Public Function Authenticate(ByVal MyID As String, ByVal Password As
String) As Integer
Dim results() As Object = Me.Invoke("Authenticate", New Object()
{UserID, Password})
Return CType(results(0),Integer)
End Function

.........

End Class
Nov 23 '05 #1
2 6993
Hi,

ehhh.. What is returned by

Dim results() As Object = Me.Invoke("Authenticate", New Object() ,
{UserID, Password})

And are you sure the first entry of the returned array is castable to
an integer? => CType(results(0),Integer)

Hope this helps,

Marvin Smit
On Wed, 13 Apr 2005 08:35:19 -0700, "Random" <ci*******@hotmail.com>
wrote:
I haven't the slightest idea what is causing this problem. I get an error
in calling the Invoke method in my Web Reference to my Web Service. The
error is...
-----------
An unhandled exception of type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: System.Web.Services.Protocols.SoapException: Server
was unable to process request. ---> System.InvalidCastException: Specified
cast is not valid.
-----------

My web method has two string arguments and returns an integer....

<System.Diagnostics.DebuggerStepThroughAttribute( ), _
System.ComponentModel.DesignerCategoryAttribute("c ode"), _
System.Web.Services.WebServiceBindingAttribute(Nam e:="ProxyServiceSoap",
[Namespace]:="http://www.myorg.org/MyService")> _
Public Class ProxyServiceWse
Inherits Microsoft.Web.Services2.WebServicesClientProtocol

'<remarks/>
Public Sub New()
MyBase.New
Me.Url = "http://www.myorg.org//proxy.asmx"
End Sub

'<remarks/>
<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://www.myorg.org/MyService/Authenticate",
RequestNamespace:="http://www.myorg.org/MyService",
ResponseNamespace:="http://www.myorg.org/MyService",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>
_
Public Function Authenticate(ByVal MyID As String, ByVal Password As
String) As Integer
Dim results() As Object = Me.Invoke("Authenticate", New Object()
{UserID, Password})
Return CType(results(0),Integer)
End Function

.........

End Class


Nov 23 '05 #2
Hi,

ehhh.. What is returned by

Dim results() As Object = Me.Invoke("Authenticate", New Object() ,
{UserID, Password})

And are you sure the first entry of the returned array is castable to
an integer? => CType(results(0),Integer)

Hope this helps,

Marvin Smit
On Wed, 13 Apr 2005 08:35:19 -0700, "Random" <ci*******@hotmail.com>
wrote:
I haven't the slightest idea what is causing this problem. I get an error
in calling the Invoke method in my Web Reference to my Web Service. The
error is...
-----------
An unhandled exception of type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: System.Web.Services.Protocols.SoapException: Server
was unable to process request. ---> System.InvalidCastException: Specified
cast is not valid.
-----------

My web method has two string arguments and returns an integer....

<System.Diagnostics.DebuggerStepThroughAttribute( ), _
System.ComponentModel.DesignerCategoryAttribute("c ode"), _
System.Web.Services.WebServiceBindingAttribute(Nam e:="ProxyServiceSoap",
[Namespace]:="http://www.myorg.org/MyService")> _
Public Class ProxyServiceWse
Inherits Microsoft.Web.Services2.WebServicesClientProtocol

'<remarks/>
Public Sub New()
MyBase.New
Me.Url = "http://www.myorg.org//proxy.asmx"
End Sub

'<remarks/>
<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://www.myorg.org/MyService/Authenticate",
RequestNamespace:="http://www.myorg.org/MyService",
ResponseNamespace:="http://www.myorg.org/MyService",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>
_
Public Function Authenticate(ByVal MyID As String, ByVal Password As
String) As Integer
Dim results() As Object = Me.Invoke("Authenticate", New Object()
{UserID, Password})
Return CType(results(0),Integer)
End Function

.........

End Class


Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tao | last post by:
I just upgraded .NET framework to 1.1 and VS.Net to 2003 version and tried to test it out. I created an ASP.NET project using the wizard and tried to run it by hitting "F5". I got an exception:...
4
by: Tyro | last post by:
Can someone shed some light on my error here? Thanks! Specified cast is not valid. Exception Details: System.InvalidCastException: Specified cast is not valid. Source Error: Stack Trace:
3
by: PK9 | last post by:
I am looking for assistance in pinpointing the cause of the following exception. I am getting a "Specified Cast is not valid" exception on my page. I am trying to populate a datagrid. One of my...
2
by: Fabian | last post by:
Hi, I work with asp.net 2.0 and I have a intermittent error, only happens a few times a day. In the page I evaluate a Query String and then I get data form a database. The code snipped: ...
3
by: VB Programmer | last post by:
I am setting up forms authentication. In my code I keep getting this error. Any ideas? Error.... Server Error in '/LandOLots' Application....
0
by: QA | last post by:
I am using a Business Scorecard Accelarator in a Sharepoint Portal 2003 using SQL Server 2005 I am getting the following error: Error,5/7/2005 10:50:14 AM,580,AUE1\Administrator,"Specified cast is...
0
by: Alan Z. Scharf | last post by:
this question in datagrid group for several days with no repsonse. I'm hoping for an answer her because of greater activity in this group. No cross-posting intended. Thanks....
8
by: Gamma | last post by:
I'm trying to inherit subclass from System.Diagnostics.Process, but whenever I cast a "Process" object to it's subclass, I encounter an exception "System.InvalidCastException" ("Specified cast is...
3
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is: ...
2
by: vinrin | last post by:
Thank for your answer. :-) call CheckEmptyNode (treeview) public void CheckEmptyNode( Object N ) { Microsoft.Web.UI.WebControls.TreeNode menuNode = null; ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.