I have a webservice that I wanted to return an ArrayList..Well the service
compiles and runs when I have the output defined as ArrayList, but the WSDL
defines the output as an Object so I was having a problem in the calling
program. I searched online and found suggestions that I return an Array
instead so I modified my code (below) to return an Array instead of an
ArrayList. Now I get the message when I try to run just my webservice
saying " You must implement.." The code and complete message are below. I
am unsure of where to go from here. I have found several other people that
had similar problems, but nothing seems to work. Thanks for your help.
<WebMethod()> _
Public Function GetTitlesForBin(ByVal BinNum As String) As Array
Dim sSql As String
Dim MyTitles As ArrayList = New ArrayList
Dim oConn As New SqlClient.SqlConnection(gMerch)
sSql = "SELECT P.POSDesc, X.UPC FROM Bin_Xref X "
sSql = sSql & " LEFT JOIN tblItm I"
sSql = sSql & " ON X.UPC = I.UPC"
sSql = sSql & " LEFT JOIN tblPrd P"
sSql = sSql & " ON I.GrphcKey = P.GrphcKey"
sSql = sSql & " WHERE X.Bin_Num='" & BinNum & "'"
sSql = sSql & " ORDER BY P.POSDesc"
Dim oCmd As New SqlClient.SqlCommand(sSql, oConn)
Dim oRead As SqlClient.SqlDataReader
oConn.Open()
oRead = oCmd.ExecuteReader
While oRead.Read
MyTitles.Add(Convert.ToString(oRead("POSDesc")))
MyTitles.Add(Convert.ToString(oRead("UPC")))
End While
oRead.Close()
oCmd.Dispose()
oConn.Dispose()
Return MyTitles.ToArray
End Function
____________________ERROR MESSAGE____________
You must implement a default accessor on System.Array because it inherits
from ICollection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: You must implement a
default accessor on System.Array because it inherits from ICollection.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: You must implement a default accessor on
System.Array because it inherits from ICollection.]
System.Xml.Serialization.TypeScope.GetCollectionEl ementType(Type type)
System.Xml.Serialization.TypeScope.ImportTypeDesc( Type type, Boolean
canBePrimitive, MemberInfo memberInfo)
System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type, MemberInfo source,
Boolean directReference)
System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMemberMapping(XmlReflectionMember
xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[]
xmlReflectionMembers, String ns, Boolean hasWrapperElement)
[InvalidOperationException: There was an error reflecting
'GetTitlesForBinResult'.]
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[]
xmlReflectionMembers, String ns, Boolean hasWrapperElement)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(String
elementName, String ns, XmlReflectionMember[] members, Boolean
hasWrapperElement)
System.Web.Services.Protocols.SoapReflector.Import MembersMapping(XmlReflectionImporter
xmlImporter, SoapReflectionImporter soapImporter, Boolean
serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle
paramStyle, String elementName, String elementNamespace, Boolean
nsIsDefault, XmlReflectionMember[] members, Boolean validate)
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo
methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
SoapReflectionImporter soapImporter, String defaultNs)
[InvalidOperationException: Method ItemLookup.GetTitlesForBin can not be
reflected.]
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo
methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
SoapReflectionImporter soapImporter, String defaultNs)
System.Web.Services.Description.SoapProtocolReflec tor.ReflectMethod()
System.Web.Services.Description.ProtocolReflector. ReflectBinding(ReflectedBinding
reflectedBinding)
System.Web.Services.Description.ProtocolReflector. Reflect()
System.Web.Services.Description.ServiceDescription Reflector.ReflectInternal(ProtocolReflector[]
reflectors)
System.Web.Services.Description.ServiceDescription Reflector.Reflect(Type
type, String url)
System.Web.Services.Protocols.DocumentationServerT ype..ctor(Type type,
String uri)
System.Web.Services.Protocols.DocumentationServerP rotocol.Initialize()
System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing) [InvalidOperationException: Unable to handle request.]
System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response)
[InvalidOperationException: Failed to handle request.]
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response)
System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContext
context, String verb, String url, String filePath)
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
Stacey Levine 5 19532
Hi Stacey,
Welcome to MSDN newsgroup.
From your description, in one of your ASP.NET webservice's webmethod,
you're returning a List of custom objects(string values), you used to use
ArrayList , and it now changed to use Array , but continue get the
"You must implement a default accessor on System.Array because it inherits
from ICollection. "
error when calling the webservice at clientside, yes?
AS for the return type, yes, generally we should avoid using .NET specific
type, so changing ArrayList to Array is a reasonable suggesiton. However, I
think the "Array" other member mentioned maybe means a specific
strong-named Array. For example,
int[] or string[]
So have you tried define your webmethod's return value as a explicit
defined string array like:
<WebMethod()>
Public Function GetTitlesForBin(ByVal BinNum as String) as String()
.....
also, you can check what's the type the clientside generated for this
webmethod in the proxy class. Generally there won't occur problems with
normal Array object.
Please have a test and feel free to post here if you got any new findings.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
From: "Stacey Levine" <st****@newsgroup.nospam>
Subject: Problem with webservice returning an array (You must implement a
default accessor on System.Array because it inherits from ICollection. )??
Date: Tue, 20 Sep 2005 14:32:03 -0400
Lines: 162
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
Message-ID: <e0**************@TK2MSFTNGP15.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: 208.49.251.54
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
microsoft.public.dotnet.framework.webservices:7961
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
I have a webservice that I wanted to return an ArrayList..Well the service
compiles and runs when I have the output defined as ArrayList, but the WSDL
defines the output as an Object so I was having a problem in the calling
program. I searched online and found suggestions that I return an Array
instead so I modified my code (below) to return an Array instead of an
ArrayList. Now I get the message when I try to run just my webservice
saying " You must implement.." The code and complete message are below. I
am unsure of where to go from here. I have found several other people that
had similar problems, but nothing seems to work. Thanks for your help.
<WebMethod()> _
Public Function GetTitlesForBin(ByVal BinNum As String) As Array
Dim sSql As String
Dim MyTitles As ArrayList = New ArrayList
Dim oConn As New SqlClient.SqlConnection(gMerch)
sSql = "SELECT P.POSDesc, X.UPC FROM Bin_Xref X "
sSql = sSql & " LEFT JOIN tblItm I"
sSql = sSql & " ON X.UPC = I.UPC"
sSql = sSql & " LEFT JOIN tblPrd P"
sSql = sSql & " ON I.GrphcKey = P.GrphcKey"
sSql = sSql & " WHERE X.Bin_Num='" & BinNum & "'"
sSql = sSql & " ORDER BY P.POSDesc"
Dim oCmd As New SqlClient.SqlCommand(sSql, oConn)
Dim oRead As SqlClient.SqlDataReader
oConn.Open()
oRead = oCmd.ExecuteReader
While oRead.Read
MyTitles.Add(Convert.ToString(oRead("POSDesc")))
MyTitles.Add(Convert.ToString(oRead("UPC")))
End While
oRead.Close()
oCmd.Dispose()
oConn.Dispose()
Return MyTitles.ToArray
End Function
____________________ERROR MESSAGE____________
You must implement a default accessor on System.Array because it inherits
from ICollection.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: You must implement a
default accessor on System.Array because it inherits from ICollection.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: You must implement a default accessor on
System.Array because it inherits from ICollection.]
System.Xml.Serialization.TypeScope.GetCollectionEl ementType(Type type)
System.Xml.Serialization.TypeScope.ImportTypeDesc( Type type, Boolean
canBePrimitive, MemberInfo memberInfo)
System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type, MemberInfo
source,
Boolean directReference)
System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMemberMapping(XmlReflec
tionMember
xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlRefle
ctionMember[]
xmlReflectionMembers, String ns, Boolean hasWrapperElement)
[InvalidOperationException: There was an error reflecting
'GetTitlesForBinResult'.]
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlRefle
ctionMember[]
xmlReflectionMembers, String ns, Boolean hasWrapperElement)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(String
elementName, String ns, XmlReflectionMember[] members, Boolean
hasWrapperElement)
System.Web.Services.Protocols.SoapReflector.Import MembersMapping(XmlReflecti
onImporter
xmlImporter, SoapReflectionImporter soapImporter, Boolean
serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use,
SoapParameterStyle
paramStyle, String elementName, String elementNamespace, Boolean
nsIsDefault, XmlReflectionMember[] members, Boolean validate)
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo
methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
SoapReflectionImporter soapImporter, String defaultNs)
[InvalidOperationException: Method ItemLookup.GetTitlesForBin can not be
reflected.]
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo
methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
SoapReflectionImporter soapImporter, String defaultNs)
System.Web.Services.Description.SoapProtocolReflec tor.ReflectMethod()
System.Web.Services.Description.ProtocolReflector. ReflectBinding(ReflectedBi
nding
reflectedBinding)
System.Web.Services.Description.ProtocolReflector. Reflect()
System.Web.Services.Description.ServiceDescription Reflector.ReflectInternal(
ProtocolReflector[]
reflectors)
System.Web.Services.Description.ServiceDescription Reflector.Reflect(Type
type, String url)
System.Web.Services.Protocols.DocumentationServerT ype..ctor(Type type,
String uri)
System.Web.Services.Protocols.DocumentationServerP rotocol.Initialize()
System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing) [InvalidOperationException: Unable to handle request.]
System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response)
[InvalidOperationException: Failed to handle request.]
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type
type, HttpContext context, HttpRequest request, HttpResponse response)
System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContex
t
context, String verb, String url, String filePath)
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
requestType, String path, String pathTranslated, Boolean useAppConfig)
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep
..Execute()
Stacey Levine
Stacey,
I wonder if it's because at compile time it can't know whether the classes
can serialised. For this instance, have you considered returning a DataSet or
DataTable which the proxy knows how to serialise?
"Stacey Levine" wrote: I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice saying " You must implement.." The code and complete message are below. I am unsure of where to go from here. I have found several other people that had similar problems, but nothing seems to work. Thanks for your help. <WebMethod()> _
Public Function GetTitlesForBin(ByVal BinNum As String) As Array
Dim sSql As String
Dim MyTitles As ArrayList = New ArrayList
Dim oConn As New SqlClient.SqlConnection(gMerch)
sSql = "SELECT P.POSDesc, X.UPC FROM Bin_Xref X "
sSql = sSql & " LEFT JOIN tblItm I"
sSql = sSql & " ON X.UPC = I.UPC"
sSql = sSql & " LEFT JOIN tblPrd P"
sSql = sSql & " ON I.GrphcKey = P.GrphcKey"
sSql = sSql & " WHERE X.Bin_Num='" & BinNum & "'"
sSql = sSql & " ORDER BY P.POSDesc"
Dim oCmd As New SqlClient.SqlCommand(sSql, oConn)
Dim oRead As SqlClient.SqlDataReader
oConn.Open()
oRead = oCmd.ExecuteReader
While oRead.Read
MyTitles.Add(Convert.ToString(oRead("POSDesc")))
MyTitles.Add(Convert.ToString(oRead("UPC")))
End While
oRead.Close()
oCmd.Dispose()
oConn.Dispose()
Return MyTitles.ToArray
End Function
____________________ERROR MESSAGE____________
You must implement a default accessor on System.Array because it inherits from ICollection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: You must implement a default accessor on System.Array because it inherits from ICollection.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[InvalidOperationException: You must implement a default accessor on System.Array because it inherits from ICollection.] System.Xml.Serialization.TypeScope.GetCollectionEl ementType(Type type) System.Xml.Serialization.TypeScope.ImportTypeDesc( Type type, Boolean canBePrimitive, MemberInfo memberInfo) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type, MemberInfo source, Boolean directReference) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type) System.Xml.Serialization.XmlReflectionImporter.Imp ortMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers) System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) [InvalidOperationException: There was an error reflecting 'GetTitlesForBinResult'.] System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement) System.Web.Services.Protocols.SoapReflector.Import MembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate) System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) [InvalidOperationException: Method ItemLookup.GetTitlesForBin can not be reflected.] System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) System.Web.Services.Description.SoapProtocolReflec tor.ReflectMethod() System.Web.Services.Description.ProtocolReflector. ReflectBinding(ReflectedBinding reflectedBinding) System.Web.Services.Description.ProtocolReflector. Reflect() System.Web.Services.Description.ServiceDescription Reflector.ReflectInternal(ProtocolReflector[] reflectors) System.Web.Services.Description.ServiceDescription Reflector.Reflect(Type type, String url) System.Web.Services.Protocols.DocumentationServerT ype..ctor(Type type, String uri) System.Web.Services.Protocols.DocumentationServerP rotocol.Initialize() System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type, HttpContext context, HttpRequest request, HttpResponse response) System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) [InvalidOperationException: Unable to handle request.] System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) [InvalidOperationException: Failed to handle request.] System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContext context, String verb, String url, String filePath) System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
Stacey Levine
The only possible problem is that I want a PocketPC device to be able to
call the webservice. And from what I can tell, it doesn't have the SQLClient
namespace..
"Paul Hasell" <pa*********@community.nospam> wrote in message
news:BF**********************************@microsof t.com... Stacey,
I wonder if it's because at compile time it can't know whether the classes can serialised. For this instance, have you considered returning a DataSet or DataTable which the proxy knows how to serialise?
"Stacey Levine" wrote:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice saying " You must implement.." The code and complete message are below. I am unsure of where to go from here. I have found several other people that had similar problems, but nothing seems to work. Thanks for your help. <WebMethod()> _
Public Function GetTitlesForBin(ByVal BinNum As String) As Array
Dim sSql As String
Dim MyTitles As ArrayList = New ArrayList
Dim oConn As New SqlClient.SqlConnection(gMerch)
sSql = "SELECT P.POSDesc, X.UPC FROM Bin_Xref X "
sSql = sSql & " LEFT JOIN tblItm I"
sSql = sSql & " ON X.UPC = I.UPC"
sSql = sSql & " LEFT JOIN tblPrd P"
sSql = sSql & " ON I.GrphcKey = P.GrphcKey"
sSql = sSql & " WHERE X.Bin_Num='" & BinNum & "'"
sSql = sSql & " ORDER BY P.POSDesc"
Dim oCmd As New SqlClient.SqlCommand(sSql, oConn)
Dim oRead As SqlClient.SqlDataReader
oConn.Open()
oRead = oCmd.ExecuteReader
While oRead.Read
MyTitles.Add(Convert.ToString(oRead("POSDesc")))
MyTitles.Add(Convert.ToString(oRead("UPC")))
End While
oRead.Close()
oCmd.Dispose()
oConn.Dispose()
Return MyTitles.ToArray
End Function
____________________ERROR MESSAGE____________
You must implement a default accessor on System.Array because it inherits from ICollection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: You must implement a default accessor on System.Array because it inherits from ICollection.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[InvalidOperationException: You must implement a default accessor on System.Array because it inherits from ICollection.] System.Xml.Serialization.TypeScope.GetCollectionEl ementType(Type type) System.Xml.Serialization.TypeScope.ImportTypeDesc( Type type, Boolean canBePrimitive, MemberInfo memberInfo) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type, MemberInfo source, Boolean directReference) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type) System.Xml.Serialization.XmlReflectionImporter.Imp ortMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers) System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) [InvalidOperationException: There was an error reflecting 'GetTitlesForBinResult'.] System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement) System.Web.Services.Protocols.SoapReflector.Import MembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate) System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) [InvalidOperationException: Method ItemLookup.GetTitlesForBin can not be reflected.] System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) System.Web.Services.Description.SoapProtocolReflec tor.ReflectMethod() System.Web.Services.Description.ProtocolReflector. ReflectBinding(ReflectedBinding reflectedBinding) System.Web.Services.Description.ProtocolReflector. Reflect() System.Web.Services.Description.ServiceDescription Reflector.ReflectInternal(ProtocolReflector[] reflectors) System.Web.Services.Description.ServiceDescription Reflector.Reflect(Type type, String url) System.Web.Services.Protocols.DocumentationServerT ype..ctor(Type type, String uri) System.Web.Services.Protocols.DocumentationServerP rotocol.Initialize() System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type, HttpContext context, HttpRequest request, HttpResponse response) System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) [InvalidOperationException: Unable to handle request.] System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) [InvalidOperationException: Failed to handle request.] System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContext context, String verb, String url, String filePath) System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
Stacey Levine
Stacey,
System.Data is not SQL specific but sits above the provider specific
namespaces for SQLClient and OLEDb. According to the documenation, SqlClient
is support on the copact framework (via a SQL CE driver) but OleDb isn't. So
in this instance use of DataSet and/or DataTable should be OK...unless you
want access from a non .NET client.
"Stacey Levine" wrote: The only possible problem is that I want a PocketPC device to be able to call the webservice. And from what I can tell, it doesn't have the SQLClient namespace.. "Paul Hasell" <pa*********@community.nospam> wrote in message news:BF**********************************@microsof t.com... Stacey,
I wonder if it's because at compile time it can't know whether the classes can serialised. For this instance, have you considered returning a DataSet or DataTable which the proxy knows how to serialise?
"Stacey Levine" wrote:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice saying " You must implement.." The code and complete message are below. I am unsure of where to go from here. I have found several other people that had similar problems, but nothing seems to work. Thanks for your help. <WebMethod()> _
Public Function GetTitlesForBin(ByVal BinNum As String) As Array
Dim sSql As String
Dim MyTitles As ArrayList = New ArrayList
Dim oConn As New SqlClient.SqlConnection(gMerch)
sSql = "SELECT P.POSDesc, X.UPC FROM Bin_Xref X "
sSql = sSql & " LEFT JOIN tblItm I"
sSql = sSql & " ON X.UPC = I.UPC"
sSql = sSql & " LEFT JOIN tblPrd P"
sSql = sSql & " ON I.GrphcKey = P.GrphcKey"
sSql = sSql & " WHERE X.Bin_Num='" & BinNum & "'"
sSql = sSql & " ORDER BY P.POSDesc"
Dim oCmd As New SqlClient.SqlCommand(sSql, oConn)
Dim oRead As SqlClient.SqlDataReader
oConn.Open()
oRead = oCmd.ExecuteReader
While oRead.Read
MyTitles.Add(Convert.ToString(oRead("POSDesc")))
MyTitles.Add(Convert.ToString(oRead("UPC")))
End While
oRead.Close()
oCmd.Dispose()
oConn.Dispose()
Return MyTitles.ToArray
End Function
____________________ERROR MESSAGE____________
You must implement a default accessor on System.Array because it inherits from ICollection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: You must implement a default accessor on System.Array because it inherits from ICollection.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[InvalidOperationException: You must implement a default accessor on System.Array because it inherits from ICollection.] System.Xml.Serialization.TypeScope.GetCollectionEl ementType(Type type) System.Xml.Serialization.TypeScope.ImportTypeDesc( Type type, Boolean canBePrimitive, MemberInfo memberInfo) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type, MemberInfo source, Boolean directReference) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type) System.Xml.Serialization.XmlReflectionImporter.Imp ortMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers) System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) [InvalidOperationException: There was an error reflecting 'GetTitlesForBinResult'.] System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement) System.Web.Services.Protocols.SoapReflector.Import MembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate) System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) [InvalidOperationException: Method ItemLookup.GetTitlesForBin can not be reflected.] System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) System.Web.Services.Description.SoapProtocolReflec tor.ReflectMethod() System.Web.Services.Description.ProtocolReflector. ReflectBinding(ReflectedBinding reflectedBinding) System.Web.Services.Description.ProtocolReflector. Reflect() System.Web.Services.Description.ServiceDescription Reflector.ReflectInternal(ProtocolReflector[] reflectors) System.Web.Services.Description.ServiceDescription Reflector.Reflect(Type type, String url) System.Web.Services.Protocols.DocumentationServerT ype..ctor(Type type, String uri) System.Web.Services.Protocols.DocumentationServerP rotocol.Initialize() System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type, HttpContext context, HttpRequest request, HttpResponse response) System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) [InvalidOperationException: Unable to handle request.] System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) [InvalidOperationException: Failed to handle request.] System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContext context, String verb, String url, String filePath) System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
Stacey Levine
Hi Stacey,
Yes, the System.Data namespace's classes are not specific to certain
DataBase product. Also, have you tried using the string[] as the return
type as I I mentioned in the last message?
If there're any further findings, please feel free to post here. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
Thread-Topic: Problem with webservice returning an array (You must implement
thread-index: AcW+tFxeV4gV37ZkSJ2RBhuq6cvzUA==
X-WBNR-Posting-Host: 62.6.144.66
From: "=?Utf-8?B?UGF1bCBIYXNlbGw=?=" <pa*********@community.nospam>
References: <e0**************@TK2MSFTNGP15.phx.gbl>
<BF**********************************@microsoft.co m>
<#H**************@TK2MSFTNGP12.phx.gbl>
Subject: Re: Problem with webservice returning an array (You must implement
Date: Wed, 21 Sep 2005 06:57:10 -0700
Lines: 197
Message-ID: <B8**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
microsoft.public.dotnet.framework.webservices:7985
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
Stacey,
System.Data is not SQL specific but sits above the provider specific
namespaces for SQLClient and OLEDb. According to the documenation,
SqlClient
is support on the copact framework (via a SQL CE driver) but OleDb isn't.
So
in this instance use of DataSet and/or DataTable should be OK...unless you
want access from a non .NET client.
"Stacey Levine" wrote: The only possible problem is that I want a PocketPC device to be able to call the webservice. And from what I can tell, it doesn't have the
SQLClient namespace.. "Paul Hasell" <pa*********@community.nospam> wrote in message news:BF**********************************@microsof t.com... Stacey,
I wonder if it's because at compile time it can't know whether the
classes can serialised. For this instance, have you considered returning a
DataSet or DataTable which the proxy knows how to serialise?
"Stacey Levine" wrote:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the
calling program. I searched online and found suggestions that I return an
Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice saying " You must implement.." The code and complete message are
below. I am unsure of where to go from here. I have found several other people that had similar problems, but nothing seems to work. Thanks for your help. <WebMethod()> _
Public Function GetTitlesForBin(ByVal BinNum As String) As Array
Dim sSql As String
Dim MyTitles As ArrayList = New ArrayList
Dim oConn As New SqlClient.SqlConnection(gMerch)
sSql = "SELECT P.POSDesc, X.UPC FROM Bin_Xref X "
sSql = sSql & " LEFT JOIN tblItm I"
sSql = sSql & " ON X.UPC = I.UPC"
sSql = sSql & " LEFT JOIN tblPrd P"
sSql = sSql & " ON I.GrphcKey = P.GrphcKey"
sSql = sSql & " WHERE X.Bin_Num='" & BinNum & "'"
sSql = sSql & " ORDER BY P.POSDesc"
Dim oCmd As New SqlClient.SqlCommand(sSql, oConn)
Dim oRead As SqlClient.SqlDataReader
oConn.Open()
oRead = oCmd.ExecuteReader
While oRead.Read
MyTitles.Add(Convert.ToString(oRead("POSDesc")))
MyTitles.Add(Convert.ToString(oRead("UPC")))
End While
oRead.Close()
oCmd.Dispose()
oConn.Dispose()
Return MyTitles.ToArray
End Function
____________________ERROR MESSAGE____________
You must implement a default accessor on System.Array because it
inherits from ICollection. Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: You must
implement a default accessor on System.Array because it inherits from ICollection.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below. Stack Trace:
[InvalidOperationException: You must implement a default accessor on System.Array because it inherits from ICollection.] System.Xml.Serialization.TypeScope.GetCollectionEl ementType(Type type) System.Xml.Serialization.TypeScope.ImportTypeDesc( Type type, Boolean canBePrimitive, MemberInfo memberInfo) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type, MemberInfo source, Boolean directReference) System.Xml.Serialization.TypeScope.GetTypeDesc(Typ e type)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMemberMapping(XmlReflec
tionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlRefle
ctionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) [InvalidOperationException: There was an error reflecting 'GetTitlesForBinResult'.]
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlRefle
ctionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement)
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement)
System.Web.Services.Protocols.SoapReflector.Import MembersMapping(XmlReflecti
onImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate)
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) [InvalidOperationException: Method ItemLookup.GetTitlesForBin can not
be reflected.]
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) System.Web.Services.Description.SoapProtocolReflec tor.ReflectMethod()
System.Web.Services.Description.ProtocolReflector. ReflectBinding(ReflectedBi
nding reflectedBinding) System.Web.Services.Description.ProtocolReflector. Reflect()
System.Web.Services.Description.ServiceDescription Reflector.ReflectInternal(
ProtocolReflector[] reflectors)
System.Web.Services.Description.ServiceDescription Reflector.Reflect(Type type, String url) System.Web.Services.Protocols.DocumentationServerT ype..ctor(Type type, String uri) System.Web.Services.Protocols.DocumentationServerP rotocol.Initialize() System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type, HttpContext context, HttpRequest request, HttpResponse response) System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response,
Boolean& abortProcessing) [InvalidOperationException: Unable to handle request.] System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response,
Boolean& abortProcessing)
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) [InvalidOperationException: Failed to handle request.]
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContex
t context, String verb, String url, String filePath) System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String requestType, String path, String pathTranslated, Boolean useAppConfig)
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep
.Execute()
Stacey Levine This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: emma middlebrook |
last post by:
Hi
Straight to the point - I don't understand why System.Array derives
from IList (given the methods/properties actually on IList).
When designing an interface you specify a contract. Deriving...
|
by: ORC |
last post by:
Hi,
How to create an ArrayList from a System.Array or inserting the System.Array
into the ArrayList ?
Thanks
Ole
|
by: Joe Doyle |
last post by:
I'm trying to do this-
....
void method1(System.Array arr)
{
// happen to know all elements in arr are int's
// this line throws an InvalidCastException
int intArr = (int) arr;
}
|
by: Chris |
last post by:
Hi,
the specs for System.Array are :
MustInherit Public Class Array
Implements ICloneable, IList, ICollection, IEnumerable
but I can't use any of the functions presented by IList in my code
...
|
by: Grigs |
last post by:
I have a C# Web Service that some of the methods (ones that return integers)
work and some do not (the ones that return a DataView.
Here is some code in the WebService that is giving me the...
|
by: Justin Drerup |
last post by:
I'm tryng to return a custom object that contains a collection of
MembershipUsers through a web service however I receive the following
error when trying to return the object through a web method:...
|
by: Polaris431 |
last post by:
A property in some class shows up in the object browser as follows:
public System.Collections.Generic.ICollection<DataSourceDataSources {
get; }
How do I access this property. I'm not sure...
|
by: =?Utf-8?B?aXdkdTE1?= |
last post by:
hi, im having a small issue. I pass a String object to a method, but then
when i try to use the Split method of a String array, it says System.Array
does not contain Split. The parameter of my...
|
by: Fred Mellender |
last post by:
I am trying to use reflection to output the fields (names and values) of an
arbitrary object -- an object dump to a TreeView.
It works pretty well, but I am having trouble with generic lists,...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |