RSS Feed for beginner
By subscribing to this Really Simple Syndication (RSS) feed, you can preview updates made to this space in any RSS reader or aggregator. RSS allows you to subscribe to feeds from several sources and automatically combines the information into one list. You can quickly browse the list without visiting each site to search for new information of interest to you.
Learn more about RSS
Subscribe to this feed in Live.com
Subscribe to this feed in an aggregator that supports one-click subscription
This time, we will begin to write some cases for calling our service.
Service:
package server;
public class SayHello
{
public String getName( String name )
{
return "hello " + name;
}
}
Client:
public class SimpleSayHelloClient
{
public static void main(String [] args) throws Exception {
String endpoint =
http://localhost:8080/learnws/services/SayHello;
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName("getName");
String res = (String) call.invoke(new Object[]{"GuanYabei"});
System.out.println(res);
}
}
Ok, we have finished our code,now we will publish the service.First, we have to write a .bat file named deploy.bat include words following that :
set Axis_Lib=E:\workspace\learnws\context\WEB-INF\lib
set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
set Axis_Servlet=http://localhost:8080/learnws/servlet/AxisServlet
%Java_Cmd% org.apache.axis.client.AdminClient -l%Axis_Servlet% deploy.wsdd
This .bat file exits under the src folder.
We can execute it and we will see a XML file called server-config.wsdd under the WEB-INF folder.
Well, now we can execute client code and we can see the words "hello GuanYabei".
We can generate cliend code by wsdl file as well. We can visite
http://localhost:8080/learnws/services to download the SayHello.wsdl. And then we need a .bat file to generate clinet code by this SayHello.wsdl.
The bat context is following this:
set Axis_Lib=E:\workspace\learnws\context\WEB-INF\lib
set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
set Output_Path=E:\workspace\learnws\src
set Package=server
%Java_Cmd% org.apache.axis.wsdl.WSDL2Java -o%Output_Path% -p%Package% SayHello.wsdl
the bat file called WSDL2Java.bat.
Executing WSDL2Java.bat, 4 files are generated. they are : SayHello_PortType.java , SayHelloService.java , SayHelloServiceLocator.java and SayHelloSoapBindingStub.java.
Now we can write client code like this:
package server;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
public class SayHelloClient
{
/**
* @param args
* @throws RemoteException
*/
public static void main( String[] args )
{
SayHelloService service = new SayHelloServiceLocator();
SayHello_PortType client = null;
try
{
client = service.getSayHello();
}
catch (ServiceException e)
{
e.printStackTrace();
}
String retValue = null;
try
{
retValue = client.getName("clientname");
}
catch (RemoteException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(retValue);
}
}
If everything is successful , we will see the words "hello clientname";
Published Date: 四, 09 八月 2007 00:42:19 GMT
Read the full itemUsing WSDD to publish your service.
We have shown the how to install and config the Axis for developping the WebServie before this lesson. And We wriet a simple test to show how to call the services we published, but we often publish our services by a wsdd file in practice instead of the way that turn *.java to *.jws. This time, We'll close to the practice and show how to use WSDD file to publish our services!
Now, you can set up a new project for your webservice, my porject's name is learnws(for short learning WebService). its directory structure follow that :
learnws
|--context
|--WEB-INF
| |--lib (axis jars)
| |--classes (your webservice classes)
|--src (your webservice code)
OK,please config your tomcat for publishing this webapp,and then copy necessary jars to directory lib.
Please config your web.xml like this:
<web-app>
<listener>
<listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
</listener>
<servlet>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>AdminServlet</servlet-name>
<servlet-class> org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>101</load-on-startup>
</servlet>
<servlet>
<servlet-name>SOAPMonitorService</servlet-name>
<display-name>SOAPMonitorService</display-name>
<servlet-class>org.apache.axis.monitor.SOAPMonitorService</servlet-class>
<init-param>
<param-name>SOAPMonitorPort</param-name>
<param-value>5001</param-value>
</init-param>
<load-on-startup>102</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SOAPMonitorService</servlet-name>
<url-pattern>/SOAPMonitor</url-pattern>
</servlet-mapping>
<!-- uncomment this if you want the admin servlet -->
<!--
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
-->
<session-config>
<!-- Default to 5 minute session timeouts -->
<session-timeout>5</session-timeout>
</session-config>
<!-- currently the W3C havent settled on a media type for WSDL;
http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft for now we go with the basic 'it's XML' response -->
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jws</welcome-file>
</welcome-file-list>
</web-app>
Well, Now, we need a service, the code follow this:
package server;
public class SayHello
{
public String getName( String name )
{
return "hello " + name;
}
}
OK, we should write a deploy.wsdd file for grenterating file server-config.wsdd. Axis will publish our services by server-config.wsdd.
deploy.wsdd :
We can write a deploy.bat file to generate the server-config.wsdd:
set Axis_Lib=E:\workspace\learnws\context\WEB-INF\lib
set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
set Axis_Servlet=http://localhost:8080/learnws/servlet/AxisServlet
%Java_Cmd% org.apache.axis.client.AdminClient -l%Axis_Servlet% deploy.wsdd
If you can see the wsdl, you have finished the first step!
Published Date: 一, 06 八月 2007 05:39:16 GMT
Read the full item Hibernate is one of the most popular OR-MAPING tool. At present, its last version is hibernate3.2.4. It is even as titile said, we do not tell you what is hibernate,but I will tell you how to use hibernate! OK, let's begin!
First, you need to download the hibernate3.2.4.zip and hibernate-tool-3.2.0.zip from the website
www.hibernate.org. And then you can unzip these zips.
Do you have the IDE-Eclipse? If you don't ,you need download it (We suggest you to download eclipse-3.2.2).
Copy all of the files that we unzip to hibernate-tool-3.2.0.zip to directory "configuration" and "features" under the eclipse home ? No, we needn't do it. We have another way!
We can make a dirctory "links" under the eclipse-home and make a file. The make file and its name is HibernateTools-3.2.0.beta9a.link.(attention: .link is necessary). The Context of the file is your hibernate-tool-3.2.0's path for example:path=D:\\extends_pugins\\HibernateTools-3.2.0.beta9a (my hibernate-tools folder is HibernateTools-3.2.0.beta9a).
Well, now, you can start up the Eclipse and you can see the 4 items from the New. Those are Hibernate XML Mapping file, Hibernate Configuration File, Hibernate Console Configuration and Hibernate Reverse Configuration.
Now, you should set up a project for hibernate in Eclipse. And then, load all of hibernate jars to your lib path. You can set up a DateBase for using hiberate to visite it.
OK, We have a rest, See you next lesson. bye!
Published Date: 二, 31 七月 2007 03:33:30 GMT
Read the full item Recently, I found my mood was not good. I didn't know when it was, I have even started to worried about my future!
What did I want? What did I need? Who can I be wanted? Maybe, I could tell your these answers many years ago, but now, I don't know really.
I have known that I must keep persistent efforts forever. I have known that I am never a lucky boy. Certainly, I have even known that I should believe in myself and my faith. But now, face to my current conditions, who can tell me how can I do?!
Now my job is very easy. It is too easy to set my heart at rest! But I don't need a rest, frankly speaking, I need more money, I need more money that was even my value and ability! I think I need a room which I can show myself!
Maybe I understand how can I do , maybe or not......
I pray... I pray that the God blesse me! I don't expect that I will turn to a lucky boy, I do only expect that my repayment will be even my payment!
All of words both are nonsense!
Published Date: 一, 30 七月 2007 15:01:56 GMT
Read the full itemLast time We have showed how to install and config the axis1.4. Today we will continue the WebService trip!
As you know, this time, we will show how to develop a simple webservice application. We will use the case of HelloWorld.
1. coding a webservice application
public class HelloWorld
{
public String getName( String name )
{
return "hello " + name;
}
}
We will copy the file HelloWorld.java to AXIS_HOME and turn HelloWorld.java to HelloWorld.wsdl. And then, we will restart the Tomcat before visiting URL
http://localhost:8080/axis/HelloWorld.jws?wsdl.
You will see a page that display a XML context. The page context is WSDL,it told we what functions were offered by WebService.
ATTENTION :
Don't setup the java file in a package.
2. coding client and visit HelloWorld by DII.
If we use DII to visit HelloWorld, we should find operation name and parameterOrder from the page.
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class SayHelloClient
{
public static void main( String[] args )
{
String point = "
http://localhost:8080/axis/HelloWorld.jws";
Service service = new Service();
try
{
Call call = null;
call = (Call) service.createCall();
call.setOperationName(new QName(
point, "getName"));//提供方法名
call.setTargetEndpointAddress(new java.net.URL(point));//提供接口地址
String ret = (String) call.invoke(new Object[]
{ "GuanYabei" });//提供接口参数
System.out.println("return value is " + ret);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Now you can run this application via your IDE, you can see a word "return value is hello GuanYabei".
Published Date: 三, 25 七月 2007 02:13:09 GMT
Read the full itemAt present, there are two version axis(axis1.x and axis2) in Apache.
But we should understand the axis2 is not update version of axis1.x, so they are different each other.
I will introduce Axis1.4 to my viewers. ^_^
Installation And Configuration
2. unzip axis-bin-1_4.zip and copy webapps\axis to tomcat\webapps\
3. unzip axis-src-1_4.zip and copy lib\activation.jar to tomcat\common\lib\
unzip javamail-1_4.zip and copy mail.jar to tomcat\common\lib\
upzip xml-security-bin-1_3_0.zip and copy lib\xmlsec-1.3.0.jar to tomcat\common\lib
copy JDK_HOME\lib\tool.jar to tomcat\common\lib\
4. start up Tomcat and visit
http://127.0.0.1:8080/axis you can see the Apache-AXIS page and click validation link.
if you can see Axis Happiness Page without "Not Found words", you are successful.
5. config envionment variables
TOMCAT_HOME=D:\Program Files\Apache Software Foundation\Tomcat 5.5
AXIS_HOME=D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\axis
AXIS_LIB=%AXIS_HOME%\WEB-INF\lib
AXISCLASSPATH=.;%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery-0.2.jar;%AXIS_LIB%\commons-logging-1.0.4.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%axis-ant.jar;%TOMCAT_HOME%\common\lib\activation.jar
Published Date: 二, 24 七月 2007 06:24:35 GMT
Read the full itemLast Saturday, I bought a new glasses to instead of old one with me 5 years. The new glasses costed me 230 yuan, my friend, ZhuXixi, help me for choosing it. I like it very much.
The glasses' material is steel. In fact, I think titanium is better than steel, but all glasses style that was made in titanium did not apply me! So, at last, I bought the steel one. I think it looks good very well. its style suited my face. But my friend said I looks like PangLong(a singer and I don't like him),it spoils me -_-!
Now I hope I can bought the second glasses that was made in titanium.
Published Date: 二, 24 七月 2007 01:28:45 GMT
Read the full itemIn the afternoon, I went to the TIBCAL Company and entered for an interview.To my surprise, the position was Technique Supported. Frankly speaking, I didn't even know what to do about that position. The interview was not all right. I had to talk about all words in English. But I knew that my English is very poor. At last, that man tested me had to talk with me in Chinese. I felt shame! Of course, if I only came up against this occasion, I thought I may not feel too bad. Today, July 12th 2007 year, I filed in my knowledge that I am proud of. I did not perfectly answer any question. In fact, some knowledge points were not held by myself too. I need learn more things about software technology and developing skill.
In spite of this, I was not discouraged. I knew this way is very long! I must make persistent effort!
Published Date: 四, 12 七月 2007 06:23:30 GMT
Read the full itemI has wanted to have a notebook-computer('NB' for short) myself since I was still a student at the college. But I did not have enough money to afford to pay it. Now, I earn money more and more, but I find that I can't still afford to pay it because of some reason. Then I changed my mind and I hoped that my firm can buy a NB to me. But it does not come true.
I dream of having a NB myself. Frankly speaking, I did not think it is only a dream for me in the past. Now I have still believed in that. So I need do my best to earn more money for my dream.
In fact,I think, I'm not really interested in having a NB. I am only interested in the thing that I do make great efforts for my dreams coming true.
Published Date: 六, 07 七月 2007 14:18:33 GMT
Read the full item How can you understand that new sky usually is outside house.
How can you understand that lover may not apply to gathering.
How can you understand that losing love is not the incurable disease but only an ache.
How can you understand that she needn’t follow you forever , in spite of accompanying you in the past.
How can you understand that concern of friends is not all of sweet talk.
How can you understand that people who you don’t like to rap to concern you very much.
How can you understand that people who you depend on don’t love you sometimes.
How can you understand that you don’t catch up with her because she don’t want to be caught by you.
How can you understand that you don’t hold her by bearing and connivance.
How can you understand that being lonely doesn't belong to the love.
How can you understand that you should not be punished for her fault.
How can you understand that one person who love you indeed is waiting you at a distance.
The meaning of being lonely is that love is closing to you.
note:
incurable disease : 绝症
sweet talk : 甜言蜜语
rap to : 与….说话,搭理....
bearing and connivance : 忍受与纵容
indeed : 真正地
for you ,for me ,for everyone.
Published Date: 二, 03 七月 2007 13:43:57 GMT
Read the full item
What is the most valuable program language? you mast have your own answer. let me guess it.
mybe you can tell me that it is C++. well,if you can develop softwares or any applications by it, you will get a good salary! but how much ? I can tell you, 10000 yuan to 15000 yuan for common developers.
mybe you can tell me that it is Java or C#(C sharp). good, beyond all doubt,they are the most popular program language now. but C++'s value is lager than theirs.
in fact, I asked the same question to others. I do get the true answer is PPT (microsoft office power point). Why it is? We do not develop any softwares with it. Of course, you are right. but the thing that we are talking about is language's value and is not language's function. so if PPT compared with other program language from valuable aspect,it is the most valuable language.
the reason is very simple! other program language can give you a good salary for your job, but I think its value is too small! If you are good at writing PPT, you can obtain the big capital from investors. that's pretty penny!
do you understand now?
note:
pretty penny : a lot of money
Published Date: 五, 29 六月 2007 15:45:02 GMT
Read the full item Last weekend I enjoyed an exciting trip with my friends. This is twice to visited Xingcheng. Last time we enjoyed the trip in last year of October. We arrived at the railway station of Calabash-island City by train in the early morning. Than We went to the Xingcheng City by car. The car covered distance in 30 minutes from Calabash-island to Xingcheng City.
We arrived at seashore first. I think I like the sea but I can’t swimming. We sat the sand beach and sang. The sky was very dark. I could not see any thing and only hear the sea.
if you ask me what is interesting for me, I can say “eating shrimps!”. We bought a lot of fresh shrimps from fisherfolks. The shrimp’s price is cheaper than Beijing’s. We ate many shrimp. It’s very delicious!
On Sunday We visited Xingcheng by car. We visited the ancestral wall and nearly every shops. My friend ZhuXixi bought a few of seashell. She like it very much. She had a great many of beautiful seashell. I think her room must be a seashell-museums.
At last We went home by train. We have a good time!
note:
Calabash-island 葫芦岛
shrimp 虾
Published Date: 四, 28 六月 2007 05:58:15 GMT
Read the full item