Pages

Saturday, September 25, 2010

Using the Oracle IPlanet Web & Proxy Server for FMW ( Reverse proxy )

With the Sun acquisition Oracle also acquired the IPlanet / Sun One software. Two of these Sun One products will play an important role in the Fusion Middleware. The first is the Oracle IPlanet Web Server 7.0 ( Or Sun One , IPlanet, Netscape Server ), I already know this Web Server from the Netscape timearea and it work nice. The IPlanet Web server can replace the Oracle HTTP Server or the Apache Server. IPlanet has some great advantages like a nice console application where you can configure nodes, configurations and instances or you can also use the command line for this. And It looks like WebLogic ( AdminServer, Managed Server , Nodes and Clusters ).
The second is the Oracle IPlanet Proxy Server 4.0. This product will replace the current Oracle WebCache version in FMW 12c (cloud). Oracle IPlanet Proxy can cache and filter web content.
Both IPlanet product supports reverse proxying. This means it can be used in front of the WebLogic Servers. The IPlanet Proxy Server can also cache the WebLogic content and supports filtering, like passing on every request to the WebLogic instances (this is the case with IPlanet Web Server ) or only when it starts with /em or /console etc.
Both product can be downloaded in edelivery ( Search for Fusion Middleware ).

We start with the Oracle Iplanet Web Server.
IPlanet Web Server
First select the right Configuration and after that theVirtual Server which is part of this Configuration. Click on Setup Reverse Proxy. 



You need to use / as URI prefix and the Weblogic servers seperated with , in the value of the Server Names field.

Because everything is forwarded to the WebLogic Server we can disable Java in the Configuration part. ( less resources)

Deploy your configuration and restart the Instance.

That's all for the IPlanet Web Server.

IPlanet Proxy Server
For the IPlanet Proxy Server you need to do the following.

Click on the right server
 Go to Routing and click on Regular Expression.
Here you can do every url or just one. For all then use /.* else for example /console/.*
I will use in this example /console/.*

Select your URL and Click on Select

Go to Configure HTTP Request Load Balancing where you can provide the WebLogic Servers in the Server field.


And start or restart the IPlanet Proxy Server

Tuesday, September 7, 2010

SOAP over JMS with Oracle Service Bus 11g

In a previous blog I already showed you how you can do SOAP over JMS with a JAX-RPC Web Service. In this blogpost I will use OSB 11g ( Also works in 10.3 ). The OSB Proxy Services is also based on the JAX-RPC framework, so it works almost the same as a normal Java JAX-RPC Service.

You need to start with a new Proxy Service based on a WSDL

Choose for JMS. OSB will generates a default Endpoint Uri. You need to remember the QueueName of this Endpoint uri, you will use this in your Java proxy client.
OSB automatically creates a new Queue with this name when it does not already exists.

In the JMS Transport tab you need to select Is Response Required and JMSMessageID as Response Pattern.

In the Message Flow Tab I will use a simple File Busines Service and in the Response Action an Assign to set the WSDL response in the body variable.
In the Response Action you need add a Transport Header.

In the Transport Header you need to add the _wls_mimehdrContent_Type Header with as value 'text/xml; charset=utf-8' and use Inbound Response as Direction.
If you don't set this Transport Header you can get a content type null error on the JAX-RPC Client side
Deploy this project to the OSB Server.

Now you can download the WSDL of the Proxy Service in the SB Console, you need this to generate the JAX-RPC Client.

extract this jar and optional you can change the Endpoint to this Uri jms://servername:7001?URI=JMSProxyServiceRequest . Change the servername, the port number and change the Queue name.  That's enough to find the Queue.

The last step is to generate a Java Web Service Proxy client. Please read this blogpost how to generate a client.
This is the ANT Target I used to generate the client classes based on the WSDL
<target name="clientOSB">
  <clientgen wsdl="file:/c:/temp/jms/HelloworldNormal.wsdl"
             destdir="src" 
             packagename="nl.whitehorses.clientosb.jms"
             type="JAXRPC"/>
  <javac srcdir="src" 
         destdir="classes"
         includes="nl/whitehorses/clientosb/jms/**/*.java"/>
 </target>

And the java test client. If you change the WSDL Endpoint you don't need to set JmsTransportInfo
package nl.whitehorses.clientosb.jms;

import java.net.URISyntaxException;

import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;
import javax.xml.rpc.Stub;

import weblogic.wsee.connection.transport.jms.JmsTransportInfo;

public class TestService {

    public TestService() {
    }


    public static void main(String[] args) {

        try {
            HelloWorldServiceSoapHttpPortBindingQSService hello = new HelloWorldServiceSoapHttpPortBindingQSService_Impl();
            HelloWorldService port = hello.getHelloWorldServiceSoapHttpPortBindingQSPort();

            String uri = "jms://laptopedwin:7001?URI=JMSProxyServiceRequest";  
            JmsTransportInfo ti =  new JmsTransportInfo(uri);  
            ((Stub)port)._setProperty("weblogic.wsee.connection.transportinfo", ti);  
           
            System.out.println(port.sayHello());

        } catch (ServiceException e) {
            e.printStackTrace();
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
    }

}
Here you can download the OSB workspace.