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=?=" <paul_hasell@community.nospam>
References: <e0BJAFhvFHA.2556@TK2MSFTNGP15.phx.gbl>
<BF3A9E6D-F50E-4AA3-913A-E5C8E300C538@microsoft.com>
<#H1XkBrvFHA.3864@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: <B8A59040-EA0C-46C7-B42F-46B1F1329582@microsoft.com>
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:
[color=blue]
> 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[/color]
SQLClient[color=blue]
> namespace..
> "Paul Hasell" <paul_hasell@community.nospam> wrote in message
> news:BF3A9E6D-F50E-4AA3-913A-E5C8E300C538@microsoft.com...[color=green]
> > Stacey,
> >
> > I wonder if it's because at compile time it can't know whether the[/color][/color]
classes[color=blue][color=green]
> > can serialised. For this instance, have you considered returning a[/color][/color]
DataSet[color=blue][color=green]
> > or
> > DataTable which the proxy knows how to serialise?
> >
> > "Stacey Levine" wrote:
> >[color=darkred]
> >> 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[/color][/color][/color]
calling[color=blue][color=green][color=darkred]
> >> program. I searched online and found suggestions that I return an[/color][/color][/color]
Array[color=blue][color=green][color=darkred]
> >> 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[/color][/color][/color]
below.[color=blue][color=green][color=darkred]
> >> 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[/color][/color][/color]
inherits[color=blue][color=green][color=darkred]
> >> from ICollection.
> >> Description: An unhandled exception occurred during the execution of[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> >> 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[/color][/color][/color]
implement a[color=blue][color=green][color=darkred]
> >> 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[/color][/color][/color]
the[color=blue][color=green][color=darkred]
> >> 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)
> >>[/color][/color][/color]
System.Xml.Serialization.XmlReflectionImporter.Imp ortMemberMapping(XmlReflec
tionMember[color=blue][color=green][color=darkred]
> >> xmlReflectionMember, String ns, XmlReflectionMember[]
> >> xmlReflectionMembers)
> >>[/color][/color][/color]
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlRefle
ctionMember[][color=blue][color=green][color=darkred]
> >> xmlReflectionMembers, String ns, Boolean hasWrapperElement)
> >> [InvalidOperationException: There was an error reflecting
> >> 'GetTitlesForBinResult'.]
> >>[/color][/color][/color]
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(XmlRefle
ctionMember[][color=blue][color=green][color=darkred]
> >> xmlReflectionMembers, String ns, Boolean hasWrapperElement)
> >>[/color][/color][/color]
System.Xml.Serialization.XmlReflectionImporter.Imp ortMembersMapping(String[color=blue][color=green][color=darkred]
> >> elementName, String ns, XmlReflectionMember[] members, Boolean
> >> hasWrapperElement)
> >>[/color][/color][/color]
System.Web.Services.Protocols.SoapReflector.Import MembersMapping(XmlReflecti
onImporter[color=blue][color=green][color=darkred]
> >> xmlImporter, SoapReflectionImporter soapImporter, Boolean
> >> serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use,
> >> SoapParameterStyle
> >> paramStyle, String elementName, String elementNamespace, Boolean
> >> nsIsDefault, XmlReflectionMember[] members, Boolean validate)
> >>[/color][/color][/color]
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo[color=blue][color=green][color=darkred]
> >> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
> >> SoapReflectionImporter soapImporter, String defaultNs)
> >> [InvalidOperationException: Method ItemLookup.GetTitlesForBin can not[/color][/color][/color]
be[color=blue][color=green][color=darkred]
> >> reflected.]
> >>[/color][/color][/color]
System.Web.Services.Protocols.SoapReflector.Reflec tMethod(LogicalMethodInfo[color=blue][color=green][color=darkred]
> >> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
> >> SoapReflectionImporter soapImporter, String defaultNs)
> >> System.Web.Services.Description.SoapProtocolReflec tor.ReflectMethod()
> >>[/color][/color][/color]
System.Web.Services.Description.ProtocolReflector. ReflectBinding(ReflectedBi
nding[color=blue][color=green][color=darkred]
> >> reflectedBinding)
> >> System.Web.Services.Description.ProtocolReflector. Reflect()
> >>[/color][/color][/color]
System.Web.Services.Description.ServiceDescription Reflector.ReflectInternal(
ProtocolReflector[][color=blue][color=green][color=darkred]
> >> reflectors)
> >>[/color][/color][/color]
System.Web.Services.Description.ServiceDescription Reflector.Reflect(Type[color=blue][color=green][color=darkred]
> >> 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,[/color][/color][/color]
Boolean&[color=blue][color=green][color=darkred]
> >> abortProcessing) [InvalidOperationException: Unable to handle request.]
> >> System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
> >> HttpContext context, HttpRequest request, HttpResponse response,[/color][/color][/color]
Boolean&[color=blue][color=green][color=darkred]
> >> abortProcessing)
> >>[/color][/color][/color]
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type[color=blue][color=green][color=darkred]
> >> type, HttpContext context, HttpRequest request, HttpResponse response)
> >> [InvalidOperationException: Failed to handle request.]
> >>[/color][/color][/color]
System.Web.Services.Protocols.WebServiceHandlerFac tory.CoreGetHandler(Type[color=blue][color=green][color=darkred]
> >> type, HttpContext context, HttpRequest request, HttpResponse response)
> >>[/color][/color][/color]
System.Web.Services.Protocols.WebServiceHandlerFac tory.GetHandler(HttpContex
t[color=blue][color=green][color=darkred]
> >> context, String verb, String url, String filePath)
> >> System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String
> >> requestType, String path, String pathTranslated, Boolean useAppConfig)
> >>[/color][/color][/color]
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep
.Execute()[color=blue][color=green][color=darkred]
> >>
> >>
> >>
> >>
> >>
> >> Stacey Levine
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>[/color][/color]
>
>
>[/color]