Using of Endpoints / Reading serviceParameters and serviceName

"Ferruh Zamangoer" <[email protected]> Wed, 6 Jul 2005 19:27:44 +0200
Newsgroups gmane.comp.java.jxta.user,gmane.comp.java.jxta.general
Message-ID <[email protected]>
Hi,

 

I'am using the endpoint Protocol to send some messages between two peers.
When I send a message from Peer A to Peer B I want to read out the
serviceName and serviceParams. In my send method on Peer A I do the
following: 

 

<codesnip>

private String serviceName = "EndpointService";

 

private String serviceParameters = "012345";

 

 

            EndpointAddress endpointAddress = new
EndpointAddress(toAddress);

 

            Messenger messenger =

                myEndpointService_.getMessenger(endpointAddress, null);

 

            if (requestMessage == null)

            {

                System.out.println("requestMessage is null");

            }

            System.out.println("Send the message to the endpoint");

            messenger.sendMessage(

                requestMessage,

                serviceName,

                serviceParameters);

            System.out.println("Message send");

        }

        catch (IOException io)

        {

            io.printStackTrace();

        }

    }

</codesnip>

 

On Peer B I had registered a EndpointListener. In the method
processIncomingMessage I try to get the serviceName and serviceParameters?

 

 

public void processIncomingMessage(

        Message message,

        EndpointAddress srcAddr,

        EndpointAddress dstAddr)

    {

...

When I try to read out the serviceParams and serviceName from the srcAddr I
get null for both ? 

.....

}

 

 

Could it be that I have to use a another Constructor to create the
Endpointaddress on the client side:

 

EndpointAddress endpoint = new EndpointAddress(new
EndpointAddress(toAddress), serviceName , serviceParameters );

 

Instead of: 

 

            EndpointAddress endpointAddress = new
EndpointAddress(toAddress);

 

Thanks for any help.

 

Regards

Ferruh