Friday, February 16, 2007

XML over HTTP at WCS

XML over HTTP at WCS

WebSphere Commerce can receive inbound XML messages over HTTP.
From info center, it says:
---
The following steps illustrate the overall flow of an XML over HTTP request:

1. An external system sends an XML message to WebSphere Commerce over HTTP for example, http://host_name/webapp/wcs/stores/servlet/.
2. The request is mapped to the Program Adapter.
3. The Program Adapter passes the XML request to the appropriate message mapper.
4. The message mapper converts the XML request into a CommandProperty object and passes it back to the Program Adapter.
5. The Program Adapter prepares the command for execution and passes it to the WebController for execution.
6. The Program Adapter generates the proper XML response and returns the XML response to the external system that made the request.
---

So, how to create the request?

1. Use Java stand alone class to use socket function.
Here is my focus,if you want to send request through SSL channel, then you can initialize the socket with port 8000.
You have to establish the connection by creating the socket with port 80 first,
then, specify the port name following the HOST at header:

Example for header:

POST /webapp/wcs/tools/servlet HTTP/1.1
Host: hostname:8000
Content-Type: text/xml
Content-Length: 507

<?xml version="1.0" encoding="UTF-8"?>CONTENT...




2. Ajax solution
Seems fancy, but ...
Because Ajax does not support cross domain request,
it loses the point to use it. Why do we need a internal request (XMLHttpRequest)?

However, it seems the performance is better than socket.

No comments:

Post a Comment