Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. IClientService returns zero objects, even when fiddler2 tells me the respons contains the expected objects

IClientService returns zero objects, even when fiddler2 tells me the respons contains the expected objects

Scheduled Pinned Locked Moved WCF and WF
wcfcsharpdebuggingxmlhelp
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    annathor
    wrote on last edited by
    #1

    I have a weird problem on my hands, we are using IClientService / ChanneFactory to communicate with the WCF service, the method looks like this

    public List<IOrder> GetOrders(string userId, string password)
    {
    List<IOrder> orders = null;
    try
    {
    IClientService wcfClient1 = _clientService.CreateChannel();
    orders = wcfClient1.GetOrders(userId, password);
    ((IClientChannel)wcfClient1).Close();
    ServerConnection = true;
    }
    catch (Exception ex)
    {
    ServerConnection = false;
    SendError("GetOrders() " + ex);
    }
    return orders;
    }

    and Fiddler2 Web debugger tells me that the request looks like this:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
    <GetOrders xmlns="http://tempuri.org/">
    <userId>DemoUser</userId>
    <password>DemoPass</password>
    </GetOrders>
    </s:Body>
    </s:Envelope>

    and the response like this:

    				Di,Fe,Fr,Hi,Hy,Næ,Næ3,NæS,Op,Pr,RE,Sl,TG,VP
    				20
    				Restavfall
    				20
    				2011-07-20T00:00:00
    				101610
    				0
    				10
    				10 - Orkanger Test
    

    so the response clearly contains the expected object, the problem is that, in the client side method GetOrders, after the line "orders = wcfClient1.GetOrders(userId, password)", the list "orders" becomes a list of 0 objects and not, as expected, a list with the one object returned by the service. anyone that have any idea of whats going on?

    M M 2 Replies Last reply
    0
    • A annathor

      I have a weird problem on my hands, we are using IClientService / ChanneFactory to communicate with the WCF service, the method looks like this

      public List<IOrder> GetOrders(string userId, string password)
      {
      List<IOrder> orders = null;
      try
      {
      IClientService wcfClient1 = _clientService.CreateChannel();
      orders = wcfClient1.GetOrders(userId, password);
      ((IClientChannel)wcfClient1).Close();
      ServerConnection = true;
      }
      catch (Exception ex)
      {
      ServerConnection = false;
      SendError("GetOrders() " + ex);
      }
      return orders;
      }

      and Fiddler2 Web debugger tells me that the request looks like this:

      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
      <s:Body>
      <GetOrders xmlns="http://tempuri.org/">
      <userId>DemoUser</userId>
      <password>DemoPass</password>
      </GetOrders>
      </s:Body>
      </s:Envelope>

      and the response like this:

      				Di,Fe,Fr,Hi,Hy,Næ,Næ3,NæS,Op,Pr,RE,Sl,TG,VP
      				20
      				Restavfall
      				20
      				2011-07-20T00:00:00
      				101610
      				0
      				10
      				10 - Orkanger Test
      

      so the response clearly contains the expected object, the problem is that, in the client side method GetOrders, after the line "orders = wcfClient1.GetOrders(userId, password)", the list "orders" becomes a list of 0 objects and not, as expected, a list with the one object returned by the service. anyone that have any idea of whats going on?

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Just curious....since you already have a proxy class, what does using that class return? e.g. _clientService.GetOrders(userId, password);

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      A 1 Reply Last reply
      0
      • M Mark Salsbery

        Just curious....since you already have a proxy class, what does using that class return? e.g. _clientService.GetOrders(userId, password);

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        A Offline
        A Offline
        annathor
        wrote on last edited by
        #3

        _clientService is defined as

        private ChannelFactory<IClientService> _clientService;

        so it doesn't have a accessable GetOrders method. the _clientService is constructed like this:

        BasicHttpBinding clientBinding = new BasicHttpBinding {MaxReceivedMessageSize = int.MaxValue};
        EndpointAddress clientEndpoint = new EndpointAddress(serviceUrl);
        _clientService = new ChannelFactory<IClientService>(clientBinding, clientEndpoint);

        M 1 Reply Last reply
        0
        • A annathor

          _clientService is defined as

          private ChannelFactory<IClientService> _clientService;

          so it doesn't have a accessable GetOrders method. the _clientService is constructed like this:

          BasicHttpBinding clientBinding = new BasicHttpBinding {MaxReceivedMessageSize = int.MaxValue};
          EndpointAddress clientEndpoint = new EndpointAddress(serviceUrl);
          _clientService = new ChannelFactory<IClientService>(clientBinding, clientEndpoint);

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Does the endpoint configuration match on both ends?

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • A annathor

            I have a weird problem on my hands, we are using IClientService / ChanneFactory to communicate with the WCF service, the method looks like this

            public List<IOrder> GetOrders(string userId, string password)
            {
            List<IOrder> orders = null;
            try
            {
            IClientService wcfClient1 = _clientService.CreateChannel();
            orders = wcfClient1.GetOrders(userId, password);
            ((IClientChannel)wcfClient1).Close();
            ServerConnection = true;
            }
            catch (Exception ex)
            {
            ServerConnection = false;
            SendError("GetOrders() " + ex);
            }
            return orders;
            }

            and Fiddler2 Web debugger tells me that the request looks like this:

            <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
            <s:Body>
            <GetOrders xmlns="http://tempuri.org/">
            <userId>DemoUser</userId>
            <password>DemoPass</password>
            </GetOrders>
            </s:Body>
            </s:Envelope>

            and the response like this:

            				Di,Fe,Fr,Hi,Hy,Næ,Næ3,NæS,Op,Pr,RE,Sl,TG,VP
            				20
            				Restavfall
            				20
            				2011-07-20T00:00:00
            				101610
            				0
            				10
            				10 - Orkanger Test
            

            so the response clearly contains the expected object, the problem is that, in the client side method GetOrders, after the line "orders = wcfClient1.GetOrders(userId, password)", the list "orders" becomes a list of 0 objects and not, as expected, a list with the one object returned by the service. anyone that have any idea of whats going on?

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Ahm - aren't WCF calls asynchronous therefore this would not return a value.

            wcfClient1.GetOrders(userId, password)

            You need to set up a callback. This is a typical call

            	public void GetRecord(int iID)//---------------------------------------Get record
            	{
            		svcClient.PERIODGetRecordCompleted += new System.EventHandler(GetRecordCompleted);
            		svcClient.PERIODGetRecordAsync(iID);
            	}
            

            private void GetRecordCompleted(object sender, PERIODGetRecordCompletedEventArgs e)//the call back that receives the data

            Never underestimate the power of human stupidity RAH

            A 1 Reply Last reply
            0
            • M Mycroft Holmes

              Ahm - aren't WCF calls asynchronous therefore this would not return a value.

              wcfClient1.GetOrders(userId, password)

              You need to set up a callback. This is a typical call

              	public void GetRecord(int iID)//---------------------------------------Get record
              	{
              		svcClient.PERIODGetRecordCompleted += new System.EventHandler(GetRecordCompleted);
              		svcClient.PERIODGetRecordAsync(iID);
              	}
              

              private void GetRecordCompleted(object sender, PERIODGetRecordCompletedEventArgs e)//the call back that receives the data

              Never underestimate the power of human stupidity RAH

              A Offline
              A Offline
              annathor
              wrote on last edited by
              #6

              the WCF calls must be asynchronous in silverlight, not so in WPF where they can be both synch or asynch, anyhow have resolved the issue, it was a case of service missing the assembly with the interface definitions.

              M 1 Reply Last reply
              0
              • A annathor

                the WCF calls must be asynchronous in silverlight, not so in WPF where they can be both synch or asynch, anyhow have resolved the issue, it was a case of service missing the assembly with the interface definitions.

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                annathor wrote:

                not so in WPF

                Ahhh I'm only using Silverlight and therefore the skewed view on things. I thought it was too dammed obvious, I'm just glad I didn't go all sarcastic on you :) .

                Never underestimate the power of human stupidity RAH

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups