Aliens
Aliens

Reputation: 1004

POST request to WCF Service over 3G

With my Windows Phone (HttpWebRequest object) I am trying to access my WCF REST services deployed on IIS.

I get successfull response when I am making a request over Wi-Fi. When I try to call the same services over 3G I get this response:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
  <card id="FEHLER" title="ERROR">
    <p>
      The requested item could not be loaded <br/>       Wrong MIME-Type
      <do type="prev" label="back">
        <prev/>
      </do>
    </p>
  </card>
</wml>

What do I need to fix to make things work (client or server settings <- server's settings is hard to change since I am using hosting)?

Upvotes: 3

Views: 439

Answers (2)

Aliens
Aliens

Reputation: 1004

It turned out I needed to delete a commented line below.

        HttpWebRequest hwrq = (HttpWebRequest)WebRequest.Create(url);
        //hwrq.Accept = "text/xml";   //this was causing problems (only on 3G)
        hwrq.Method = "POST";

Upvotes: 2

RohanRasane
RohanRasane

Reputation: 60

Just confirm the Content type header of the http request which being sent on wifi and compare it with the 3G request. The request via 3G network may be generating a different content type in the header. You could check this using fiddler.

Upvotes: 0

Related Questions