// ¾È³çÇϼ¼¿ä ±è¿µ´ë ( http://www.howto.pe.kr ) ÀÔ´Ï´Ù
// ¾Æ·¡´Â JAVA ȯ°æ¿¡¼ SOAP,WSDL,UDDI °ú °ü·ÃµÈ ÆÄÀÏÀ» ¼³Ä¡ÇÏ°í ½Ç½ÀÇÏ´Â
// ³»¿ëÀ¸·Î JWSDP ¶Ç´Â Apache Tomcat ÀÌ ¼³Ä¡µÇ¾î ÀÖÀ¸¸ç XMLÆļ Xerces °¡
// ¼³Ä¡µÇ¾î ÀÖ´Ù°í °¡Á¤ÇÏ°í ÁøÇàµË´Ï´Ù
[SOAP - axis]
1.http://xml.apache.org/axis/dist/1_0/ ¿¡¼ xml-axis-10.zip ÆÄÀÏÀ» ´Ù¿î¹Þ¾Æ ÀÓÀÇÀÇ
µð·ºÅ丮¿¡ ¾ÐÃàÀ» Ǭ´Ù(¾ÐÃàÀ» Ǭ µð·ºÅ丮°¡ ÀÌÇÏ "<¾ÐÃàÀ» Ǭ axis>" ¸¦ ÀǹÌÇÑ´Ù)
2.<¾ÐÃàÀ» Ǭ axis>webappsaxislib µð·ºÅ丮¿¡ ÀÖ´Â ¸ðµç jar ÆÄÀϵéÀ»
<Apache Tomcat>commonlib µð·ºÅ丮·Î º¹»çÇÑ´Ù - »ý·«°¡´É
3.<¾ÐÃàÀ» Ǭ axis>lib µð·ºÅ丮ÀÇ ¸ðµç jar ÆÄÀϵéÀ» <J2SDK>jrelibext µð·ºÅ丮¿¡ º¹»çÇÑ´Ù
4.<Apache Tomcat>comminlib ÀÇ servlet.jar ¸¦ <J2SDK>jrelibext µð·ºÅ丮¿¡ º¹»çÇÑ´Ù
5.<¾ÐÃàÀ» Ǭ axis>webappsÀÇ axis µð·ºÅ丮¸¦ <Apache Tomcat>webapps µð·ºÅ丮¿¡ ¾Æ·¡¿¡ º¹»çÇÑ´Ù.
6.<Apache Tomcat>confserver.xml ÆÄÀÏÀ» ÀÏ¹Ý ¿¡µðÅÍ·Î ¿¾î 265 ÇàÀ» ¾Æ·¡Ã³·³ °íÄ£´Ù
<Context path="" docBase="ROOT" debug="0"/>
<Context path="/axis" docBase="axis" debug="0" reloadable="true" />
7.Apache TomcatÀ» ½ÇÇàÇÑ´Ù
8.http://localhost:8080/axis/index.html ¸¦ ¹æ¹®ÇÏ¿© "Hello! Welcome to Apache-Axis"
¸¦ È®ÀÎ, ȸéÀÇ "Validate the local installation's configuration" ºÎºÐÀ» Ŭ¸¯ÇÑ´Ù
ÀÌ°ÍÀº axis ¸¦ À§ÇÑ core ¶óÀ̺귯¸®¿Í ¿É¼Ç ÄÞÆ÷³ÍÆ®°¡ Á¤È®È÷ ¼³Ä¡µÇ¾ú´ÂÁö
°Ë»çÇϴ°ÍÀ¸·Î core ´Â ¹Ýµå½Ã ¼³Ä¡µÇ¾î ÀÖ¾î¾ß ÇÏ¸ç ¿É¼ÇÀ̶ó ÇÏ´õ¶óµµ ÀϺΠ½ÇÇàÀÌ ¾ÈµÇ´Â
°æ¿ì°¡ ÀÖÀ¸¹Ç·Î ¿¡·¯ ¸Þ½ÃÁö¸¦ Âü°íÇÏ¿© ¶óÀ̺귯¸®¸¦ È®ÀÎÇÑ ÈÄ ¼³Ä¡ÇÑ´Ù
(¾Æ·¡´Â Á¤È®È÷ ¼³Ä¡µÈ °æ¿ìÀÇ ¸Þ½ÃÁöÀÌ´Ù)
The core axis libraries are present. The optional components are present.
(¶óÀ̺귯¸® Ãß°¡¼³Ä¡°¡ ÇÊ¿äÇϸé)
1.XML Security API: http://xml.apache.org/security/index.html ¿¡¼
xml-security-bin-1_0_4.zip ¸¦ ´Ù¿î¹Þ¾Æ ¾ÐÃàÀ» Ç®°í, xmlsec.jar ÆÄÀÏÀ»
<J2SDK>jrelibext µð·ºÅ丮¿¡ º¹»çÇÑ´Ù
2.¼³Ä¡ÈÄ axis °ü·Ã ÇÁ·Î±×·¥À» ½ÇÇàÇÒ ¶§ activation.jar, mail.jar, servlet.jar,
xerces.jar µîÀ» ¸ø ã´Â ¸Þ½ÃÁö°¡ ³ª¿Ã ¶§´Â ÇØ´ç ÆÄÀÏÀ» ã¾Æ <J2SDK>jrelibext
¿¡ º¹»çÇØ ³Ö´Â´Ù
9.À¥¼ºñ½º ¼¹ö ÇÁ·Î±×·¥ ¸¸µé±â
¾Æ·¡ÀÇ À¥¼ºñ½º ¼¹ö ÇÁ·Î±×·¥ ¿¹Á¦¸¦ ÆíÁýÇÏ¿© Factorial.jws ·Î
<Apache Tomcat>webappsaxis ¿¡ ÀúÀåÇÑ´Ù
public class Factorial {
public long getFactorial(int n) {
if(n <= 0)
return 1;
else
return n * getFactorial(n-1);
}
public String getVersion() {
return "1.0.0";
}
}
±× ´ÙÀ½ http://localhost:8080/axis/Factorial.jws?method=getVersion À» ¹æ¹®ÇÏ¿©
Factorial.jwsÀÇ getVersion ¸Þ¼Òµå¸¦ È£ÃâÇÏ¸é ¾Æ·¡¿Í °°Àº ÀÀ´äÀÌ ¿À¸é Á¤»óÀÌ´Ù
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getVersionResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<getVersionReturn xsi:type="xsd:string">1.0.0</getVersionReturn>
</getVersionResponse>
</soapenv:Body>
</soapenv:Envelope>
[WSDL - axis]
1.Å×½ºÆ®¸¦ À§ÇÏ¿© ÀÓÀÇÀÇ µð·ºÅ丮¸¦ ¸¸µç´Ù(¿©±â¼´Â c:factorial À̶óÇÔ)
±× ÇÏÀ§¿¡ server ¿Í client µð·ºÅ丮¸¦ ¸¸µç´Ù
2.http://localhost:8080/axis/Factorial.jws?wsdl À» ¹æ¹®ÇÏ¿© ÀÚµ¿ »ý¼ºµÈ WSDL ¹®¼¸¦
È®ÀÎÇÑ ÈÄ À¥ºê¶ó¿ìÀúÀÇ "View Source" ¸Þ´º¸¦ ÀÌ¿ëÇÏ¿© c:factorial ¿¡ Factorial.wsdl
À̶ó´Â À̸§À¸·Î ÀúÀåÇÑ´Ù
3.WSDL ÆÄÀÏÀ» ÀÚ¹Ù ÇÁ·Î±×·¥À¸·Î ÀÚµ¿ »ý¼º½ÃÅ°´Â ¹èÄ¡ÆÄÀÏ wsdl2java.bat À» ¸¸µé¾î
<J2SDK>bin ¿¡ º¹»çÇÑ´Ù
@echo off
rem WSDL -> Java
rem »ç¿ë¹ý: wsdl2java <WSDLÆÄÀÏ>
java org.apache.axis.wsdl.WSDL2Java %1 %2 %3 %4 %5 %6 %7 %8
4.c:factorial ·Î À̵¿ÇÏ¿© ¾Æ·¡ ¸í·É¾î·Î ÀÚ¹Ù ÆÄÀϵéÀ» ¸¸µç´Ù
> wsdl2java -o client Factorial.wsdl
4 °³ÀÇ ÆÄÀϵéÀÌ clientlocalhost ¿¡ »ý¼ºµÈ´Ù
Factorial.java
FactorialService.java
FactorialServiceLocator.java
FactorialSoapBindingStub.java
client µð·ºÅ丮·Î À̵¿ÇÏ¿© ÄÄÆÄÀÏÇÑ´Ù
> javac -d . localhost/*.java
5.¾Æ·¡ÀÇ ¿¹Á¦¸¦ ÆíÁýÇÏ¿© FactClient.java ¶ó´Â À̸§À¸·Î client µð·ºÅ丮¿¡ ÀúÀåÇÏ¿©
ÄÄÆÄÀÏÇÑ ÈÄ ½ÇÇàÇÏ¿© http://localhost:8080/axis/Factorial.jws ÀÇ
getFactorial() ¸Þ¼Òµå°¡ È£ÃâµÇ°í °á°ú°¡ ³ªÅ¸³ª´ÂÁö È®ÀÎÇÑ´Ù
import localhost.*;
public class FactClient {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("usage: java FactClient <num>");
System.exit(1);
}
try {
FactorialServiceLocator locator = new FactorialServiceLocator();
Factorial service = locator.getFactorial();
int n = Integer.parseInt(args[0]);
long value = service.getFactorial(n);
System.out.println(args[0] + " != " + value);
} catch (Exception e) {
e.printStackTrace();
}
}
}
½ÇÇà°á°ú
> javac FactClient.java
> java FactClient 6
6 != 720
[UDDI - uddi4j]
1.IBM Å×½ºÆ® ·¹Áö½ºÆ®¸®(https://uddi.ibm.com/testregistry/registry.html) ¿¡¼
Å×½ºÆ® IDÀ» ¹Þ¾Æ Business ¸¦ °Ë»ö/µî·ÏÇغ»´Ù
2.http://oss.software.ibm.com/developerworks/downloads/?group_id=13 ¿¡¼
uddi4j-bin-v2beta.zip ¸¦ ´Ù¿î¹Þ¾Æ ÀÓÀÇÀÇ µð·ºÅ丮¿¡ ¾ÐÃàÀ» Ǭ´Ù
<UDDI4J>lib ÀÇ uddi4j.jar ÆÄÀÏÀ» <J2SDK>jrelibext µð·ºÅ丮¿¡ º¹»çÇÑ´Ù
ÅèĹÀ» ´Ù½Ã ½ÇÇàÇÑ´Ù
3.<UDDI4J>samplessamples.prop ¸¦ ¿¾î ÇØ´ç UDDI ¼¹öÀÇ inquiryURL, publishURL
registry URLÀ» ¾Æ·¡Ç¥¸¦ Âü°íÇÏ¿© º¯°æÇÑ´Ù(¿©±â¼´Â IBM Test registry ¸¦ »ç¿ëÇÔ)
IBM
Public registry
Registration: https://uddi.ibm.com/ubr/registry.html
inquiryURL= https://uddi.ibm.com/ubr/inquiryapi
publishURL= https://uddi.ibm.com/ubr/publishapi
Test registry
Registration: https://uddi.ibm.com/testregistry/registry.html
inquiryURL= https://uddi.ibm.com/testregistry/inquiryapi
publishURL= https://uddi.ibm.com/testregistry/publishapi
HP
Registration: http://uddi.hp.com
inquiryURL = http://uddi.hp.com/ubr/inquire
publishURL = https://uddi.hp.com/ubr/publish
Microsoft
Registration: http://uddi.rte.microsoft.com
inquiryURL=http://uddi.rte.microsoft.com/inquire
publishURL=https://uddi.rte.microsoft.com/publish
SAP
Registration: http://udditest.sap.com
inquiryURL=http://uddi.sap.com/UDDI/api/inquiry/
publishURL=https://uddi.sap.com/UDDI/api/publish/
¹ÞÀº ID Á¤º¸¸¦ Ãß°¡ÇÑ´Ù(publish ½Ã¸¸ ÇÊ¿ä)
userid = ????
password = ????
±×¸®°í soap Àü¼Û¹æ½ÄÀ» ApacheAxisTransport À¸·Î ¹Ù²Û´Ù(ÁÖ¼® ¹Ù²Þ)
#TransportClassName=org.uddi4j.transport.ApacheSOAPTransport
TransportClassName=org.uddi4j.transport.ApacheAxisTransport
# TransportClassName=org.uddi4j.transport.HPSOAPTransport
4.<UDDI4J>samples ¿¡¼
> javac -d . Configurator.java ¸¦ ½ÇÇàÇÑ´Ù
5.<UDDI4J>samples ÀÇ FindBusinessExample.java ¸¦ ¿¾î ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ÇÏ¿©
ƯÁ¤ ¹®ÀÚ¿·Î ½ÃÀÛÇÏ´Â ºñÁî´Ï½º ¸ñ·ÏÀ» °Ë»öÇÑ´Ù
// "S" ºÎºÐ¿¡ °Ë»öÇÏ°íÀÚ ÇÏ´Â Busibess ¸íÀÇ match ·Î ¹Ù²Û´Ù
names.add(new Name("S"));
// ¼ýÀÚ "5" ¸¦ °Ë»ö °¹¼ö°¡ ¸¹À¸¹Ç·Î Å© ¼ýÀÚ·Î ¼öÁ¤ÇÑ´Ù
BusinessList businessList =
proxy.find_business(names, null, null, null,null,findQualifiers, 5);
6.<UDDI4J>samples ¿¡¼
> javac FindBusinessExample.java
> java FindBusinessExample ¸¦ ½ÇÇàÇÏ¿© °Ë»ö°á°ú¸¦ È®ÀÎÇÑ´Ù
7.UDDI Âü°í¹®¼
.IBM À¥¼ºñ½º °³¹ßÀÚ »çÀÌÆ® => http://www.ibm.com/developerworks/webservices/
.uddi4j API Classes => <UDDI4J>uddi4jdocsapiDocsindex.html
* ÀÌ °ÁÂÀÇ ÀÚ¹Ù¿¹Á¦ ÀϺδ "ÀÚ¹Ù°³¹ßÀÚ¸¦ À§ÇÑ XML/È«¸ª°úÇÐ/ÃÖÁ¾¸í" Ã¥ÀÇ ¿¹Á¦¸¦ Âü°íÇÏ¿´½À´Ï´Ù
|
|