Re: Problem with webservice returning an array (You must implement a d
- From: "Stacey Levine" <stacey@xxxxxxxxxxxxxxxx>
- Date: Wed, 21 Sep 2005 09:31:15 -0400
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" <paul_hasell@xxxxxxxxxxxxxxxx> wrote in message
news:BF3A9E6D-F50E-4AA3-913A-E5C8E300C538@xxxxxxxxxxxxxxxx
> 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.GetCollectionElementType(Type type)
>> System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean
>> canBePrimitive, MemberInfo memberInfo)
>> System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo
>> source,
>> Boolean directReference)
>> System.Xml.Serialization.TypeScope.GetTypeDesc(Type type)
>> System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember
>> xmlReflectionMember, String ns, XmlReflectionMember[]
>> xmlReflectionMembers)
>> System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[]
>> xmlReflectionMembers, String ns, Boolean hasWrapperElement)
>> [InvalidOperationException: There was an error reflecting
>> 'GetTitlesForBinResult'.]
>> System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[]
>> xmlReflectionMembers, String ns, Boolean hasWrapperElement)
>> System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String
>> elementName, String ns, XmlReflectionMember[] members, Boolean
>> hasWrapperElement)
>> System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(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.ReflectMethod(LogicalMethodInfo
>> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
>> SoapReflectionImporter soapImporter, String defaultNs)
>> [InvalidOperationException: Method ItemLookup.GetTitlesForBin can not be
>> reflected.]
>> System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo
>> methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
>> SoapReflectionImporter soapImporter, String defaultNs)
>> System.Web.Services.Description.SoapProtocolReflector.ReflectMethod()
>> System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding
>> reflectedBinding)
>> System.Web.Services.Description.ProtocolReflector.Reflect()
>> System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[]
>> reflectors)
>> System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type
>> type, String url)
>> System.Web.Services.Protocols.DocumentationServerType..ctor(Type type,
>> String uri)
>> System.Web.Services.Protocols.DocumentationServerProtocol.Initialize()
>> System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,
>> HttpContext context, HttpRequest request, HttpResponse response)
>> System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
>> HttpContext context, HttpRequest request, HttpResponse response, Boolean&
>> abortProcessing) [InvalidOperationException: Unable to handle request.]
>> System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
>> HttpContext context, HttpRequest request, HttpResponse response, Boolean&
>> abortProcessing)
>> System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
>> type, HttpContext context, HttpRequest request, HttpResponse response)
>> [InvalidOperationException: Failed to handle request.]
>> System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type
>> type, HttpContext context, HttpRequest request, HttpResponse response)
>> System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext
>> context, String verb, String url, String filePath)
>> System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
>> requestType, String path, String pathTranslated, Boolean useAppConfig)
>> System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
>>
>>
>>
>>
>>
>> Stacey Levine
>>
>>
>>
>>
>>
>>
>>
>>
>>
.
- Follow-Ups:
- Re: Problem with webservice returning an array (You must implement
- From: Paul Hasell
- Re: Problem with webservice returning an array (You must implement
- References:
- Prev by Date: RE: Problem with webservice returning an array (You must implement a d
- Next by Date: Re: Problem with webservice returning an array (You must implement
- Previous by thread: RE: Problem with webservice returning an array (You must implement a d
- Next by thread: Re: Problem with webservice returning an array (You must implement
- Index(es):
Relevant Pages
|