Click here to Skip to main content
15,172,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
First of all to note that I am calling link?wsdl web service. I am using Visual Studio 2010 and I have created Windows Phone application.

I added a New service reference to the WebService, and it generated all of the classes in a proper way. Next what I did is I wrote the bellow code in order to call web service and get the response.

Just to note two things:

1. SoapUI returns correct value.
2. The same code works on Console Application in Visual Studio 2010 and returns the correct string.


The following is code:

C#
namespace testApp
{
public partial class MainPage : PhoneApplicationPage
{


    public MainPage()
    {
        InitializeComponent();

        WebService.ServiceClient ws = new WebService.ServiceClient();
        ws.FirstMethodCompleted += new EventHandler<FirstMethodCompletedEventArgs>(ws_getReklamaLinkCompleted);
        ws.getReklamaLinkAsync(param1, param2);


    void ws_FirstMethodCompleted(object sender, WebService.FirstMethodCompletedEventArgs e)
    {

        System.Diagnostics.Debug.WriteLine("Error is: " + e.Error);

    }
}
}

Well the problem is that this code in Windows Phone Application returns following exception:

XML
Unmarshalling Error: unexpected element (uri:"http://testwebservice.portal.com/",    local:"param1"). Expected elements are <{}param1>,<{}param1>


I am struggling with this well over 2 days now. Can anyone tell me why the same code works on Console application and not on Windows Phone application and what could be the solution for it?

What other ways I have to consume the web service?
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900