Cannot find services using SLP (Service Location Protocol)

Having problems with IHMC CmapServer? Think you have found a bug? Let us know!
Forum rules
Before you post a problem or bug, please be sure you have included the version number of IHMC CmapServer, the operating system and version, the amount of RAM, and any other information that allows us to be able to replicate the problem you are having. (i.e. what were you doing when the problem occur? were you running another program (application) by the time you have the problem?)
Post Reply
magsilva
Posts: 11
Joined: Wed Oct 20, 2010 12:44 pm

Cannot find services using SLP (Service Location Protocol)

Post by magsilva »

Dear all,

I'm trying to access the services provided my CmapServer without hardcoding its IP address. From what I could read about CmapServer, it register itself in a directory and also answers broadcasts/multicasts requests that follows the SLP (Service Location Protocol). However, I couldn't manage to get this working.

I think that the slp.conf is configured correctly (at least I can detect an open UDP port at 8847, which is the port I configured in slp.conf). I also know that the client (that try to discover the services) I'm using is also correct, as I can discover services configured in the OpenSLP daemon (configured to either the default port - 427 - or port 8847 -- I always close the daemon before testing starting and testing CmapServer, so it does not conflicts with it).

May be I'm using the incorrect types for the services. The log generated by CmapServer gives some hints about their service types. For now, I'm trying just those: cmapV3, service:cmapV3, services:cmapV3, PingService, service:PingService, services:PingService. Which of them are correctly? Better yet, what are the service types provided by CmapServer?

And, if any of those names are correct, what else did I get wrong? I'm using 'org.livetribe.slp' to implement my Java client and slptool (from OpenSLP) to test the discovery process. Both are configured to access port 8847 (the one I configured at slp.conf, instead of the default 427).

Regards,

Marco Aurélio
ghill47
Posts: 22
Joined: Fri Jan 29, 2010 12:50 pm

Re: Cannot find services using SLP (Service Location Protocol)

Post by ghill47 »

Hi, Marco.

Sorry for the delayed response. There are one or two points that I would like to make, followed by a question.
It is almost certainly the case that our discovery process (whether by local area broadcast, or by requesting a list from a Directory Server) does not adhere to the SLP standards. Nevertheless, we won't know why your attempts have not worked unless we simulate your attempts.

But before we spend any time trying to do that, it is very important to point out that even if you were to succeed in discovering the CmapServer(s) and if you were able to parse the list of services available on a particular CmapServer, as far as I am concerned there is absolutely nothing that you could then do with the available services. We wrote those protocols (for talking to the services) using java serialization, and we never published (nor did we intend to publish) those APIs.

Now, it is true that if you could get your discovery attempts to work, you would then be able to determine the IP address of each CmapServer, and additionally the "webserver" port number to which HTTP GET requests can be sent to retrieve HTML pages representing the folder hierarchy of each CmapServer (by default, this is port 80), and finally the "proprietary API" port number that the CmapTools client uses to communicate with that CmapServer. But like I said, regarding the "propietary API" port number, in my opinion, there is no point in even discussing it further, because you cannot write code to send requests through that port, because the API is proprietary.

So, having made those points, I need to ask you if all that I have said above is clear.

And then I would like to know: Is it really your goal, your intention, to talk to our services? If so, why? And if so, what service(s) in particular? We have never documented precisely what "our" services provide for "the client" anyway. Our only intention was to make them available to the CmapTools client.

Is it possibly the case that you intend to write your own service in Java and somehow bundle that service into the classpath of the CmapServer, in the hopes of writing client code that can then talk to "your" service in whatever proprietary manner you decide to implement? I say "proprietary" because it would all be up to you in terms of deciding how to talk to your new "service". We don't provide any hooks like that publicly.

Finally, just so that you know (and so that anyone else reading this forum knows), we hope to publish a REST-style API that will allow you to write client code in any language you want, and that client code will be able to send HTTP requests to a CmapServer in order to perform actions such as:
1. Give me the list of resources stored in the folder represented by Id <xxxxxxxx>
2. Give me the Cmap whose Id is <yyyyyyy> in XML format.
3. Save this XML version of a Cmap back to the CmapServer inside the folder represented by Id <zzzzzz>
4. Save the following (POSTed) data into folder <aaaaaa> and name the file <name>.<extension>

I won't list all the functions here (nor their parameters) because we have not yet completed this API.
We have a fair amount of it working now, and once it is completed, and once we have thoroughly tested it, I believe we do intend to publish it.

I hope this explanation helps. Please feel free to ask any more questions and/or to explain what it is that you are trying to do.

Thanks!

Cheers,

