Uncategorized

Creating JAXWS Service in WebLogic Workshop

Hi,

Jay SenSharma

Jay SenSharma

Here is a simple demo which explains how we can create a Complex JAXWS WebService using WebLogic Workshop.  Most of the instractions are mentioned in the below images, so nothing much to explain.

This example also demonstrates how we can export the JAXWS WebService WAR file from the WebLogic Workshop.

Step1).  Creating a WebService Project.

JAXWS_Workspace_Creation

JAXWS_Workspace_Creation

Creating_Project_In_Workshop

Creating_Project_In_Workshop

Chosing_Webservice_Project

Chosing_Webservice_Project

Other_Project_Facets

Other_Project_Facets

Project_WebModule_Next

Project_WebModule_Next

Step2). Coding BasicStruct.java code.

Creating_SimpleClass

Creating_SimpleClass

BasicStruct

BasicStruct

BasicStruct_Code

BasicStruct_Code

package misc;
public class BasicStruct {
	  private int intValue;
	  private String stringValue;
	  private String[] stringArray;
	  public int getIntValue() {
	    return intValue;
	  }
	  public void setIntValue(int intValue) {
	    this.intValue = intValue;
	  }
	  public String getStringValue() {
	    return stringValue;
	  }
	  public void setStringValue(String stringValue) {
	    this.stringValue = stringValue;
	  }
	  public String[] getStringArray() {
	    return stringArray;
	  }
	  public void setStringArray(String[] stringArray) {
	    this.stringArray = stringArray;
	  }
	  public String toString() {
	    return "IntValue="+intValue+", StringValue="+stringValue;
	  }
	}

Step3). Creating WebService.

Creating_WebService

Creating_WebService

Creating_ComplexJAXWS_Service

Creating_ComplexJAXWS_Service

Complex_JAXWS_Code

Complex_JAXWS_Code

package ws;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.Oneway;
import javax.jws.soap.SOAPBinding;

import misc.BasicStruct;
@WebService(serviceName="ComplexService",name="ComplexPortType",targetNamespace="http://middlewaremagic")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,use=SOAPBinding.Use.LITERAL,
             parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
public class ComplexJAXWS {
  @WebMethod()
  @Oneway
  public void echoVoid() {
    System.out.println("ntechoVoid called");
  }

  @WebMethod()
  @WebResult(name="EchoStructReturnMessage", targetNamespace="http://middlewaremagic/docLiteralBare")
  public BasicStruct echoStruct(BasicStruct struct){
    System.out.println("nt echoStruct called");
    return struct;
  }
}

Step4). Exporting  JAXWS Project WAR.

Exporting_WAR_File_For_JAXWS

Exporting_WAR_File_For_JAXWS

Exported_WAR_Location

Exported_WAR_Location

Step5). Running The WebService and Accessing WSDL: http://localhost:7001/TestJAXWSProject/ComplexService?wsdl

Running_JAXWS_On_Server

Running_JAXWS_On_Server

Choose_Correct_Server

Choose_Correct_Server

Chosing_Deployment_Domain

Chosing_Deployment_Domain

  <?xml version="1.0" encoding="UTF-8" ?>
- <!--  Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.3-07/10/2008 08:41 PM(bt).
  -->
- <!--  Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.3-07/10/2008 08:41 PM(bt).
  -->
- <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://middlewaremagic" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://middlewaremagic" name="ComplexService">
- <types>
- <xsd:schema>
  <xsd:import namespace="http://middlewaremagic/docLiteralBare" schemaLocation="http://localhost:7001/TestJAXWSProject/ComplexService?xsd=1" />
  </xsd:schema>
- <xsd:schema>
  <xsd:import namespace="http://middlewaremagic" schemaLocation="http://localhost:7001/TestJAXWSProject/ComplexService?xsd=2" />
  </xsd:schema>
  </types>
- <message name="echoVoid">
  <part name="parameters" element="tns:echoVoid" />
  </message>
- <message name="echoStruct">
  <part name="parameters" element="tns:echoStruct" />
  </message>
- <message name="echoStructResponse">
  <part name="parameters" element="tns:echoStructResponse" />
  </message>
- <portType name="ComplexPortType">
- <operation name="echoVoid">
  <input message="tns:echoVoid" />
  </operation>
