9 Replies Latest reply on May 23, 2008 5:05 AM by marklittle

    How to get Senders Details

    sivananthamrg

      I am working on to retrieve the below details in my custom action class in my ESB service.

      1. Details of the destination - Service to which the request to be routed.
      2. Details of the sender ( service requestor URL;functionality similar to the result of getRemoteHost() method of ServletRequest API)

      I browsed through the Call / EPR / PortReference API, but i didnt find methods that suits my requirement. I am new to JBoSS so dont have much clue on this.

      I appreciate your help in this regard,

      Thanks in advance.



        • 1. Re: How to get Senders Details
          jpechanec

          Hi,

          do not the methods getFrom and getTo on the Call interface conform to your requirements?

          J.

          • 2. Re: How to get Senders Details
            marklittle

            The To field will give you details of the destination.
            The From (or maybe ReplyTo) field will help identify the sender.

            • 3. Re: How to get Senders Details
              sivananthamrg

              hi jpechane,

              you are correct, getFrom and getTo is giving jms queue information, but not the senders information.

              ************ call.getFrom()>>>>>>>>>JMSEpr [ PortReference < <wsa:Address jms://localhost/queue/simplewsconsumer1_esb/>,
              ......


              ************ call.getTo()>>>>>>>>>JMSEpr [ PortReference < <wsa:Address jms://localhost/queue/simplewsconsumer1_esb_reply/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : localhost/>,
              <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>....
              ..
              ...

              Like above i am getting JMSEpr information, how can i get the actual senders information?

              • 4. Re: How to get Senders Details
                burrsutter

                Are you looking for the userid that was authenticated against the resource in order for them to write to the queue originally?

                Burr

                • 5. Re: How to get Senders Details
                  marklittle

                  What is the sender? If the message has come from outside of the ESB (i.e., via a gateway) then the From field is probably not set.

                  • 6. Re: How to get Senders Details
                    sivananthamrg

                    Here sender is a native webservice,
                    i.e, i am invoking the esb from the webservice running in the same jbossAs 4.2.1.

                    that code i have written in the webservice is like this:-

                    .............
                    .............
                    System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");

                    // Create the delivery adapter for the target service (cache it)
                    ServiceInvoker deliveryAdapter = new ServiceInvoker("MySimpleServiceCategory1","SimpleserviceConsumer1");

                    // Create and populate the request message...
                    Message requestMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);

                    // Deliver the request message synchronously - timeout after 20
                    // seconds...
                    System.out.println("\n\n-------------requestMessage----------"+requestMessage);

                    Message replyMessage = deliveryAdapter.deliverSync(requestMessage, 20000);
                    return replyMessage.toString();

                    ...............
                    ...............

                    and jboss-esb.xml has the following tags:
                    .....
                    < service category="MySimpleServiceCategory1" name="SimpleserviceConsumer1" description="Simple Webservice Consumer1" >
                    < listeners >
                    < jms-listener name="JMS-ESBListener1"busidref="quickstartEsbChannel1" maxThreads="1" / >

                    ...
                    ...

                    < /service >

                    • 7. Re: How to get Senders Details
                      marklittle

                      Just to be clear: the sender is a vanilla SOAP client? Which SOAP stack?

                      • 8. Re: How to get Senders Details
                        sivananthamrg

                        I am invoking ServiceInvoker to call the esb, and MessageType.JBOSS_XML message format soap stack i am using for serialization and deserialization.

                        one more query i have is message.getproperties.addPropery() useful for sending senders information,or any other way to send the senders information.

                        I would like to know a few things I am listing below
                        1. How did I intercept the messages to/from ESB ? Is it using Custom Filters or Actions?
                        2. How you captured the sender/receiver application name/details wrt each ESB message interrupted?
                        It would be of great help if you can help us in this..

                        • 9. Re: How to get Senders Details
                          marklittle

                          The sender address information should be all available in the message header. What other sender information do you want?

                          You can intercept all messages to, from, and within the ESB using filters.