Android development: Failed to access to the SD server

Discussion about Schedules Direct grabber code and data formats.
Post Reply
dpdcandroid
Posts: 2
Joined: Mon Sep 26, 2011 11:21 am

Android development: Failed to access to the SD server

Post by dpdcandroid »

I use java to access to the server to download guide data, It returns unauthorized code 401. The same code but I am able access and download guide data on linux machine, but failed to access on android. Can someone telling me why it fails on android?
The code is:

Code: Select all

Authenticator.setDefault(new Authenticator() {
     protected PasswordAuthentication getPasswordAuthentication() {
       return new PasswordAuthentication(username, password.toCharArray());
     
   });
 }

c= (HttpURLConnection) new URL("http://webservices.schedulesdirect.tmsdatadirect.com/schedulesdirect/tvlistings/xtvdService").openConnection();
c.setRequestProperty("Accept-Encoding", "gzip");
c.setRequestProperty("SOAPAction", "urn:TMSWebServices:xtvdWebService#download");
c.setRequestMethod("POST");
            
c.setDoInput(true);
c.setDoOutput(true);
c.setUseCaches(false);
 
PrintWriter pw = new PrintWriter(conn.getOutputStream());
			
String env = buildDownloadSOAPEnvelope(start, end);
			
pw.println(env);
pw.flush();
pw.close();  
		
BufferedReader br = null;
String enc = conn.getHeaderField("Content-encoding"); //Unauthorized code return here


==HERE IS SOAP ENVELOP===
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'>
<SOAP-ENV:Body>
<tms:download xmlns:tms='urn:TMSWebServices'>
<startTime xsi:type='tms:dateTime'>2011-10-07T15:00:00Z</startTime>
<endTime xsi:type='tms:dateTime'>2011-10-07T17:00:00Z</endTime>
</tms:download>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
==END SOAP ENVELOP===


==HTTP header after access denied====
-------------------------------
HTTP Response: 401
HTTP getHeaderField: Apache-Coyote/1.1
null:HTTP/1.1 401 Unauthorized
Connection:close
Content-Length:954
Content-Type:text/html;charset=utf-8
Date:Thu, 06 Oct 2011 20:52:20 GMT
Server:Apache-Coyote/1.1
WWW-Authenticate:Digest realm="TMSWebServiceRealm", qop="auth", nonce="f5d2ec14e8dde24aa9ed5235f7256d47", opaque="ab02c9a0c3e2a54280ec4f13cc7b1734"

Thanks for your help
Biet

dpdcandroid
Posts: 2
Joined: Mon Sep 26, 2011 11:21 am

Re: Android development: Failed to access to the SD server

Post by dpdcandroid »

Does schedulesdirect.com still support their members? I paid to be a member so I can use the guide data to develop an android application. I posted my question in last several weeks and there is no response.
I use wireshark to monitor the packet out. It seems fine just like the packet out from linux machine. Can someone suggest method to debug this problem? Is their a way that I can read log from the server to see why it denied my access request on android.

Thanks
Last edited by dpdcandroid on Tue Oct 18, 2011 7:13 am, edited 2 times in total.

rmeden
SD Board Member
Posts: 1527
Joined: Tue Aug 14, 2007 2:31 pm
Location: Cedar Hill, TX
Contact:

Re: Android development: Failed to access to the SD server

Post by rmeden »

Of course we support our members. I didn't respond because I don't do java so don't know what to tell you (other than make sure you're using BASIC auth which I did post)

email the http request or the wireshark capture to admin@sd and I'll take a look. (don't attach or post it here, since it would have a password!)

The SOAP content on your request may match a working system, but I bet the HTTP headers are different . You post is only the SOAP payload, not the HTTP request headers.

Keep in mind that most systems will send a request w/o authentication, get back a auth required message, and then resend with authentication.

Robert

Post Reply