- <operation name="echoStruct">
  <input message="tns:echoStruct" />
  <output message="tns:echoStructResponse" />
  </operation>
  </portType>
- <binding name="ComplexPortTypePortBinding" type="tns:ComplexPortType">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <operation name="echoVoid">
  <soap:operation soapAction="" />
- <input>
  <soap:body use="literal" />
  </input>
  </operation>
- <operation name="echoStruct">
  <soap:operation soapAction="" />
- <input>
  <soap:body use="literal" />
  </input>
- <output>
  <soap:body use="literal" />
  </output>
  </operation>
  </binding>
- <service name="ComplexService">
- <port name="ComplexPortTypePort" binding="tns:ComplexPortTypePortBinding">
  <soap:address location="http://localhost:7001/TestJAXWSProject/ComplexService" />
  </port>
  </service>
  </definitions>

.

.

Thanks

Jay SenSharma


A Best Place to Visualize WebLogic

Hi,

We always wanted to see a place where we could see all the demos and features and presentations on Oracle Products in Visual form. To see how weblogic/coherence/JRockit…  works with it’s all beauty… and to see the features of weblogic by different visual walk through.

The Great thing about above link is….Here you can hear about the of weblogic features from the WebLogic Experts like:
James Bayer, Jeffrey West, Nigel Deakin……And a Lots of Middleware Super Stars

You can refer to the following link:

http://www.youtube.com/OracleWebLogic

WebLogic Demos are now available on YouTube…  Like Coherence,  JRockit, WebLogic, JMS…etc.

Features:

You can register and share demos.

You can share your  thoughts in form of Comments and request other member of this group to help you out in case you need some visual demos.

Above Link provides you a kind of Visual Forum (much better than Textual Forums) to see the things happening.



.

.

Thanks

Jay SenSharma


Changing Session-timeout using plan.xml

Hi,

Jay SenSharma

Jay SenSharma

As a WebLogic Administrator Many times we want to make some changes in the application provided by the Development team. But it is not good for a WebLogic Administrator to make changes in the application archieve provided by the Application Development team. But to fulfill some environmental requirements the Administartor has to make some changes in the application.

WebLogic provides a best way for the WebLogic Administrators to alter the different Tags present inside the Application deployment descriptors like adding a new Tag or replacing a value of a Tag mentioned in the “web.xml” or in “weblogic.xml” or in any of the deployment descriptor like “weblogic-ejb-jar.xml”,”application.xml”, “weblogic-application.xml”…etc.

In this example we are going to see how can we change the <session-timeout> of a Web Application without even altering the “web.xml” physically…On the fly

Step1). Deploy your Application as it is at present on the Server. Suppose your Web Application name is “SessionTimeoutWebApp” (I am assuming it as a Exploded WAR file you can work with Archived WAR file as well in the same way)

Step2). Anywhere in your file system Just paste the following “plan.xml” file: (Suppose Location is “F:SessionTimeout_PlanDemo” )

<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-deployment-plan.xsd" global-variables="false">

   <application-name>SessionTimeoutWebApp</application-name>     <!-- You need to change this Line and Put your Web Application Name -->
	<variable-definition>
		<variable>
			<name>NewSessionValue</name>
			<value>100000</value>
		</variable>
	</variable-definition>

   <module-override>
	<module-name>SessionTimeoutWebApp</module-name>      <!-- You need to change this Line and Put your Web Application Name -->
	<module-type>war</module-type>
	<module-descriptor external="true">
		<root-element>web-app</root-element>
		<uri>WEB-INF/web.xml</uri>
		<variable-assignment>
			<name>NewSessionValue</name>
			<xpath>/web-app/session-config/session-timeout</xpath>
		</variable-assignment>
	</module-descriptor>
    </module-override>
    <config-root>F:SessionTimeout_PlanDemo</config-root>  <!-- You need to change this Line and Put the location of plan.xml file wherever u have pasted it -->
</deployment-plan>

Step3). Login to AdminConsole and goto deployments page—-> the select your Application (After Pressing Lock & Edit Button) –> update (click this button)—> browse your “plan.xml” file location and then finish.
Once the changes will be activated ….Next time your will see that your <session-timeout> value is changed  from the AdminConsole or through any other technique like JMX or WLST.

.
.
Thanks
Jay SenSharma


Copyright © 2010-2012 Middleware Magic. All rights reserved. |