<center><b><u>Consuming .NET Webservice in EP 5.0</u></b></center>
Creating webservices in .NET is simple and the added advantage of this is the WSDL and the supporting webservice
functionalities are also created automatically when the project is compiled. This weblog describes how to consume these webservices
in Portal Component. This article will serve good for applications whose middle tier are written using .NET Webservice and UI layer is
Enterprise Portal.
Invoking .NET Webservice from Java iView:
Webservices which are developed in .NET can be integrated and accessed in Enterprise Portal using Proxy classes. These
proxy classes can be generated using Apache Axis which is the SOAP Implementation provided by Axis. The funtionality of getting the
proxy classes can be achieved by using the plug-in available for eclipse which generates the java proxy classes from the WSDL file.
From Portal Developer perspective, the following are the details we need to know to access webservices from iView.
-
Webservice Url.
- Web methods defined within the webservice with their input and output parameters.
Next, we need to generate the proxy classes that will take care of processing XML and SOAP messaging and will be used from the
DynPage/JspDynPage code to access the Webservice deployed. Ways to generate proxy classes –
- Use WSDL2Java
Plug-in for Eclipse.
- Use Apache Axis.
Once the proxy classes are created, bundle them into a .jar file that we can use within the portal project by adding the .jar file in build
path. Now we need to develop wrapper classes to access these Proxy classes.
DynPage and JspDynPage can access these Wrapper classes to in turn call the webservices.
Lets see each of these steps in details.
1. Develop a simple webservice application in Visual C# which accepts the user name and return a welcome message!
Things you need to consume this webservice in an iView –
- Webservice Url (http://localhost/WebServicePrj/WSService.asmx?)
<fileset dir="$">
<pathelement location = "$"/>
<pathelement location = "$"/>
</path>
<path id = "cp_run">
<pathelement location = "$"/>
<pathelement location = "$"/>
<pathelement location = "$"/>
<path refid = "cp"/>
</path>
<target name = "clean"><!-- Delete the $ and $ directory trees -->
<delete dir = "$"/>
<delete dir = "$"/>
<mkdir dir = "$"/>
</target>
<target name = "compile" depends = "prepare"> <!-- Compile the java code from $ into $ -->
<javac srcdir = "$" destdir = "$" debug = "on">
<classpath> <path refid = "cp"/> </classpath>
</javac>
</target>
<target name = "doc" depends = "compile"> </target>
<target name ="createJar" depends = "compile">
<mkdir dir = "$"/>
<jar jarfile = "$/WebServices.jar" basedir = "$"/>