For the most part, you call Oracle Commerce Platform Web Services in the same way you call Web Services elsewhere. While the general process may not differ, it’s important that you are aware of these platform-specific features.
Security
The content you see as a response to a Web Service call depends on your access privileges. When you login using the loginUser
Web Service, you provide your user identity. If session sharing is enabled, all subsequent Web Service calls in that session are associated with that identity and related role.
For more information on loginUser
, see the Personalization Programming Guide. You may also want to learn how other Web Services handle the security information provided by loginUser
. Such information exists in the Repository Guide and the Core Commerce Programming Guide.
Transactions
When a client calls a Web Service, the transactional behavior of the service is managed entirely on the server side. The method that is exposed as a Web Service can use standard transaction demarcation techniques, but the calling client has no control over this.
There are some practical considerations you should be aware of. If a single Web Service call attempts to perform some operation, and the operation fails, the operation can be rolled back (provided that the Nucleus method is demarcated properly). However, a transaction cannot span multiple Web Service calls so if an operation is performed by a sequence of Web Service calls, and the final call fails, there is no way to roll back the steps performed by the previous calls.
Sharing Sessions
When you create a Web Service, you specify whether it should be executed within the context of an HTTP session. Associating Web Services with a session enables an application to maintain state across Web Service calls and to use login information for security purposes.
To allow multiple Web Services to share a session, two things need to happen:
The Web Service client must allow a session to be shared across certain Web Service calls. To do this, the client must pass a session cookie between calls.
The Web Services themselves must support sessions. When you create custom Web Services, the Web Service Creation Wizard gives you the option of supporting sessions.
This section includes an example of a helper class that you can use to simplify cookie management. See Writing a CookieContainer Class.
RepositoryItems
If your Web Services access RepositoryItems
, you need to provide a serializer and deserializer so the RepositoryItem
content can be interpreted by non-Oracle Commerce Platform systems. The following Web Services transmit content that is natively stored as RepositoryItems
:
getProfile
getRepositoryItem
performRQLQuery
getOrderAsXML
(Core Commerce users only)getOrdersAsXML
(Core Commerce users only)getProductXMLById
(Core Commerce users only)getProductXMLByDescription
(Core Commerce users only)getProductXMLByRQL
(Core Commerce users only)getProductSkusXML
(Core Commerce users only)getPromotionsAsXML
(Core Commerce users only)
The Oracle Commerce Platform includes several tools for working with RepositoryItems
. To make a client able to serialize and deserialize RepositoryItems
, you need to translate the RepositoryItem
class into a language that’s native to your client. See Creating a Serializer and Deserializer for more information.