Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7407985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:49:39+00:00 2026-05-29T05:49:39+00:00

I’m working with android xml rpc to mount a server. For that I’m using

  • 0

I’m working with android xml rpc to mount a server. For that I’m using and intentService. The only problem is that when the server class is launched, my onHandleIntent which contains the server is never called.

I’ve made some research and I found someone who had the same problem, he managed solving it by using super class but I’m new in programming and didn’t manage to do what he did ==> link

Here is my code:

package tfe.rma.ciss.be;

import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlrpc.android.MethodCall;
import org.xmlrpc.android.XMLRPCServer;

import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import java.io.IOException;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

public class Server extends IntentService {
   public String myData="";
   public String streamTitle = "",path="";

   public void onCreate() {

        Log.d("Server", ">>>onCreate()");

    }

    public Server() {
        super("Server");


    }
    public void onStart (Intent intent, int startId) {
        Log.d("Server", ">>>Started()");    }
    @Override
    protected void onHandleIntent(Intent intent) {
        Log.d("Server", ">>>handlingIntent()");
        try {
            ServerSocket socket = new ServerSocket(8214);
            XMLRPCServer server = new XMLRPCServer();
            Log.d("Server", ">>>opening on port" + socket);
            while (true) {
                Socket client = socket.accept();
                MethodCall call = server.readMethodCall(client);
                String name = call.getMethodName();
                if (name.equals("newImage")) {
                    ArrayList<Object> params = call.getParams();
                    // assume "add" method has two Integer params, so no checks done
                   myData = (String)( params.get(0));
                    //int i1 = (Integer) params.get(1);
                    server.respond(client, new Object[] {200});
                    /*intent = new Intent (this, ParseFunction.class);
                 startService (intent);  */

                    Toast.makeText(this, myData, Toast.LENGTH_SHORT).show();  
                    Log.d("ParseFunction", ">>>Started()"); 

                    Intent i = new Intent( this, B.class );

                    i.putExtra( "Azo", myData);


                   i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity( i );

                } else {
                    server.respond(client, null);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        }

    }

  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:49:40+00:00Added an answer on May 29, 2026 at 5:49 am

    In case someone else wants the result here is what I should have done. Adding superclass to onCreate super.onCreate() and change onStart by onStartCommand (plus its superclass super.onStartCommand()), now it works as a charm

    package tfe.rma.ciss.be;
    
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.XMLReader;
    import org.xml.sax.helpers.DefaultHandler;
    import org.xmlpull.v1.XmlPullParserException;
    import org.xmlrpc.android.MethodCall;
    import org.xmlrpc.android.XMLRPCServer;
    
    import android.app.IntentService;
    import android.content.Intent;
    import android.util.Log;
    import android.widget.Toast;
    
    import java.io.IOException;
    import java.io.StringReader;
    import java.net.MalformedURLException;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.util.ArrayList;
    
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    
    public class Server extends IntentService {
        public String myData="";
        public String streamTitle = "",path="";
    
        public void onCreate() {
            super.onCreate();
            Log.d("Server", ">>>onCreate()");
        }
    
        public Server() {
            super("Server");
        }
    
        @Override
        public int onStartCommand(Intent intent, int flags, int startId) {
            super.onStartCommand(intent, startId, startId);
            Log.i("LocalService", "Received start id " + startId + ": " + intent);
    
            return START_STICKY;
        }
    
        @Override
        protected void onHandleIntent(Intent intent) {
            Log.d("Server", ">>>handlingIntent()");
            try {
                ServerSocket socket = new ServerSocket(8214);
                XMLRPCServer server = new XMLRPCServer();
                Log.d("Server", ">>>opening on port" + socket);
    
                while (true) {
                    Socket client = socket.accept();
                    MethodCall call = server.readMethodCall(client);
                    String name = call.getMethodName();
    
                    if (name.equals("newImage")) {
                        ArrayList<Object> params = call.getParams();
                        // assume "add" method has two Integer params, so no checks done
                        myData = (String)( params.get(0));
                        //int i1 = (Integer) params.get(1);
                        server.respond(client, new Object[] {200});
                        /*intent = new Intent (this, ParseFunction.class);
                        startService (intent);  */
    
                        Toast.makeText(this, myData, Toast.LENGTH_SHORT).show();  
                        Log.d("ParseFunction", ">>>Started()"); 
    
                        Intent i = new Intent( this, B.class );
                        i.putExtra( "Azo", myData);
                        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        startActivity( i );
                    } else {
                        server.respond(client, null);
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            } catch (XmlPullParserException e) {
                e.printStackTrace();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am doing a simple coin flipping experiment for class that involves flipping a
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.