×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Oct 2005
    Posts
    62

    Connector.open returns null

    Hi guys,

    I was trying to get an XML document the site:
    http://nds1.nds.nokia.com/uaprof/N6630r100.xml

    I tried to read it:
    SAXReader reader = new SAXReader();
    HttpConnection conn;
    DataInputStream istream = null;
    conn = (HttpConnection) Connector.open(profile);
    int resp = conn.getResponseCode();
    istream = conn.openDataInputStream();
    Document doc = reader.read(istream);

    Conn returns null when Connector.open(profile) is called. The host URL http://nds1.nds.nokia.com returns page not found, however the complete URL
    http://nds1.nds.nokia.com/uaprof/N6630r100.xml has the xml info of Nokia6630.

    When I tried using the URL class it throws an exception at URL url = new URL(profile); cos the host URL is not available.


    Any ideas?

  2. #2
    Regular Contributor
    Join Date
    Oct 2005
    Posts
    62

    Bug in URL,HttpURLConenction

    Quote Originally Posted by lekkie
    Hi guys,

    I was trying to get an XML document the site:
    http://nds1.nds.nokia.com/uaprof/N6630r100.xml

    I tried to read it:
    SAXReader reader = new SAXReader();
    HttpConnection conn;
    DataInputStream istream = null;
    conn = (HttpConnection) Connector.open(profile);
    int resp = conn.getResponseCode();
    istream = conn.openDataInputStream();
    Document doc = reader.read(istream);

    Conn returns null when Connector.open(profile) is called. The host URL http://nds1.nds.nokia.com returns page not found, however the complete URL
    http://nds1.nds.nokia.com/uaprof/N6630r100.xml has the xml info of Nokia6630.

    When I tried using the URL class it throws an exception at URL url = new URL(profile); cos the host URL is not available.


    Any ideas?

    I noticed if the host is not accessible even if the path is, URL and HttpURLConnection clas will not serve u the file. if this is true, then it is bad.

    Has anybody successfully parse the http://nds1.nds.nokia.com/uaprof/N6630r100.xml UAProf site?

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    370

    Re: Bug in URL,HttpURLConenction

    im not sure what is the problem??
    http://nds1.nds.nokia.com/uaprof/N6630r100.xml
    returns the xml in question and returns you the HTTPConnection when u open it via the connector.open
    http://nds1.nds.nokia.com returns you a 404 since the default page for that folder doesnt exists there and it has nothing to do with the return of http://nds1.nds.nokia.com/uaprof/N6630r100.xml (realy nothing absolutely nothing)
    in regards to URL what is this URL class you are talking about? there is no such class in the api
    just use the following code
    conn = (HttpConnection)Connector.open("http://nds1.nds.nokia.com/uaprof/N6630r100.xml");
    and thats it

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: Bug in URL,HttpURLConenction

    have you successfully opened connections to other pages ?
    if no, may be your internet settings are wrong.

Similar Threads

  1. Please its veru urgent on nokia 3250
    By siva_guduru in forum Mobile Java General
    Replies: 8
    Last Post: 2008-05-01, 10:24
  2. openinputstream() returns null
    By linne345 in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-06-08, 15:16
  3. conn = (MessageConnection)Connector.open(smsc); returns null
    By JWtheCoolOne in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2005-01-11, 09:30
  4. global root overflow(please help)
    By sushant_125 in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2004-05-14, 08:24
  5. Personal
    By JSmith77 in forum PersonalJava
    Replies: 4
    Last Post: 2003-07-30, 12:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •