473,226 Members | 1,729 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,226 software developers and data experts.

Problems marshaling DateTime parameters

One of my webservices has a parameter of type System.DateTime. It compiles
ok but at runtime I get this exception:

An unhandled exception of type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: Server was unable to process request. --> Invalid
cast from System.DateTime to System.Byte[].

Can anyone tell me how to deal with this issue?

Should I box the parameters into an object derived from MarshalByValue (or
whatever it's called) ?
Nov 23 '05 #1
3 2944
This is where it's unhappy:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://localhost/empire/LogUsage",
RequestNamespace="http://localhost/empire",
ResponseNamespace="http://localhost/empire",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
public void LogUsage(System.Guid SiteID, System.DateTime Timestamp, int
PeakConcurrentSessions) {
object[] oa;
oa = new object[] {
SiteID,
Timestamp,
PeakConcurrentSessions};
this.Invoke("LogUsage",oa);
}

I broke this code (generated by importing a web reference) into three
statements so I could see which part gave it trouble.

oa = new object[] {
SiteID,
Timestamp,
PeakConcurrentSessions};

is what it doesn't like. This statement produces the exception "Invalid cast
from System.DateTime to System.Byte[]."

Any thoughts, people?
Nov 23 '05 #2
AC
Hello,

Have not you try to create a service with only one this method? Does it
work? And what is "this.Invoke("LogUsage",oa);"? May be a problem in it.

"Peter Wone" <pe****@wamoz.com> сообщил/сообщила в новостях следующее:
news:OP**************@TK2MSFTNGP14.phx.gbl...
This is where it's unhappy:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://localhost
/empire/LogUsage", RequestNamespace="http://localhost/empire",
ResponseNamespace="http://localhost/empire",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
public void LogUsage(System.Guid SiteID, System.DateTime Timestamp, int
PeakConcurrentSessions) {
object[] oa;
oa = new object[] {
SiteID,
Timestamp,
PeakConcurrentSessions};
this.Invoke("LogUsage",oa);
}

I broke this code (generated by importing a web reference) into three
statements so I could see which part gave it trouble.

oa = new object[] {
SiteID,
Timestamp,
PeakConcurrentSessions};

is what it doesn't like. This statement produces the exception "Invalid cast from System.DateTime to System.Byte[]."

Any thoughts, people?

Nov 23 '05 #3
Curious. Why are you using "Invoke" anyway? I suspect the method signature
on that method expects a byte[] in the second parm - not a DataTime.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Peter Wone" <pe****@wamoz.com> wrote in message
news:OP**************@TK2MSFTNGP14.phx.gbl...
This is where it's unhappy:

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://localhost
/empire/LogUsage", RequestNamespace="http://localhost/empire",
ResponseNamespace="http://localhost/empire",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
public void LogUsage(System.Guid SiteID, System.DateTime Timestamp, int
PeakConcurrentSessions) {
object[] oa;
oa = new object[] {
SiteID,
Timestamp,
PeakConcurrentSessions};
this.Invoke("LogUsage",oa);
}

I broke this code (generated by importing a web reference) into three
statements so I could see which part gave it trouble.

oa = new object[] {
SiteID,
Timestamp,
PeakConcurrentSessions};

is what it doesn't like. This statement produces the exception "Invalid cast from System.DateTime to System.Byte[]."

Any thoughts, people?


Nov 23 '05 #4

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

Similar topics

3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
4
by: John J. Hughes II | last post by:
I have several functions that save the time when they did certain tasks to an SQL table. This was working fine as far as I could tell but I now have systems that are updating thousands of records...
2
by: Don Kim | last post by:
Hi, I'm trying to port the IGo Portal on the gotdotnet site from vb.net to c#. I'm having problems with the following: public DataSet GetAnnouncements(int moduleId) { // Create Instance...
0
by: Tim::.. | last post by:
Can someone please help! I'm trying to write an insert statement for a complex datagrid! The database consists of the following data structure! ..tblContent PageID PK ModDate Description...
1
by: Bill Medland | last post by:
I am trying to do some P/Invoke custom marshaling and am looking for a little help on custom marshaling a value type. I am working based on Kate Gregory's "Arranging Custom Marshaling With...
6
by: rn5a | last post by:
I am inserting records in a MS-Access database table. The data type of one of the columns named *OrderDate* in the DB table is Date/Time. This is the SQL query I am using to insert the records in...
24
by: rn5a | last post by:
The date in my local machine is set to the dd/MM/yyyy format. When I insert a date in a MS-Access DB table, it gets populated in the above format. For e.g. if the date is, say, 8th March 2007, it...
0
by: SAL | last post by:
I'm curious if anyone else is having this problem. If I let the Dataset designer generate update commands for me, I don't seem to be able to get them to work without an exception getting thrown,...
1
by: =?ISO-8859-1?Q?Jo=E3o_Maia?= | last post by:
Hello there, I'm using Cache VaryByParam on a page and I'm not getting the behaviour I expected. Here's what happens: - I have page a.aspx declared with Cache VaryByParam="name" - Page a.aspx...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
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 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.