Re: Problem with webservice returning an array (You must implement
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Thu, 22 Sep 2005 06:00:57 GMT
{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Hi Stacey,
\par
\par 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?
\par If there're any further findings, please feel free to post here. Thanks,
\par
\par Steven Cheng
\par Microsoft Online Support
\par
\par Get Secure! www.microsoft.com/security
\par (This posting is provided "AS IS", with no warranties, and confers no rights.)
\par \pard\li720 --------------------
\par Thread-Topic: Problem with webservice returning an array (You must implement
\par thread-index: AcW+tFxeV4gV37ZkSJ2RBhuq6cvzUA==
\par X-WBNR-Posting-Host: 62.6.144.66
\par From: "=?Utf-8?B?UGF1bCBIYXNlbGw=?=" <paul_hasell@xxxxxxxxxxxxxxxx>
\par References: <e0BJAFhvFHA.2556@xxxxxxxxxxxxxxxxxxxx> <BF3A9E6D-F50E-4AA3-913A-E5C8E300C538@xxxxxxxxxxxxx> <#H1XkBrvFHA.3864@xxxxxxxxxxxxxxxxxxxx>
\par Subject: Re: Problem with webservice returning an array (You must implement
\par Date: Wed, 21 Sep 2005 06:57:10 -0700
\par Lines: 197
\par Message-ID: <B8A59040-EA0C-46C7-B42F-46B1F1329582@xxxxxxxxxxxxx>
\par MIME-Version: 1.0
\par Content-Type: text/plain;
\par \tab charset="Utf-8"
\par Content-Transfer-Encoding: 7bit
\par X-Newsreader: Microsoft CDO for Windows 2000
\par Content-Class: urn:content-classes:message
\par Importance: normal
\par Priority: normal
\par X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
\par Newsgroups: microsoft.public.dotnet.framework.webservices
\par NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
\par Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
\par Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.webservices:7985
\par X-Tomcat-NG: microsoft.public.dotnet.framework.webservices
\par
\par Stacey,
\par
\par System.Data is not SQL specific but sits above the provider specific
\par namespaces for SQLClient and OLEDb. According to the documenation, SqlClient
\par is support on the copact framework (via a SQL CE driver) but OleDb isn't. So
\par in this instance use of DataSet and/or DataTable should be OK...unless you
\par want access from a non .NET client.
\par
\par "Stacey Levine" wrote:
\par
\par > The only possible problem is that I want a PocketPC device to be able to
\par > call the webservice. And from what I can tell, it doesn't have the SQLClient
\par > namespace..
\par > "Paul Hasell" <paul_hasell@xxxxxxxxxxxxxxxx> wrote in message
\par > news:BF3A9E6D-F50E-4AA3-913A-E5C8E300C538@xxxxxxxxxxxxxxxx
\par > > Stacey,
\par > >
\par > > I wonder if it's because at compile time it can't know whether the classes
\par > > can serialised. For this instance, have you considered returning a DataSet
\par > > or
\par > > DataTable which the proxy knows how to serialise?
\par > >
\par > > "Stacey Levine" wrote:
\par > >
\par > >> I have a webservice that I wanted to return an ArrayList..Well the
\par > >> service
\par > >> compiles and runs when I have the output defined as ArrayList, but the
\par > >> WSDL
\par > >> defines the output as an Object so I was having a problem in the calling
\par > >> program. I searched online and found suggestions that I return an Array
\par > >> instead so I modified my code (below) to return an Array instead of an
\par > >> ArrayList. Now I get the message when I try to run just my webservice
\par > >> saying " You must implement.." The code and complete message are below.
\par > >> I
\par > >> am unsure of where to go from here. I have found several other people
\par > >> that
\par > >> had similar problems, but nothing seems to work. Thanks for your help.
\par > >>
\par > >>
\par > >>
\par > >> <WebMethod()> _
\par > >>
\par > >> Public Function GetTitlesForBin(ByVal BinNum As String) As Array
\par > >>
\par > >> Dim sSql As String
\par > >>
\par > >> Dim MyTitles As ArrayList = New ArrayList
\par > >>
\par > >> Dim oConn As New SqlClient.SqlConnection(gMerch)
\par > >>
\par > >> sSql = "SELECT P.POSDesc, X.UPC FROM Bin_Xref X "
\par > >>
\par > >> sSql = sSql & " LEFT JOIN tblItm I"
\par > >>
\par > >> sSql = sSql & " ON X.UPC = I.UPC"
\par > >>
\par > >> sSql = sSql & " LEFT JOIN tblPrd P"
\par > >>
\par > >> sSql = sSql & " ON I.GrphcKey = P.GrphcKey"
\par > >>
\par > >> sSql = sSql & " WHERE X.Bin_Num='" & BinNum & "'"
\par > >>
\par > >> sSql = sSql & " ORDER BY P.POSDesc"
\par > >>
\par > >> Dim oCmd As New SqlClient.SqlCommand(sSql, oConn)
\par > >>
\par > >> Dim oRead As SqlClient.SqlDataReader
\par > >>
\par > >> oConn.Open()
\par > >>
\par > >> oRead = oCmd.ExecuteReader
\par > >>
\par > >> While oRead.Read
\par > >>
\par > >> MyTitles.Add(Convert.ToString(oRead("POSDesc")))
\par > >>
\par > >> MyTitles.Add(Convert.ToString(oRead("UPC")))
\par > >>
\par > >> End While
\par > >>
\par > >> oRead.Close()
\par > >>
\par > >> oCmd.Dispose()
\par > >>
\par > >> oConn.Dispose()
\par > >>
\par > >> Return MyTitles.ToArray
\par > >>
\par > >> End Function
\par > >>
\par > >>
\par > >>
\par > >>
\par > >>
\par > >> ____________________ERROR MESSAGE____________
\par > >>
\par > >> You must implement a default accessor on System.Array because it inherits
\par > >> from ICollection.
\par > >> Description: An unhandled exception occurred during the execution of the
\par > >> current web request. Please review the stack trace for more information
\par > >> about the error and where it originated in the code.
\par > >>
\par > >> Exception Details: System.InvalidOperationException: You must implement a
\par > >> default accessor on System.Array because it inherits from ICollection.
\par > >>
\par > >> Source Error:
\par > >>
\par > >> An unhandled exception was generated during the execution of the
\par > >> current web request. Information regarding the origin and location of the
\par > >> exception can be identified using the exception stack trace below.
\par > >>
\par > >>
\par > >>
\par > >> Stack Trace:
\par > >>
\par > >> [InvalidOperationException: You must implement a default accessor on
\par > >> System.Array because it inherits from ICollection.]
\par > >> System.Xml.Serialization.TypeScope.GetCollectionElementType(Type type)
\par > >> System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean
\par > >> canBePrimitive, MemberInfo memberInfo)
\par > >> System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo
\par > >> source,
\par > >> Boolean directReference)
\par > >> System.Xml.Serialization.TypeScope.GetTypeDesc(Type type)
\par > >> System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember
\par > >> xmlReflectionMember, String ns, XmlReflectionMember[]
\par > >> xmlReflectionMembers)
\par > >> System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[]
\par > >> xmlReflectionMembers, String ns, Boolean hasWrapperElement)
\par > >> [InvalidOperationException: There was an error reflecting
\par > >> 'GetTitlesForBinResult'.]
\par > >> System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[]
\par > >> xmlReflectionMembers, String ns, Boolean hasWrapperElement)
\par > >> System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String
\par > >> elementName, String ns, XmlReflectionMember[] members, Boolean
\par > >> hasWrapperElement)
\par > >> System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter
\par > >> xmlImporter, SoapReflectionImporter soapImporter, Boolean
\par > >> serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use,
\par > >> SoapParameterStyle
\par > >> paramStyle, String elementName, String elementNamespace, Boolean
\par > >> nsIsDefault, XmlReflectionMember[] members, Boolean validate)
\par > >> System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo
\par > >> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
\par > >> SoapReflectionImporter soapImporter, String defaultNs)
\par > >> [InvalidOperationException: Method ItemLookup.GetTitlesForBin can not be
\par > >> reflected.]
\par > >> System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo
\par > >> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
\par > >> SoapReflectionImporter soapImporter, String defaultNs)
\par > >> System.Web.Services.Description.SoapProtocolReflector.ReflectMethod()
\par > >> System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding
\par > >> reflectedBinding)
\par > >> System.Web.Services.Description.ProtocolReflector.Reflect()
\par > >> System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[]
\par > >> reflectors)
\par > >> System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type
\par > >> type, String url)
\par > >> System.Web.Services.Protocols.DocumentationServerType..ctor(Type type,
\par > >> String uri)
\par > >> System.Web.Services.Protocols.DocumentationServerProtocol.Initialize()
\par > >> System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,
\par > >> HttpContext context, HttpRequest request, HttpResponse response)
\par > >> System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
\par > >> HttpContext context, HttpRequest request, HttpResponse response, Boolean&
\par > >> abortProcessing) [InvalidOperationException: Unable to handle request.]
\par > >> System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
\par > >> HttpContext context, HttpRequest request, HttpResponse response, Boolean&
\par > >> abortProcessing)
\par > >> System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
\par > >> type, HttpContext context, HttpRequest request, HttpResponse response)
\par > >> [InvalidOperationException: Failed to handle request.]
\par > >> System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
\par > >> type, HttpContext context, HttpRequest request, HttpResponse response)
\par > >> System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext
\par > >> context, String verb, String url, String filePath)
\par > >> System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
\par > >> requestType, String path, String pathTranslated, Boolean useAppConfig)
\par > >> System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
\par > >>
\par > >>
\par > >>
\par > >>
\par > >>
\par > >> Stacey Levine
\par > >>
\par > >>
\par > >>
\par > >>
\par > >>
\par > >>
\par > >>
\par > >>
\par > >>
\par >
\par >
\par >
\par \pard
\par
\par }
- References:
- Problem with webservice returning an array (You must implement a default accessor on System.Array because it inherits from ICollection. )??
- From: Stacey Levine
- RE: Problem with webservice returning an array (You must implement a d
- From: Paul Hasell
- Re: Problem with webservice returning an array (You must implement a d
- From: Stacey Levine
- Re: Problem with webservice returning an array (You must implement
- From: Paul Hasell
- Problem with webservice returning an array (You must implement a default accessor on System.Array because it inherits from ICollection. )??
- Prev by Date:
Re: Web Services without IIS ? Is it possible and how, please ? - Next by Date:
Re: not to use auto generated proxies - Previous by thread:
Re: Problem with webservice returning an array (You must implement - Next by thread:
Timeout errors making a web service call from another web service - Index(es):