Connecting Tech Pros Worldwide Forums | Help | Site Map

System.Guid

Michael Primeaux
Guest
 
Posts: n/a
#1: Oct 20 '06
I have a simple .NET 2.0 web service created with VS.NET 2005 with a single
web method with the following signature:

[WebMethod]
void HelloWorld(Guid parameter1);

When calling this method I receive the following error:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)If I change the type of parameter1 to a simple type such as
string or int then the method works as expected. My operating system is
Windows 2003 Server R2 (Enterprise Edition) with all the latest patches.

I see several other people have run into this error. Does anyone have an
idea how to correct this?

Thanks,
Michael



John Saunders
Guest
 
Posts: n/a
#2: Oct 21 '06

re: System.Guid


"Michael Primeaux" <mjprimeaux@msn.comwrote in message
news:%23oldr4$8GHA.1172@TK2MSFTNGP03.phx.gbl...
Quote:
>I have a simple .NET 2.0 web service created with VS.NET 2005 with a single
>web method with the following signature:
>
[WebMethod]
void HelloWorld(Guid parameter1);
>
When calling this method I receive the following error:
System.IndexOutOfRangeException: Index was outside the bounds of the
array.
at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)If I change the type of parameter1 to a simple type such
as string or int then the method works as expected. My operating system is
Windows 2003 Server R2 (Enterprise Edition) with all the latest patches.
>
I see several other people have run into this error. Does anyone have an
idea how to correct this?
First of all, I'd suggest that System.Guid is a platform-specific type, so
why do you want to use it in a Web Service? Perhaps you should make your
parameter be of type string, and then parse out the Guid from the string.

John


Michael Primeaux
Guest
 
Posts: n/a
#3: Nov 2 '06

re: System.Guid


Hi John,

I do understand the Guid parameter is a platform-specific type. That said,
the generated WSDL defines the type as a string but with format constraints
(a regular expression in the form
"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}".
I have both JAVA and PHP consumers calling several services with Guid
parameters without issue; again, from their perspective it's a string with
format contraints.

However, this does not explain the below exception. Any help specific as to
why the exception occurs is appreciated.

Kindest regards,
Michael

"John Saunders" <john.saunders at trizetto.comwrote in message
news:uKsqdjT9GHA.1188@TK2MSFTNGP05.phx.gbl...
Quote:
"Michael Primeaux" <mjprimeaux@msn.comwrote in message
news:%23oldr4$8GHA.1172@TK2MSFTNGP03.phx.gbl...
Quote:
>>I have a simple .NET 2.0 web service created with VS.NET 2005 with a
>>single web method with the following signature:
>>
>[WebMethod]
>void HelloWorld(Guid parameter1);
>>
>When calling this method I receive the following error:
>System.IndexOutOfRangeException: Index was outside the bounds of the
>array.
> at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
> at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
> at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
>HttpContext context, HttpRequest request, HttpResponse response)
> at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type
>type, HttpContext context, HttpRequest request, HttpResponse response,
>Boolean& abortProcessing)If I change the type of parameter1 to a simple
>type such as string or int then the method works as expected. My
>operating system is Windows 2003 Server R2 (Enterprise Edition) with all
>the latest patches.
>>
>I see several other people have run into this error. Does anyone have an
>idea how to correct this?
>
First of all, I'd suggest that System.Guid is a platform-specific type, so
why do you want to use it in a Web Service? Perhaps you should make your
parameter be of type string, and then parse out the Guid from the string.
>
John
>
>

RYoung
Guest
 
Posts: n/a
#4: Nov 5 '06

re: System.Guid


You could define GUID as a schema type and use that versus System.Guid and
relying on how the platform will translate it:

The following was snipped off the web:

<xsd:simpleType name="GUID">

<xsd:annotation>

<xsd:documentation xml:lang="en">

The representation of a GUID, generally the id of an element.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base="xsd:string">

<xsd:pattern

value="\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}"/>

</xsd:restriction>

</xsd:simpleType>

I believe I've seen that same type definition for one of Microsoft's
products, SharePoint or something maybe.

Ron

