Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Service Windows Phone 7 (405) Method Not Allowed

I'm trying to consume this http://footballpool.dataaccess.eu/data/info.wso?wsdl web service async on windows phone . My code is this:

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        ServiceReference1.InfoSoapTypeClient client = new ServiceReference1.InfoSoapTypeClient();

        client.AllCardsCompleted += new EventHandler<ServiceReference1.AllCardsCompletedEventArgs>(GetAllPlayers);

        client.AllCardsAsync(true);

    }

    private void GetAllPlayers(object sender, ServiceReference1.AllCardsCompletedEventArgs e) 
    {
        textBlock1.Text = e.Result.ToString();
    }

I 've read many similar anwers for similar questions but none for windows phone. The error that I am getting back is: "The remote server returned an unexpected response: (405) Method Not Allowed."

Web service looks to consuming fine outside the project. When you tap on link you will see nothing but if you retype the link you will get the wsdl document.

like image 327
Apostolos Avatar asked Oct 31 '22 21:10

Apostolos


1 Answers

"(405) Method Not Allowed" means your client is using a HTTP method that server does not expect (for example you're trying to do GET whereas server expects a POST). T

Try capturing http traffic with fiddler or wireshark and inspect the HTTP request that the app is sending and server's response. Compare them to a proper request/response pair that you get when consuming this service otuside of WP7 (you can use WCFTestClient for this).

Another way of attacking this would be to compare the proxy (client) classes that are generated when adding WebService reference in your WP7 app and in a standard Console App. Maybe the proxy on WP7 has some incorrect method signatures?

One more thing: when testing this service with WCFTestClient, I got an error:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

So make sure the MaxReceivedMessageSize is set properly.

like image 70
qbik Avatar answered Nov 12 '22 19:11

qbik