# LuckyNumberControl.jcx Sample

This topic inludes the source code for the LuckyNumberControl.jcx Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/database/lucky_number_db/

## Sample Source Code

`001 package database.lucky_number_db; 002 003 /** 004 * <p>A simple web service that shows how to create an exposed method that returns a value.</p> 005 * @jc:location http-url="LuckyNumber.jws" jms-url="LuckyNumber.jws" 006 * @jc:wsdl file="#LuckyNumberWsdl" 007 * @editor-info:link autogen-style="java" source="LuckyNumber.jws" autogen="true" 008 */ 009 public interface LuckyNumberControl extends com.bea.control.ControlExtension, com.bea.control.ServiceControl 010 { 011 012 /** 013 * <p>Returns a lucky number to the client.</p> 014 */ 015 public int getLuckyNumber (); 016 017 static final long serialVersionUID = 1L; 018 } 019 020 /** @common:define name="LuckyNumberWsdl" value:: 021 <?xml version="1.0" encoding="utf-8"?> 022 <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://workshop.bea.com/LuckyNumber" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://workshop.bea.com/LuckyNumber"> 023 <types> 024 <s:schema elementFormDefault="qualified" targetNamespace="http://workshop.bea.com/LuckyNumber" xmlns:s="http://www.w3.org/2001/XMLSchema"> 025 <s:element name="getLuckyNumber"> 026 <s:complexType> 027 <s:sequence/> 028 </s:complexType> 029 </s:element> 030 <s:element name="getLuckyNumberResponse"> 031 <s:complexType> 032 <s:sequence> 033 <s:element name="getLuckyNumberResult" type="s:int"/> 034 </s:sequence> 035 </s:complexType> 036 </s:element> 037 <s:element name="int" type="s:int"/> 038 </s:schema> 039 040 </types> 041 <message name="getLuckyNumberSoapIn"> 042 <part name="parameters" element="s0:getLuckyNumber"/> 043 </message> 044 <message name="getLuckyNumberSoapOut"> 045 <part name="parameters" element="s0:getLuckyNumberResponse"/> 046 </message> 047 <message name="getLuckyNumberHttpGetIn"/> 048 <message name="getLuckyNumberHttpGetOut"> 049 <part name="Body" element="s0:int"/> 050 </message> 051 <message name="getLuckyNumberHttpPostIn"/> 052 <message name="getLuckyNumberHttpPostOut"> 053 <part name="Body" element="s0:int"/> 054 </message> 055 <portType name="LuckyNumberSoap"> 056 <operation name="getLuckyNumber"> 057 <documentation>&lt;p&gt;Returns a lucky number to the client.&lt;/p&gt;</documentation> 058 <input message="s0:getLuckyNumberSoapIn"/> 059 <output message="s0:getLuckyNumberSoapOut"/> 060 </operation> 061 </portType> 062 <portType name="LuckyNumberHttpGet"> 063 <operation name="getLuckyNumber"> 064 <documentation>&lt;p&gt;Returns a lucky number to the client.&lt;/p&gt;</documentation> 065 <input message="s0:getLuckyNumberHttpGetIn"/> 066 <output message="s0:getLuckyNumberHttpGetOut"/> 067 </operation> 068 </portType> 069 <portType name="LuckyNumberHttpPost"> 070 <operation name="getLuckyNumber"> 071 <documentation>&lt;p&gt;Returns a lucky number to the client.&lt;/p&gt;</documentation> 072 <input message="s0:getLuckyNumberHttpPostIn"/> 073 <output message="s0:getLuckyNumberHttpPostOut"/> 074 </operation> 075 </portType> 076 <binding name="LuckyNumberSoap" type="s0:LuckyNumberSoap"> 077 <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 078 <operation name="getLuckyNumber"> 079 <soap:operation soapAction="http://workshop.bea.com/LuckyNumber/getLuckyNumber" style="document"/> 080 <input> 081 <soap:body use="literal"/> 082 </input> 083 <output> 084 <soap:body use="literal"/> 085 </output> 086 </operation> 087 </binding> 088 <binding name="LuckyNumberHttpGet" type="s0:LuckyNumberHttpGet"> 089 <http:binding verb="GET"/> 090 <operation name="getLuckyNumber"> 091 <http:operation location="/getLuckyNumber"/> 092 <input> 093 <http:urlEncoded/> 094 </input> 095 <output> 096 <mime:mimeXml part="Body"/> 097 </output> 098 </operation> 099 </binding> 100 <binding name="LuckyNumberHttpPost" type="s0:LuckyNumberHttpPost"> 101 <http:binding verb="POST"/> 102 <operation name="getLuckyNumber"> 103 <http:operation location="/getLuckyNumber"/> 104 <input> 105 <mime:content type="application/x-www-form-urlencoded"/> 106 </input> 107 <output> 108 <mime:mimeXml part="Body"/> 109 </output> 110 </operation> 111 </binding> 112 <service name="LuckyNumber"> 113 <documentation>&lt;p&gt;A simple web service that shows how to create an exposed method that returns a value.&lt;/p&gt;</documentation> 114 <port name="LuckyNumberSoap" binding="s0:LuckyNumberSoap"> 115 <soap:address location="http://localhost:7001/database/LuckyNumber.jws"/> 116 </port> 117 <port name="LuckyNumberHttpGet" binding="s0:LuckyNumberHttpGet"> 118 <http:address location="http://localhost:7001/database/LuckyNumber.jws"/> 119 </port> 120 <port name="LuckyNumberHttpPost" binding="s0:LuckyNumberHttpPost"> 121 <http:address location="http://localhost:7001/database/LuckyNumber.jws"/> 122 </port> 123 </service> 124 </definitions> 125 * :: 126 */`