Developing Web Services with Borland JBuilder Enterprise and BEA WebLogic Server
Any Web service communicates over a HTTP (or HTTPS) protocol, The Client sends a SOAP—Simple Object Access Protocol—request and waits for the SOAP response. SOAP is basically XML in a special format that describes the communication. Behind the scenes, both server and client have XML parsers and encoders communicating over an HTTP socket. After the request is received, it is decoded into the specific method to call, with what parameters, and after that method is invoked, its return value (if any) is enclosed into XML-SOAP envelope and pushed back.
According to the J2EE specification, a very specific application structure must exist to be used as a Web application. WAR—Web ARchive—files contain deployment descriptors and code and are packed in to EAR—Enterprise ARchive—files for final installation on the application server. Because this specification is the same for all platforms, any code in WAR and EAR packages developed with any toolkit should work on any application server; however, most application server vendors will probably be different in their deployment descriptor files.
Thankfully, JBuilder takes the complexity out of making Web applications, but a standalone Axis Java2WSDL tool can always be used and manual packaging of code into an EAR file is possible. Please see the reference section for more Axis documentation.
Now, the project is complete and is ready to be deployed on an application server and run as a Web service server. Here is what it should look like (see right panel):
Deployment with JBuilder is also as easy as the creation of a Web service. Make sure BEA Weblogic is running. Right-click on ApplicationModule1 (the name of your service application module) and select -> Deploy Options -> Deploy.
JBuilder will indicate something like this:
Initiated Task:  [Deployer:149026]Deploy application ApplicationModule1 on myserver. Task 0 running: [Deployer:149026]Deploy application ApplicationModule1 on myserver. Deployment completed on Server myserver
That is it! Your new Web service is now hosted and ready to be used by the world!
It also can be undeployed and redeployed in the same way. All current deployments also can be listed from the same menu.
To test, either open JBuilder -> Tools-> Web Services Console or point your Web browser to http://localhost:7001/web-services/Bean1.
A Web-based test client provided by Weblogic of the new service should appear, invoking SOAP communication behind the scenes to call Bean1's methods. It can even show the XML being sent around.
For example, clicking on the getText() method will result in the following:
|Parameter Name||Parameter Value|
Request sent to the server:
<!--REQUEST.................--> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <m:getText xmlns:m="http://beanws"> </m:getText> </env:Body> </env:Envelope>
Response from the server:
<!--RESPONSE.................--> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <m:getTextResponse xmlns:m="http://beanws"> <result xsi:type="xsd:string">Hello</result> </m:getTextResponse> </env:Body> </env:Envelope>
The whole WSDL file can be viewed by appending "?WSDL" to the URL:
The production server deployment would be of course not with JBuilder, but its equally easy-to-use, Web-based administration Console, usually running on same port as the Weblogic server, for example http://localhost:7001/console, to deploy EAR files.
Please read the Weblogic documentation on how to use their server administration; the ApplicationModule.EAR file can be found in the JBuilder project directory.
Page 3 of 4