Options

Problem WS NAV Silverlight

AndreLucasAndreLucas Member Posts: 4
edited 2011-06-03 in NAV Three Tier
Hi,

I have a problem using an WS, that returns customers using xmlport, on Silverlight. The WS works well when im using other platforms.

Here it is the code that works directly with the webservice:
 public partial class MainPage : UserControl
    {
        ExportCustomers_PortClient expCustomers = new ExportCustomers_PortClient("ExportCustomers_Port", new EndpointAddress("http://localhost:7047/DynamicsNAV/WS/Codeunit/ExportCustomers"));

        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            
            GetCustomer gtCust = new GetCustomer();
            expCustomers.ExportCustomerAsync(gtCust);
            foreach (Customer c in gtCust.Customer)
            {
                textBox1.Text = c.No;
            }
            
        }
    }
}
the problem is that "gtCust" comes null after "expCustomers.ExportCustomerAsync(gtCust);" and i cant find the problem with that, he calls the webservice well but looks like he doenst run the main method for returning the list of customers.

I've done the tutorial from freddyk blog to help me with this.

Best regards,

André Lucas

Comments

  • Options
    kinekine Member Posts: 12,562
    expCustomers.ExportCustomerAsync means that the process is runned asynchronously! It mean, after it finished, it trigger appropriate even and you need to react to this event. It is same like Form.RUN instead FORM.RUNMODAL in NAV. You need to use synchronous version of this...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.