on 04-02-2008 11:54 AM
Synchronous Services can be consumed by other ABAP systems w/o XI via a Web-Service call.
This is possible by assigning an appropriate default port.
But how are the call parameters / RFC destination (defined for the HTTPS destination) to be filled in the logical port ?
I think I can remember that I need to logon to the system providing the server proxy, go to transaction SPROXY and look at the WSDL document for the service.
But this now seems to be greyed out in the menu...
hi barth,
Setting Up Point-to-Point Connections
Purpose
The Integration Server provides a variety of services that are required in cross-system processes, for example, routing, integration processes, and mappings. In those cases where such services are not required, communicating by using the Integration Server unnecessarily slows down message exchange. This is usually the case for new applications where both the sender and receiver use message interfaces to communicate. In such cases, mappings are often not required because the outbound and inbound messages use the same message type.
The process below explains how client and server proxies, which were generated by means of message interfaces from the Integration Repository, can communicate with each other directly by using the Web service runtime. This has the following advantages:
· Performance is improved by bypassing the Integration Server.
· If the services of the Integration Server are required at a later date, it is possible to switch from the Web service runtime to the XI runtime, without having to change the program code (see also: Runtime Configuration).
Prerequisites
· Your scenario uses a synchronous outbound and inbound message interface from the Integration Repository. Both message interfaces use the same message type for the request, response, or fault message. You have already created the corresponding client and server proxies in the application systems.
· No mapping is required (this includes value mappings).
· No receiver determination is required, in other words, the receiver is static. It is also possible to set the receiver dynamically yourself (by using the GET_LOGICAL_PORT_FROM_RECEIVER method, see receiver pre-identification).
· No monitoring functions are required (only the following are available: trace for the Internet Communication Manager (ICM), Internet Communication Framework (ICF), and transaction SM59 for the HTTP connection).
Process Flow
...
1. Create a virtual interface for the server proxy and a corresponding Web service.
a. Display your server proxy in the Object Navigator (transaction SE80).
b. Choose Goto ® Web Service Wizard (). The wizard is only active for synchronous server proxies. Follow the wizards instructions and specify the names and the descriptions for the virtual interface and the Web service.
c. Check whether the navigation tree in the Object Navigator displays the name of the virtual interface and the Web service, and whether the Web service was deployed successfully and is displayed in transaction WSCONFIG.
d. Log on to the target client of the receiver system and release the Web service by calling transaction WSADMIN.
2. Log on to the source client of the sender system (client side).
3. Create a corresponding HTTP destination by calling transaction SM59.
4. Enter the following data on the Technical Settings tab page:
a. Enter the path of the Web service that you released in transaction WSADMIN as the Path Prefix. Example: /sap/bc/srt/xip/sap/.
b. Specify a Target Host (including the port, if applicable).
5. Enter the logon data on the Logon/Security tab page and save your entries.
6. In the same client, call transaction LPCONFIG and create a logical port for the client proxy.
a. On the Runtime tab page, choose Web Service Infrastructure.
b. Assign the http destination to the logical port.
c. Activate the logical port.
Result
You can now send messages directly to the logical port and the server proxy by using the client proxy call in the source client of the sender system (see also: Sending a Message).
Creating a JMS Connection
Use
No matter whether you want to use the point-to-point or the publish/subscribe model, you must initialize the connection object first. For both messaging styles, this is done in the same way.
Prerequisites
A connection factory must be created and registered in the JNDI context.
Procedure
The JMS Connection is obtained in a few steps.
In the example source that follows CT shows the type of the connection:
· Topic use this for the publish-subscribe messaging model.
· Queue use this for the point-to-point messaging model.
· XATopic use this for the transacted publish-subscribe messaging model.
· XAQueue use this for the transacted point-to-point messaging model.
Step 1: Set the properties of the JNDI connection
Specify the connection properties. Specify the security properties and all the other properties required to obtain the connection.
java.util.Properties properties = new Properties();
// set the properties of the connection
properties.put("Context.INITIAL_CONTEXT_FACTORY", "com.sap.engine.services.jndi.InitialContextFactoryImpl");
properties.put("Context.SECURITY_PRINCIPAL", "Administrator");
properties.put("Context SECURITY_CREDENTIALS", "admin_password");
// start initial context with the properties specified
InitialContext context = new InitialContext(properties);
The properties that have to be set may differ depending on the client type. For example, internal users of the server may not need to specify properties until external clients have to specify additional properties.
For more information about the security provided with the JMS, see Security on JMS Service.
Step 2: Register the connection factory
Use the default connection factories provided by the J2EE Engine these are:
· jmsfactory/default/TopicConnectionFactory
· jmsfactory/default/QueueConnectionFactory.
First you have to register it using the JMS Connector Service. Then to:
· Look up a connection factory, use the following code:
QueueConnectonFactory queueConnectionFactory = (QueueConnectonFactory) context.lookup("java:comp/env/<res-ref-name>");
TopicConnectonFactory topicConnectionFactory = (TopicConnectionFactory) context.lookup("java:comp/env/<res-ref-name>");
· Look up a destination, use the following code:
Queue queue = (Queue) context.lookup("java:comp/env/<res-env-ref -name>");
Topic topic = (Topic) context.lookup("java:comp/env/<res-env-ref-name>");
To perform a lookup operation, you also need a resource reference entry for the relevant administered object in the deployment descriptor of the component that looks up the object:
· Declare a JMS ConnectionFactory resource in the <resource-ref> element of the standard deployment descriptor for the relevant application component. The name that you specify in the <res-ref-name> tag is the name used for the lookup operation.
· Declare a JMS Destination resource in the <res-env-ref> element of the standard deployment descriptor of the application component. The name that you specify in the <res-env-ref-name> tag is the name used for the lookup operation.
For more information about declaring resource references for enterprise beans, see Declaring Resource References. For Web components, see Configuring Resource References.
The J2EE Engine JMS Provider gives you the following types of connection factories:
· TopicConnectionFactory enables you to create and configure a topic connection.
· QueueConnectionFactory enables you to create and configure a queue connection.
· XATopicConnectionFactory enables you to create and configure a transacted topic connection.
· XAQueueConnectionFactory enables you to create and configure a transacted queue connection.
Use the following code to lookup the connection factory:
TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) context.lookup("java:comp/env/TopicConnectionFactory");
We recommend that you use the default connection factories provided by the J2EE Engine, located in jmsfactory/default/TopicConnectionFactory or jmsfactory/default/QueueConnectionFactory.
Step 3: Specify the connection type
Having obtained the connection factory object, use it to create the Connection object of the required type Topic, Queue, XATopic or XAQueue:
CTConnectionFactory ctConnectionFactory = (_CT_ConnectionFactory)context.lookup("jmsfactory/default/_CT_ConnectionFactory");
// create connection of type Topic
TopicConnection topicConnection = topicConnectionFactory.createTopicConnection();
Step 4: Start the connection
For more information about the JMS messaging models you can use, see Point-to-Point Model and Publish-Subscribe Model.
Start the connection:
// start the connection of CT type
CTConnection.start();
// start the connection of Topic type
topicConnection.start();
Step 5: Create session
Use the connection to create a session object:
// create session of CT type
CTSession ctSession = CT_Connection.create_CT_Session(false/true, Session.ACKNOWLEDGE_TYPE);
You have to specify the Session parameters. The first one shows whether or not the session is transacted. The second parameter specifies the acknowledgement mode. For more information, see Message Acknowledgement.
// create session of Topic type
TopicSession topicSession;
topicSession = topcicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
For XA sessions:
// create session of XATopic type
XATopicSession xatopicSession = xatopicConnection.createXATopicSession(true, Session.AUTO_ACKNOWLEDGE);
The XA sessions implement theXAResource that is transacted.
Step 6: Create or look up a destination
Now create or look up a destination of the required type. Specify a name of the destination you are creating:
// create destination of CT type
CT= CTSession.create_CT_("Example_destination_name");
// create destination of Topic type
Topic = TopicSession.createTopic("Example_destination_name");
Final step: close the connection
When you have finished using the JMS connection, close the producers, consumers, sessions and the connection. This enables you to release the resources that are no longer used. For more information, see Closing the JMS Connection.
You can handle the connection exceptions using your own implementation of the class javax.jms.ExceptionListener. You have to implement the onException() method, and this will allow you in case an exception occurs to perform a scenario of your own and to avoid losing data. For example:
/**
Handle asynchronous errors with the connection.
*/
public void onException(javax.jms.JMSException jsme) {
// Tries to reconnect
}
To register the implementation use:
// Register this class as the exception listener.
connection.setExceptionListener(
(javax.jms.ExceptionListener) ExceptionListenerImpl);
When you implement the onException() method, do not close the client connections that were used up to that moment. The JMS Provider takes care of that. The client has to get the objects he or she requires from the factory that was already obtained.
Result
Having obtained JMS connection, use it to send, receive and manage the JMS messages.
The message sending and receiving depends on the messaging model you selected for the JMS connection. For more information about the messaging styles
Creating a Message Consumer to a Queue
Use
The queue consumer of messages can be QueueReceiver or QueueBrowser.
QueueReceiver enables you to receive and unpack messages, QueueBrowser enables you to browse through the messages only.
Use the QueueBrowser to view messages sent to a Queue without removing them from the queue. The QueueBrowser provides a method that enables you to use an instance of java.util.Enumeration class. This enables you to browse through the messages and to scan them, although the messages may expire before the scan end or new messages can be received.
Procedure
If you want to receive messages asynchronously, you must register the class as a javax.jms.MessageListener instance. This enables you to use the onMessage(javax.jms.Message message) method to receive and unpack the messages asynchronously:
public class Example_class implements javax.jms.MessageListener {
// create subscriber to a queue
QueueReceiver queueReceiver = queueSession.createReceiver(queue);
System.out.println("Receiver created.");
// set message listener
queueReceiver.setMessageListener(this);
System.out.println("MessageListener set.");
public void onMessage(javax.jms.Message message) {
// receive and unpack the message
}
}
If you want to receive messages synchronously, use the receive() method. Apply it to the message you want to receive.
// create subscriber to a queue
QueueReceiver queueReceiver = queueSession.createReceiver(queue);
System.out.println("Receiver created.");
// receive message
TextMessage textMessage = (TextMessage) queueReceiver.receive();
System.out.println("Receiving the message.");
Example
For an example, see Queue Sender and Receiver.
Creating a Message Producer to a Queue
The message producer in a queue is QueueSender. Use it to send messages to a queue destination.
To create a message producer to a queue use the following source:
// create the message producer
QueueSender queueSender = queueSession.createSender(queue);
Having obtained a QueueSender, use it to send messages to the specified queue destination.
Creating Temporary Queues
Use
The session object provides the functionality for creating temporary queues (destinations that last as long as the lifetime of the session). Consumers of temporary destinations can be created from the same connection that created the destination only.
The javax.jms.QueueRequestor class demonstrates how you use temporary destinations.
The QueueRequestor class provides a request method that simplifies service request making. This class creates a TemporaryQueue for the responses and enables you to send messages and wait for a reply. Indeed, this is a basic request/reply abstraction.
The temporary queue only lasts for the duration of the connection in which you created it.
Prerequisites
The QueueRequestor requires a Queue destination and non-transacted QueueSession object.
Procedure
Use the following source code to create a QueueRequestor
Point-to-Point Connections
Communication using Web services is synchronous and point-to-point. The XI runtime also supports synchronous communication, but needs the Integration Server to be able to forward messages. In the first case there is, of course, a performance advantage; in the second case you can use the mapping, routing, and BPM services of the Integration Server, and configure the receiver centrally:
Since you can only generate server proxies from XI message interfaces, only SAP XI users can use point-to-point connections. See also: Setting Up Point-to-Point Connections.
regards
karthik
reawrd me points if usefull..............
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.