You are on page 1of 3

Hong Minh Tun hoangtuan.cntt@gmail.

com

Ti liu v Webservice trong Java p dng vi AfoliActivationWebService trn window


1, Cc cng c cn thit Download v ci t JDK (jdk-7u5-windows-x64) Download Eclipse J2EE Download v ci t Tomcat 7 Download Axis2 bao gm:

2, Thit lp eclipse v bin mi trng trong window Thit lp JAVA_HOME, TOMCAT_HOME, AXIS2_HOME trong system variable Trong phn cu hnh user variables for user: Add thm bn ghi: + variavle: PATH + VALUE: %JAVA_HOME%\bin

Trong Eclipse sau khi copy cc plugin y . Tin hnh cu hnh +Java\Installed JRE (chn ng path ci JRE trn my) + Server Runtime Environment + Tomcat (nu ci plugin Tomcat) + web service 3, To web service

Hong Minh Tun hoangtuan.cntt@gmail.com A, To web service B1: To java application nh bnh thng ri chy th. Nu OK ri th thc hin bc 2 B2: Chut phi vo file c .java c cha method mun tr thnh service operator. Chn New\Other. Trong Axis2 wizard (mc ny s c khi ci 2 plugin tng ng)chn axis2 service archive ri c nhn next (tick chn vo .include class file only v tick chn skip wsdl) n mc chn ng dn gii nn, ta chn ng dn \ApacheTomcat7\webapps\axis2\WEB-INF\services Sau vo Tomcat\bin. G lnh startup, web service s chy B, Invoke 1 webservice Search nhng tutorial v web service client in java using axis. Nguyn l hot ng l t file wsdl -> java stub. Sau khi c dc cc file java m axis gen t wsdl ta tin hnh call service nh sau: (y l 1 v d minh ha)
proxy=new MTServicePortTypeProxy(); request=proxy.getMTServicePortType(); do { status=request.sendMT(userId, message, serviceId, commandCode, messageType, requestId, contentType, username, password); counter++; Thread.currentThread(); Thread.sleep(2000); //pause 2s } while (status == -1 && counter < 8);

4, Deploy project web service

Copy folder Configure vo trong folder bin ca Tomcat Copy ton b library trong project vo folder \ApacheTomcat7\webapps\axis2\WEB-INF\lib (Ch : trong library ca project nh add thm ton b th vin ca axis1. Vic ny phc v cho vic Invoke service) Disable log mc nh ca axis bng cch: Vo folder \ApacheTomcat7\webapps\axis2\WEB-INF\classes Edit file: commons-logging.properties thnh ni dung sau: (Enable dng:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog

V disable tt c cc dng cn li)

Hong Minh Tun hoangtuan.cntt@gmail.com


# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # This is the logging properties that goes to the war, there are two logging conf kept at the # svn, one for developement (one at src/test-resources) and other for producation # Uncomment the next line to disable all logging. org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog # Uncomment the next line to enable the simple log based logging #org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog # Uncomment the next line to enable log4j based logging #org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger

You might also like