"Michael Primeaux" <mjprimeaux@msn.comwrote in message
news:OIH6fJp$GHA.3560@TK2MSFTNGP04.phx.gbl...
Quote:
Hi John,
>
I do understand the Guid parameter is a platform-specific type. That said,
the generated WSDL defines the type as a string but with format
constraints (a regular expression in the form
"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}".
I have both JAVA and PHP consumers calling several services with Guid
parameters without issue; again, from their perspective it's a string with
format contraints.
>
However, this does not explain the below exception. Any help specific as
to why the exception occurs is appreciated.
>
Kindest regards,
Michael
>
"John Saunders" <john.saunders at trizetto.comwrote in message
news:uKsqdjT9GHA.1188@TK2MSFTNGP05.phx.gbl...
Quote:
>"Michael Primeaux" <mjprimeaux@msn.comwrote in message
>news:%23oldr4$8GHA.1172@TK2MSFTNGP03.phx.gbl...
Quote:
>>>I have a simple .NET 2.0 web service created with VS.NET 2005 with a
>>>single web method with the following signature:
>>>
>>[WebMethod]
>>void HelloWorld(Guid parameter1);
>>>
>>When calling this method I receive the following error:
>>System.IndexOutOfRangeException: Index was outside the bounds of the
>>array.
>> at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
>> at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
>> at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
>>HttpContext context, HttpRequest request, HttpResponse response)
>> at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type
>>type, HttpContext context, HttpRequest request, HttpResponse response,
>>Boolean& abortProcessing)If I change the type of parameter1 to a simple
>>type such as string or int then the method works as expected. My
>>operating system is Windows 2003 Server R2 (Enterprise Edition) with all
>>the latest patches.
>>>
>>I see several other people have run into this error. Does anyone have an
>>idea how to correct this?
>>
>First of all, I'd suggest that System.Guid is a platform-specific type,
>so why do you want to use it in a Web Service? Perhaps you should make
>your parameter be of type string, and then parse out the Guid from the
>string.
>>
>John
>>
>>
>
>

Michael Primeaux
Guest
 
Posts: n/a
#5: Dec 21 '06

re: System.Guid


Hi Ron,

I appreciate your time. As indicated in my previous post that is precisely
what I do. The issue is that I receive the following error when doing so:

[WebMethod]
void HelloWorld(Guid parameter1);

When calling this method I receive the following error:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)If I change the type of parameter1 to a simple type such as
string or int then the method works as expected. My operating system is
Windows 2003 Server R2 (Enterprise Edition) with all the latest patches.


"RYoung" <rcyoungatinkspotdev.comwrote in message
news:ufmLI2SAHHA.3380@TK2MSFTNGP04.phx.gbl...
Quote:
You could define GUID as a schema type and use that versus System.Guid and
relying on how the platform will translate it:
>
The following was snipped off the web:
>
<xsd:simpleType name="GUID">
>
<xsd:annotation>
>
<xsd:documentation xml:lang="en">
>
The representation of a GUID, generally the id of an element.
>
</xsd:documentation>
>
</xsd:annotation>
>
<xsd:restriction base="xsd:string">
>
<xsd:pattern
>
value="\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}"/>
>
</xsd:restriction>
>
</xsd:simpleType>
>
I believe I've seen that same type definition for one of Microsoft's
products, SharePoint or something maybe.
>
Ron
>
"Michael Primeaux" <mjprimeaux@msn.comwrote in message
news:OIH6fJp$GHA.3560@TK2MSFTNGP04.phx.gbl...
Quote:
>Hi John,
>>
>I do understand the Guid parameter is a platform-specific type. That
>said, the generated WSDL defines the type as a string but with format
>constraints (a regular expression in the form
>"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}".
>I have both JAVA and PHP consumers calling several services with Guid
>parameters without issue; again, from their perspective it's a string
>with format contraints.
>>
>However, this does not explain the below exception. Any help specific as
>to why the exception occurs is appreciated.
>>
>Kindest regards,
>Michael
>>
>"John Saunders" <john.saunders at trizetto.comwrote in message
>news:uKsqdjT9GHA.1188@TK2MSFTNGP05.phx.gbl...
Quote:
>>"Michael Primeaux" <mjprimeaux@msn.comwrote in message
>>news:%23oldr4$8GHA.1172@TK2MSFTNGP03.phx.gbl.. .
>>>>I have a simple .NET 2.0 web service created with VS.NET 2005 with a
>>>>single web method with the following signature:
>>>>
>>>[WebMethod]
>>>void HelloWorld(Guid parameter1);
>>>>
>>>When calling this method I receive the following error:
>>>System.IndexOutOfRangeException: Index was outside the bounds of the
>>>array.
>>> at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
>>> at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
>>> at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
>>>HttpContext context, HttpRequest request, HttpResponse response)
>>> at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type
>>>type, HttpContext context, HttpRequest request, HttpResponse response,
>>>Boolean& abortProcessing)If I change the type of parameter1 to a simple
>>>type such as string or int then the method works as expected. My
>>>operating system is Windows 2003 Server R2 (Enterprise Edition) with
>>>all the latest patches.
>>>>
>>>I see several other people have run into this error. Does anyone have
>>>an idea how to correct this?
>>>
>>First of all, I'd suggest that System.Guid is a platform-specific type,
>>so why do you want to use it in a Web Service? Perhaps you should make
>>your parameter be of type string, and then parse out the Guid from the
>>string.
>>>
>>John
>>>
>>>
>>
>>
>
>

