You are on page 1of 8

Web Services

2014-03-06

J2EE
.net
/
Skeleton
Stub java Skeleton
.net StubStub
Stub Skeleton Skeleton
EJBCORBAWeb Services
RMIIIOPRMI-IIOPSOAP

RMI Java RMI

Java RMI

JAVA
IIOPInternet Inter-ORB Protocol()
CORBA 2.0 CORBA
Java CORBA IIOP

RMI-IIOP RMI CORBA

RMI-IIOP RMI CORBA


RMI-IIOP
RMI CORBA RMI-IIOP RMI
Java CORBA IDL
SOAP Simple Object Access Protocol
Web web service
SOAP Web Server XML
HTTP XML
XML

Web Services Web

WEB
Web Services
SOAPWSDLUDDI
SOAP XML
HTTP HTTPS SMTP XMPP
WSDL XML

UDDI WEB
WEB

W3C XMLSOAP WSDLOASIS UDDI


HTTP UDDI

Web Service
Java
Java
delphiC#

web Web Service


SkeletonStub
Java Java
Java Web Service AxisXfireCXFJAX-WSRESTJAX-RS
Apache Axis
Axis XML Web Java C++
SOAP API Web
Apache Axis
Web Apache TomcatTomcat Apache
Jakarta Servlet Sun Microsystems
Servlet JavaServer PageJSP Web
Tomcat Tomcat
Tomcat HTTP Web
Tomcat Apache Web Apache Web Server
C HTTP web server HTTP web server
Apache Tomcat XML

1.
Axis axis-bin-1_4.zip webapps/axis tomcat
TOMCAT_HOME/webapps
TOMCAT_HOME/webapps/axis MyMath.jws

public class MyMath {


public int squared(int x) {
int result = x * x;
System.out.println("the squared of " + x + " is " + result);
return result;
}
}

Tomcat, http://localhost:8080/axis/MyMath.jws,

Web Service

Axis Java Web Service WSDL


XML / WSDL

2.
Eclipse java Axis

MyMathClient.java web service

package com.dc.core;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class MyMathClient {
private static final String endPoint = "http://localhost:8080/axis/MyMath.jws?wsdl";
public static void main(String[] args) {
Service service = new Service();
try {
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(endPoint));
Integer result =(Integer)call.invoke("squared", new Object[]{10});
System.out.println(result);
} catch (ServiceException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
}catch(RemoteException e){
e.printStackTrace();
}
}
}

3.3.
Tomcat

- Unable to find config file.

Creating new servlet engine config file: /WEB-INF

/server-config.wsdd
the squared of 10 is 100

eclipse
- Unable to find required classes (javax.activation.DataHandler and javax.mail.i
nternet.MimeMultipart). Attachment support is disabled.
100

Web Service
Stub
Web Service Stub
EJB Stub jar
Stub Stub
Stub

set AXIS_HOME=E:\apache-tomcat-6.0.36\webapps\axis\WEB-INF
set
CLASSPATH=.;%AXIS_HOME%\lib\axis.jar;%AXIS_HOME%\lib\axis-ant.jar;%AXIS_HOME%\lib\commons-discovery
-0.2.jar;%AXIS_HOME%\lib\commons-logging-1.0.4.jar;%AXIS_HOME%\lib\jaxrpc.jar;%AXIS_HOME%\lib\log4j-1.
2.8.jar;%AXIS_HOME%\lib\saaj.jar;%AXIS_HOME%\lib\wsdl4j-1.5.1.jar;

java org.apache.axis.wsdl.WSDL2Java

-p com.dc.core http://localhost:8080/axis/MyMath.jws?wsdl

src Stub

EJB Stub jar Stub