R
Ronald S. Cook
In my service project I have this function:
Public Function SelectPenTypeTest(Optional ByVal PenTypeID As String =
Nothing) As String Implements IPen.SelectPenTypeTest
If PenTypeID = String.Empty Then
Return "You didn't pass anything"
Else
Return "You passed: " + PenTypeID
End If
End Function
I then generate the proxy class and include it in my client project.
However, in the client I am required to put either a string value or
Nothing.
Dim _Pen As New PenClient()
Dim TempString As String = _Pen.SelectPenTypeTest(Nothing)
I would much rather be able to just put the following when I don't want to
pass a value:
Dim TempString As String = _Pen.SelectPenTypeTest()
What am I doing wrong? Is it because I have Option Strict and Option
Explicit set to On? Something else?
I looked inside the generated proxy class for Pen and part of it looks like
this:
'CODEGEN: Parameter 'SelectPenResult' requires additional schema information
that cannot be captured using the parameter mode. The specific attribute is
'System.Xml.Serialization.XmlElementAttribute'.
<System.ServiceModel.OperationContractAttribute(Action:="http://tempuri.org/IPen/SelectPen",
ReplyAction:="http://tempuri.org/IPen/SelectPenResponse"), _
System.ServiceModel.XmlSerializerFormatAttribute()> _
Function SelectPen(ByVal request As SelectPenRequest) As SelectPenResponse
I don't know if it means anything that there's no "Optional" in front of
ByVal or what.
Thanks for any help,
Ron
Public Function SelectPenTypeTest(Optional ByVal PenTypeID As String =
Nothing) As String Implements IPen.SelectPenTypeTest
If PenTypeID = String.Empty Then
Return "You didn't pass anything"
Else
Return "You passed: " + PenTypeID
End If
End Function
I then generate the proxy class and include it in my client project.
However, in the client I am required to put either a string value or
Nothing.
Dim _Pen As New PenClient()
Dim TempString As String = _Pen.SelectPenTypeTest(Nothing)
I would much rather be able to just put the following when I don't want to
pass a value:
Dim TempString As String = _Pen.SelectPenTypeTest()
What am I doing wrong? Is it because I have Option Strict and Option
Explicit set to On? Something else?
I looked inside the generated proxy class for Pen and part of it looks like
this:
'CODEGEN: Parameter 'SelectPenResult' requires additional schema information
that cannot be captured using the parameter mode. The specific attribute is
'System.Xml.Serialization.XmlElementAttribute'.
<System.ServiceModel.OperationContractAttribute(Action:="http://tempuri.org/IPen/SelectPen",
ReplyAction:="http://tempuri.org/IPen/SelectPenResponse"), _
System.ServiceModel.XmlSerializerFormatAttribute()> _
Function SelectPen(ByVal request As SelectPenRequest) As SelectPenResponse
I don't know if it means anything that there's no "Optional" in front of
ByVal or what.
Thanks for any help,
Ron