RYoung
Guest
 
Posts: n/a
#6: Dec 21 '06

re: System.Guid


Sorry about that, didn't realize System.Guid was serializable.

I can't reproduce the error here. Just a simple web service with the same
signature as what you've posted, and a console client calling the service
and passing a Guid.NewGuid() to it. Tried Guid.Empty as well.

Is it safe to say that since you aren't getting a SoapException, that the
exception is occuring on the client side? I know you mention changing the
signature from Guid to String and everything works, but I think there's an
issue serializing the value of what's supposed to be a guid on the client.

How about if you change the signature to string, have the service log the
value it receives and see if that value is a valid Guid format?

Ron

"Michael Primeaux" <mjprimeaux@msn.comwrote in message
news:OPG8JMQJHHA.4384@TK2MSFTNGP03.phx.gbl...
Quote:
Hi Ron,
>
I appreciate your time. As indicated in my previous post that is precisely
what I do. The issue is that I receive the following error when doing so:
>
[WebMethod]
void HelloWorld(Guid parameter1);
>
When calling this method I receive the following error:
System.IndexOutOfRangeException: Index was outside the bounds of the
array.
at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)If I change the type of parameter1 to a simple type such
as
string or int then the method works as expected. My operating system is
Windows 2003 Server R2 (Enterprise Edition) with all the latest patches.
>
>
"RYoung" <rcyoungatinkspotdev.comwrote in message
news:ufmLI2SAHHA.3380@TK2MSFTNGP04.phx.gbl...
Quote:
>You could define GUID as a schema type and use that versus System.Guid
>and relying on how the platform will translate it:
>>
>The following was snipped off the web:
>>
><xsd:simpleType name="GUID">
>>
> <xsd:annotation>
>>
> <xsd:documentation xml:lang="en">
>>
> The representation of a GUID, generally the id of an element.
>>
> </xsd:documentation>
>>
> </xsd:annotation>
>>
> <xsd:restriction base="xsd:string">
>>
> <xsd:pattern
>>
>value="\{[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\}"/>
>>
> </xsd:restriction>
>>
></xsd:simpleType>
>>
>I believe I've seen that same type definition for one of Microsoft's
>products, SharePoint or something maybe.
>>
>Ron
>>
>"Michael Primeaux" <mjprimeaux@msn.comwrote in message
>news:OIH6fJp$GHA.3560@TK2MSFTNGP04.phx.gbl...
Quote:
>>Hi John,
>>>
>>I do understand the Guid parameter is a platform-specific type. That
>>said, the generated WSDL defines the type as a string but with format
>>constraints (a regular expression in the form
>>"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}".
>>I have both JAVA and PHP consumers calling several services with Guid
>>parameters without issue; again, from their perspective it's a string
>>with format contraints.
>>>
>>However, this does not explain the below exception. Any help specific as
>>to why the exception occurs is appreciated.
>>>
>>Kindest regards,
>>Michael
>>>
>>"John Saunders" <john.saunders at trizetto.comwrote in message
>>news:uKsqdjT9GHA.1188@TK2MSFTNGP05.phx.gbl...
>>>"Michael Primeaux" <mjprimeaux@msn.comwrote in message
>>>news:%23oldr4$8GHA.1172@TK2MSFTNGP03.phx.gbl. ..
>>>>>I have a simple .NET 2.0 web service created with VS.NET 2005 with a
>>>>>single web method with the following signature:
>>>>>
>>>>[WebMethod]
>>>>void HelloWorld(Guid parameter1);
>>>>>
>>>>When calling this method I receive the following error:
>>>>System.IndexOutOfRangeException: Index was outside the bounds of the
>>>>array.
>>>> at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
>>>> at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
>>>> at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type
>>>>type, HttpContext context, HttpRequest request, HttpResponse response)
>>>> at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type
>>>>type, HttpContext context, HttpRequest request, HttpResponse response,
>>>>Boolean& abortProcessing)If I change the type of parameter1 to a
>>>>simple type such as string or int then the method works as expected.
>>>>My operating system is Windows 2003 Server R2 (Enterprise Edition)
>>>>with all the latest patches.
>>>>>
>>>>I see several other people have run into this error. Does anyone have
>>>>an idea how to correct this?
>>>>
>>>First of all, I'd suggest that System.Guid is a platform-specific type,
>>>so why do you want to use it in a Web Service? Perhaps you should make
>>>your parameter be of type string, and then parse out the Guid from the
>>>string.
>>>>
>>>John
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Closed Thread