Greg
Greg Hill -- IHMC -- CmapTools Group
magsilva
Posts: 11
Joined: Wed Oct 20, 2010 12:44 pm

Re: Cannot find services using SLP (Service Location Protocol)

Post by magsilva »

Now, it is true that if you could get your discovery attempts to work, you would then be able to determine the IP address of each CmapServer, and additionally the "webserver" port number to which HTTP GET requests can be sent to retrieve HTML pages representing the folder hierarchy of each CmapServer (by default, this is port 80), and finally the "proprietary API" port number that the CmapTools client uses to communicate with that CmapServer. But like I said, regarding the "propietary API" port number, in my opinion, there is no point in even discussing it further, because you cannot write code to send requests through that port, because the API is proprietary.
Yes, that is it. I want to discover the IP address (and port) of the CmapServer. However, instead of communicating with CmapServer using it proprietary protocol, I will access the web service (SOAP-based one).

Actually, I already designed a (rather simple) client that retrieves a concept map (cxl document) using the web service. Now I just have to configure the endpoint (hostname + port) automatically. As CmapServer provides a SLP (or similar) facility, I imagined I could use it to discover the CmapServers in my local network automatically (instead of hardcoding the address in the application).

Regarding Service Location Protocol (SLP), how far the current implementation is from the actual SLP protocol standard? For what I could read at slp.conf and even data at network level, it really looked like as CmapServer was acting just fine as a ServiceAgent (that's why I imagined I wasn't guessing the advertised service name correctly).
pacificshore
Posts: 3
Joined: Fri Nov 05, 2010 11:44 pm

Re: Cannot find services using SLP (Service Location Protocol)

Post by pacificshore »

Hi Guys,

Getting started with jSLP

First, download the current 1.0_RC1 release of jSLP and a current release of commons-logging. Similar to RFC 2614, jSLP separates the UA and SA functionalities into two different classes, location of services is provided by ch.ethz.iks.slp.Locator, registration of services by ch.ethz.iks.slp.Advertiser. The starting point of interacting with jSLP is to get an instance of one of the classes (or both) via the static methods of ch.ethz.iks.slp.ServiceLocationManager.

Thanks a lot.

how to treat depression
magsilva
Posts: 11
Joined: Wed Oct 20, 2010 12:44 pm

Re: Cannot find services using SLP (Service Location Protocol)

Post by magsilva »

Finally I could achieve some progress. First, I tried to understand whatever was going on at the network level. Using Wireshark, I debugged the packages exchanged by CmapTools and CmapServer. I used the following code and added CmapTools's packages to the classpath:

Code: Select all

import nlk.cmapSrvLoc.slp.SLPLocator;

public class Test {
	public static void main(String[] args) throws Exception {
		SLPLocator locator = new SLPLocator();
		locator.getListOfServers("cmapV3");
	}
}
Some UDP packages were generated (and captured by Wireshark). Thanks to that, I realized some SLP parameters I needed to configure the service discovery:
  • scope = cmapdp or public (while SLP defaults to 'default')
    serviceType = cmapV3
Running openslp, I could check whether everything was ok (I used an unicast address, just to be safe that no broadcast/multicast issue would hamper the discovery process):

Code: Select all

$ slptool -u 127.0.0.1 -s cmapdp findsrvs cmapV3
cmapV3://10.6.208.61:4447/...
Finally, my Java client. I was using jSLP, but I did not work at all. Wireshark at hand again, I discovered that jSLP uses only multicast (and that is probably broken in my network configuration). So, I download the latest source code for jSLP and modified it to use only broadcast. The result: the code below worked perfectly:

Code: Select all

import ch.ethz.iks.slp.*;
public class Test {
    public static void main(String[] args) throws Exception {
	    Locator locator = ServiceLocationManager.getLocator(Locale.ENGLISH);
	    List<String> scopes = new ArrayList<String>();
            scopes.add("cmapdp");
            Enumeration<?> enumeration = locator.findServices(new ServiceType(serviceName), scopes, null);
            while (enumeration.hasMoreElements()) {
                System.out.println(enumeration.nextElement().toString());
            }
	}
}
ghill47
Posts: 22
Joined: Fri Jan 29, 2010 12:50 pm

Re: Cannot find services using SLP (Service Location Protocol)

Post by ghill47 »

Marco,

That sounds great! Congratulations!
Yes, now that you mention the necessary Scope and ServiceType, that makes perfect sense.
There are a few of us here who should have realized that you would need to specify those two items correctly. Sorry about that.

Anyway, congratulations!
Greg Hill -- IHMC -- CmapTools Group
Post Reply