Subject: Solaris 8 Java SLP API?

From: Andrea Foster <[email-masked]>
Date: Tue, 23 Jan 2001 16:22:38 +0200

Hi

I've come up against a few problems when writing test applications
using slp.jar on Solaris 8.

I have slpd running with the following slp.conf file:

net.slp.isDA=true
net.slp.DAHeartBeat=2000
net.slp.useScopes=sol,default
net.slp.traceDATraffic=true
net.slp.traceMsg=true
net.slp.traceDrop=true
net.slp.traceReg=true

When I try register a service (not a real one, just
using the demo code from rfc2614) with the following code:

package slptest;

import com.sun.slp.*;
import java.util.Vector;
import java.util.Locale;

public class reg{

  public static void main (String [] args){
  //Get the Advertiser 

  Advertiser adv = null;

  try {

    adv = ServiceLocationManager.getAdvertiser(new Locale("en","za"));

  } catch( ServiceLocationException ex ) {
     ex.printStackTrace();
   } //Deal with error.

  if( adv == null ) {

    //Serious error as printer can't be registered
    //  if the implementation doesn't support SA
    //  functionality.
    System.out.println("oops");

  }

  Vector attributes = new Vector();
  Vector values = new Vector();
  values.add("white");
  attributes.add(new ServiceLocationAttribute("color", values));

  //Create the service: URL for the printer.

  ServiceURL printerURL =
    new ServiceURL(
      "service:printer:lpr://printshop/color2",
      ServiceURL.LIFETIME_DEFAULT);
      
  System.out.println((printerURL.getServiceType()).toString()); /*print out
                                                                 service type */

  try {
    
    //Register the printer.

    adv.register(printerURL, attributes);
    System.exit(0);

  } catch( ServiceLocationException ex ) { 
     ex.printStackTrace();
     System.exit(1);
  } //Deal with error.
}
}

I get the following output:

********Jan 23, 2001 2:52:11 PM
SLPConfig: Syntax error in property ``net.slp.useScopes'':=sol,default
********

service:printer:lpr

Three things:

(1) Why the SLPConfig error? Can't you invoke a SA on a machine
with a slpd set up as a DA? What's wrong with those 2 scopes? No
such error occurs on slpd startup.

(2) While the service _does_ get registered, there's something funny about it
in that it doesn't have a Service Type. Even though the ServiceURL I
used supplied to construct the registration did in fact show the correct
service type.

(3) Why is the Service Location Attribute color=white shown as
(color=java.lang.String:white) ?

Here is an excerpt from /var/log/info.log:

Jan 23 14:52:11 jupiter slpd[6813]: [ID 220785 daemon.info] Request
``ffffedc2'' from host:port ``localhost/127.0.0.1:34788'' on interface
``localhost/127.0.0.1'':
Jan 23 14:52:11 jupiter  SrvReg:version=``2''
Jan 23 14:52:11 jupiter        functionCode=``3''
Jan 23 14:52:11 jupiter        length=``109''''
Jan 23 14:52:11 jupiter        overflow=``false''
Jan 23 14:52:11 jupiter        mcast = ``false''
Jan 23 14:52:11 jupiter        fresh=``true''
Jan 23 14:52:11 jupiter        locale = ``en_ZA''
Jan 23 14:52:11 jupiter        xid=``0xffffedc2''
Jan 23 14:52:11 jupiter        errCode=``0''
Jan 23 14:52:11 jupiter        previousResponders=``null''
Jan 23 14:52:11 jupiter        scopes=``[default]''
Jan 23 14:52:11 jupiter       
URL=``service:printer:lpr://printshop/color2''
Jan 23 14:52:11 jupiter        service type=``''
Jan 23 14:52:11 jupiter        attribute
list=``[(color=java.lang.String:white)]''
Jan 23 14:52:11 jupiter        URL signature=null
Jan 23 14:52:11 jupiter        attribute signature=null
Jan 23 14:52:11 jupiter slpd[6813]: [ID 772482 daemon.info] Added a
registration in Service table 
Jan 23 14:52:11 jupiter     Locale=``en_ZA''
Jan 23 14:52:11 jupiter     Service Type=``''
Jan 23 14:52:11 jupiter    
URL=``service:printer:lpr://printshop/color2''
Jan 23 14:52:11 jupiter    
Attributes=``[(color=java.lang.String:white)]''
Jan 23 14:52:11 jupiter     Scopes=``[default]''
Jan 23 14:52:11 jupiter slpd[6813]: [ID 449639 daemon.info] Reply
to ``ffffedc2'' host:port ``localhost/127.0.0.1:34788'' on interface
``localhost/127.0.0.1'':
Jan 23 14:52:11 jupiter  SrvAck:version=``2''
Jan 23 14:52:11 jupiter        functionCode=``5''
Jan 23 14:52:11 jupiter        length=``0''''
Jan 23 14:52:11 jupiter        overflow=``false''
Jan 23 14:52:11 jupiter        mcast = ``false''
Jan 23 14:52:11 jupiter        fresh=``false''
Jan 23 14:52:11 jupiter        locale = ``en_ZA''
Jan 23 14:52:11 jupiter        xid=``0xffffedc2''
Jan 23 14:52:11 jupiter        errCode=``0''
Jan 23 14:52:11 jupiter        previousResponders=``null''
Jan 23 14:52:11 jupiter        scopes=``null''

My goal here is to use the Solaris 8 DA and SA with my own UA. But
either my registration code or machine setup is horribly wrong somehow
(quite possible I admit), or Solaris 8 SLP has some bugs? Been staring
at this for ages now and would love to get some insight.

Regards
Andrea
-- 
___________________________________________________________
Andrea Foster
Department of Computer Science
University of Cape Town

[email-masked]