Archive for Technology

Different Hibernate object states and their lifecycle in Hibernate

There are 3 hibernate object state -

1.) Persistent- Persistent object and collections are short lived single threaded objects, which store the persistence state. These objects synchronize their state with database depending on your flush strategy(i.e auto flush where as soon as setXXX() method is called or an item is removed from a set,list etc or define your own synchronization points with session.flush().transaction.commit() calls.) If you remove an item from persistence collections like a Set, it will be removed from database either immediately or when flush() or commit() is called depending on your flush strategy. They are plain old java objects(POJO) and are currently associated with session. As soon as the associated session is closed , persistence objects become detached objects and are free to use directly as data transfer objects in any application layer like business Layers, presentation layer etc.

2.) Detached – These objects and collection are instances of persistence objects that were associated with a session but currently not with associated with session. These objects can be freely used as Data Transfer Objects without having any impact on your database .Detached objects can be later on attached to another session by calling methods like session.update(), session.saveOrUpdate() etc and become persistence objects.

3.) Transient – These objects and collection are instance of persistence object that were never associated with session.These objects can be freely used as Data transfer objects without having any impact on your database. Transient objects become persistent objects when associated to session by calling, session.persist() etc.

4.) Removed State -A previously persistent object that is deleted from the database session.delete(account).Java instance may still exist, but it is ignored by Hibernate -Any changes made to the object are not saved to the database Picked up for garbage collection once it falls out
of scope
• Hibernate does not null-out the in-memory object

Read more:

DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare

Debugging & Generation of ABAP Proxy

Debugging a Proxy

XML input file is required to debug a proxy. Check whether interface has been processed or not from transaction SXMB_MONI. Take XML file and use as input for processing by manipulating file data. If debug session is unable to start, possibly the XML file is not correct.

You can upload and edit XML payload file and debug the end point by setting breakpoint.

Proxy Generation and Service Interface

Any change in the source XSD file impacts the proxy structure. It is required to regenerate outbound service interface and then to regenerate client proxy. If there is some mandatory parameter is being changed then generation is must but generate client proxy on changes whenever WSDL is changed.

Generate client proxy using t-code SPROXY by clicking Generate on service interface outbound and then activate (using ctrl+F3). Activation of proxy is required after regeneration of the proxy.

Proxy URLs

Endpoint URL points to WSDL document for the web service. URLs are system dependent therefore configuration is required manually in each system.

Important Transactions

Transaction SPROXY – Enterprise Service Repository

Transaction SXMB_MONI – Monitoring of processed XML Messages

Transaction SOA_MANAGER – Administration of new service definitions

DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare

Web Services Invocation and Proxy Objects in SAP

Synchronous & Asynchronous Web Service Invocation

Web services calls can be invoked synchronously or asynchronously. Third party systems can directly interact with SAP through web service calls.

In case of synchronous mode, a response message is expected from the receiver for every request sent. Messages cannot be sent until the response is not received from sender system. In case of asynchronous communication, a response is not expected and sender can continue processing.

Web Services can be created using wizard in SAP. All necessary objects are created automatically using the wizard.

Proxy Objects in SAP

Proxies are platform specific executable entities which are mapped to web services that are built on platform independent standards in enterprise service repository. ESR only stores the details like configuration, installation and deployment related information for the web service.

Proxies provide an abstraction for the platform specific implementation details for the business function to be achieved.

ABAP client proxy can be created using the wizard in transaction SE80 or SPROXY. Once created, they are to be released using transaction SOAMANAGER.

ABAP Proxy

ABAP Proxy can be created at application server using transaction SPROXY.  Direction of the proxy determines the objects that are generated. They could be either client Proxy or server proxy.

  1. Client/ Consumer ABAP Proxy – Consumer proxy can be created from by referring some existing service in ESR, by giving URL of the web service or by uploading WSDL file provided by third party system.
  2. Server/ Provider ABAP Proxy – Provider proxy can be created from ESR Interface or some object type (referring to an endpoint)

States of Proxy Object

Proxy Objects can be active, orphan, obsolete or inactive depending on the association

States of Proxy Object

End Point

End Point for web service could be a function module, Function Group, BAPI or a IDoc.

DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare

Web Services in SAP

Web Services are executable entities representing a process function that are built on an acceptable open standard which can be published, searched & called from the network.

Web services & Business Process integration?

Business Processes in an enterprise or across several enterprises are typically run on a complex system landscape spread across several software components each performing set of steps forming a part of process chain.

Various applications, interfaces and message exchanges among software components used to be designed to integrate business process across several application components.

Web services have simplified this integration by sharing open standards for integration.

  • It is possible to publish independent functional entities such as RFC enabled functions, BAPIs and Function Groups as Web Services which can be used by any other development environment over internet using standard protocols.
  • Any other application can consume web service regardless of the way it has been implemented.

Service Provider Service Requestor and Service Directory

Service Provider

Once the business function has been implemented, it is exposed as a web service by the service provider. An interface is shared for the web service using which it can be configured and called at runtime. Interface provides an abstraction for the underlying implementation.

Service Directory

Service definitions can be stored in a UDDI registry. Web service schema definitions (WSDL documents) can be searched in UDDI using standard search APIs.

Service Requestor

Web Services can be integrated by service requestor using WSDL documents.

DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare

SAP Netweaver and Web Service Protocols

Web service provider creates web service, generates the WSDL file for its schema definition and publish the same. Client applications can then consume the web service based on the WSDL file.

SAP Netweaver supports open standards for web services like WSDL, JAXM, SOAP, UDDI, WSI and XML etc.

Open Standards used in Web Services

UDDI – Universal Description, Discovery and Integration (UDDI) is an open standard used to define how to publish and discover web service. It gives details like service provider, service type and the service name and also holds meta-data used to discover services.

WSDL – Web Service Description Language (WSDL) is the open standard used to define the semantic of a web service. It gives details about the data types, message, port and binding.

As part of open standard, WSDL file is recognized both by SAP and third party system. RFC and BAPI calls from middleware are eliminated and instead direct calls can be made to SAP.

Structures of WSDL File

<TYPE> …</TYPE>: It gives the data type used by web service. XSD schema definition is included here.

<MESSAGE> …</MESSAGE>:  It captures the name of the message used by web service

<PORTTYPE> … </PORTTYPE>: It gives the name of the port type for input/output message

<BINDING> … </BINDING>: It defines the connection parameter between interface and the message. It also captures additional communication data such as user id and passwords.

<SERVICE>…</SERVICE>:  Gives information about the recipient of the message.

XSD – XML Schema definition defines the structure of the data, which a data object contains. You edit the XSD file to define the elements, types, attributes and groups of the XSD in the editors available in the market.

DZoneDeliciousLinkedInRedditTechnorati FavoritesStumbleUponShare