Click here to Skip to main content
15,918,976 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Conditional Compiler Directives Pin
Scott Dorman4-Oct-07 1:15
professionalScott Dorman4-Oct-07 1:15 
GeneralRe: Conditional Compiler Directives Pin
Vasudevan Deepak Kumar4-Oct-07 6:05
Vasudevan Deepak Kumar4-Oct-07 6:05 
GeneralRe: Conditional Compiler Directives Pin
Scott Dorman4-Oct-07 11:33
professionalScott Dorman4-Oct-07 11:33 
GeneralRe: Conditional Compiler Directives Pin
Luc Pattyn4-Oct-07 12:23
sitebuilderLuc Pattyn4-Oct-07 12:23 
GeneralRe: Conditional Compiler Directives Pin
Scott Dorman5-Oct-07 3:42
professionalScott Dorman5-Oct-07 3:42 
AnswerRe: Conditional Compiler Directives Pin
PIEBALDconsult4-Oct-07 4:24
mvePIEBALDconsult4-Oct-07 4:24 
GeneralRe: Conditional Compiler Directives Pin
Vasudevan Deepak Kumar4-Oct-07 6:06
Vasudevan Deepak Kumar4-Oct-07 6:06 
QuestionWCF not passing its Data Contract :( Pin
twista3-Oct-07 16:29
twista3-Oct-07 16:29 
Hi,

I have a really simple data contract in my WCF service:

<br />
Namespace CTPInfoData<br />
  <DataContract()> _<br />
  Public Class myInfo<br />
<br />
    <DataMember()> _<br />
    Public Name As String<br />
<br />
    <DataMember()> _<br />
    Public Allowed As Boolean<br />
<br />
  End Class<br />
End Namespace<br />
<br />
Namespace CTPInfoCtrlns<br />
  <ServiceContract()> _<br />
  Public Interface IInfoCtrl<br />
    <OperationContract()> _<br />
    Function SetName(ByVal Info As CTPInfoData.myInfo) As Boolean<br />
  End Interface<br />
<br />
  Public Class CTPInfoCtrl<br />
    Implements IInfoCtrl<br />
<br />
    Public Function SetName(ByVal Info As CTPInfoData.myInfo) As Boolean Implements IInfoCtrl.SetName<br />
      If Info.Allowed Then<br />
        If Info.Name = "Bert" Then<br />
          Return True<br />
        Else<br />
          Return False<br />
        End If<br />
      Else<br />
        Return False<br />
      End If<br />
    End Function<br />
  End Class<br />
End Namespace<br />
<br />
Module Module1<br />
<br />
  Sub Main()<br />
    Dim baseuri As New Uri("http://127.0.0.1:8027/")<br />
    Dim host As ServiceHost = New ServiceHost(GetType(CTPInfoCtrlns.CTPInfoCtrl), baseuri)<br />
<br />
    Dim metadata As ServiceMetadataBehavior = host.Description.Behaviors.Find(Of ServiceMetadataBehavior)()<br />
    If metadata Is Nothing Then<br />
      metadata = New ServiceMetadataBehavior<br />
      metadata.HttpGetEnabled = True<br />
      host.Description.Behaviors.Add(metadata)<br />
    Else<br />
      metadata.HttpGetEnabled = True<br />
    End If<br />
<br />
    Dim bind As Binding = New BasicHttpBinding()<br />
    host.AddServiceEndpoint(GetType(CTPInfoCtrlns.IInfoCtrl), bind, "http://127.0.0.1:8027/CTPInfo")<br />
<br />
    host.Open()<br />
    Console.WriteLine("Running service....press any key to terminate")<br />
    Console.ReadKey()<br />
<br />
  End Sub<br />
<br />
End Module<br />


But my test client doesn't seem to pass the data contract through to the service:-

<br />
  Sub Main()<br />
<br />
    Dim bind As New BasicHttpBinding()<br />
    Dim endpoint As New EndpointAddress("http://127.0.0.1:8027/CTPInfo")<br />
    Dim ctrl As New InfoCtrlClient(bind, endpoint)<br />
<br />
    Dim info As New TestWCFService.CTPInfoData.myInfo<br />
    info.Allowed = True<br />
    info.Name = "Bert"<br />
<br />
    ' call our function<br />
    Console.WriteLine("The answer is: " & IIf(ctrl.SetName(info), "YES!!", "No :("))<br />
    Console.ReadKey()<br />
    ctrl.Close()<br />
<br />
  End Sub<br />


My proxy code was generated by svcutil /L:vb http://127.0.0.1:8027/CTPInfo

when I run this simple app, the service only gets a null object (nothing). But If I change the SetName() function to accept the string and boolean independantly, instead of inside a class, it works. So I know my WCF comms is working, just not the Data Contract stuff... Frown | :(

Does anyone have any tips in how to pass data contracts?
Or can point out where I have gone wrong?

Thanks,
Phil.
QuestionTabPage (rant) Pin
PIEBALDconsult3-Oct-07 11:01
mvePIEBALDconsult3-Oct-07 11:01 
AnswerRe: TabPage (rant) Pin
Scott Dorman3-Oct-07 12:16
professionalScott Dorman3-Oct-07 12:16 
GeneralRe: TabPage (rant) Pin
PIEBALDconsult3-Oct-07 15:45
mvePIEBALDconsult3-Oct-07 15:45 
GeneralRe: TabPage (rant) Pin
Scott Dorman3-Oct-07 16:49
professionalScott Dorman3-Oct-07 16:49 
GeneralRe: TabPage (rant) Pin
PIEBALDconsult3-Oct-07 17:54
mvePIEBALDconsult3-Oct-07 17:54 
GeneralRe: TabPage (rant) Pin
Scott Dorman4-Oct-07 1:17
professionalScott Dorman4-Oct-07 1:17 
GeneralRe: TabPage (rant) Pin
PIEBALDconsult4-Oct-07 4:27
mvePIEBALDconsult4-Oct-07 4:27 
GeneralRe: TabPage (rant) Pin
PIEBALDconsult4-Oct-07 5:37
mvePIEBALDconsult4-Oct-07 5:37 
GeneralRe: TabPage (rant) Pin
PIEBALDconsult4-Oct-07 6:53
mvePIEBALDconsult4-Oct-07 6:53 
GeneralRe: TabPage (rant) Pin
Scott Dorman4-Oct-07 11:33
professionalScott Dorman4-Oct-07 11:33 
Questionwhat I need for .net 3.0 Pin
cignox11-Oct-07 23:58
cignox11-Oct-07 23:58 
AnswerRe: what I need for .net 3.0 Pin
Christian Graus2-Oct-07 0:20
protectorChristian Graus2-Oct-07 0:20 
GeneralRe: what I need for .net 3.0 Pin
cignox12-Oct-07 0:27
cignox12-Oct-07 0:27 
GeneralRe: what I need for .net 3.0 Pin
Scott Dorman2-Oct-07 3:15
professionalScott Dorman2-Oct-07 3:15 
GeneralRe: what I need for .net 3.0 Pin
cignox12-Oct-07 4:06
cignox12-Oct-07 4:06 
GeneralRe: what I need for .net 3.0 Pin
Scott Dorman2-Oct-07 16:43
professionalScott Dorman2-Oct-07 16:43 
GeneralRe: what I need for .net 3.0 Pin
Pete O'Hanlon3-Oct-07 9:46
mvePete O'Hanlon3-Oct-07 9:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.