Presentation is loading. Please wait.

Presentation is loading. Please wait.

SOAP – RPC SimpleObjectAccessProtocol RemoteProcedureCall mittels XML über Port 80 Sascha Sadikni BPS – Präsentation.

Similar presentations


Presentation on theme: "SOAP – RPC SimpleObjectAccessProtocol RemoteProcedureCall mittels XML über Port 80 Sascha Sadikni BPS – Präsentation."— Presentation transcript:

1 SOAP – RPC SimpleObjectAccessProtocol RemoteProcedureCall mittels XML über Port 80 Sascha Sadikni BPS – Präsentation

2 Übersicht SOAP im Überblick – Server – ApacheSOAP – SOAP-Service – SOAP-Client – XML Beispiel – SOAP-Service – SOAP-Client

3 Server WebServer (Apache) Servlet- Container (Tomcat) - soap.war (ApacheSOAP WebApplication) Server

4 WebServer (Apache) Servlet- Container (Tomcat) - soap.war (ApacheSOAP WebApplication) - Deploy-JSP's - RPC-Router-Servlet includesincludes Server + ApacheSOAP

5 Server WebServer (Apache) Servlet- Container (Tomcat) - soap.war (ApacheSOAP WebApplication) SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... - Deploy-JSP's - RPC-Router-Servlet includesincludes callscalls SOAP-Service

6 SOAP-Client Server WebServer (Apache) Servlet- Container (Tomcat) - soap.war (ApacheSOAP WebApplication) SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... - Deploy-JSP's - RPC-Router-Servlet includesincludes Client callscalls sends XML-Doc via HTTP / Port 80 - Java-Client-App - NonJava -... SOAP-Client

7 Server WebServer (Apache) Servlet- Container (Tomcat) - soap.war (ApacheSOAP WebApplication) SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... - Deploy-JSP's - RPC-Router-Servlet includesincludes Client callscalls sends XML-Doc via HTTP / Port 80 - Java-Client-App - NonJava -... Kompletter Überblick XML-Doc Class-ID Method-Name ParameterList...

8 SOAP-Client Server WebServer (Apache) Servlet- Container (Tomcat) - soap.war (ApacheSOAP WebApplication) SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... - Deploy-JSP's - RPC-Router-Servlet includesincludes Client callscalls sends XML-Doc via HTTP / Port 80 - Java-Client-App - NonJava -... Kompletter Überblick XML-Doc

9 Server SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... SOAP-Beispiel SOAP-Client Client - Java-Client-App - NonJava -...

10 Server SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... SOAP-Service package bps.soap.service; import java.io.Serializable; import java.util.Date; import java.util.Calendar; public class ServerInfo implements Serializable { public ServerInfo() {} public String greeting(String name) { return "Hello, " + name + "!"; } public Date getServerDate() { return new Date(); }............................ }

11 Server SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... SOAP-Service public class ServerInfo implements Serializable {............................ public String getServerOS() { return System.getProperty("os.name") + "::" + System.getProperty("os.arch") + "::" + System.getProperty("os.version"); } public String getServerJDKVersion() { return System.getProperty("java.version") + "::" + System.getProperty("java.vendor"); } public String getAllInfos(String name) { StringBuffer sb = new StringBuffer(); sb.append(this.greeting(name) + "\n"); sb.append("My current date is " + this.getServerDate() + "\n"); sb.append("I'm running on " + this.getServerOS() + "\n"); sb.append("My JDK-version is " + this.getServerJDKVersion()+"\n"); return sb.toString(); }

12 Server SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... Deployment Tomcat-ServletContainer entpacken – tar zxvf jakarta-tomcat-5.0.12.tar.gz Apache-SOAP entpacken – tar zxvf soap-bin-2.3.1.tar.gz Environment setzen – export JAVA_HOME=/usr/lib/java – export CLASSPATH=~/test/jars/soap.jar: ~/test/jars/xerces.jar:~/test/jars/mail.jar:~/test/jars/activation. jar: ~/java/classes

13 Server SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... Deployment Tomcat konfigurieren – Context-Tag hinzufügen in../jakarta-tomcat-5.0.12/conf/server.xml z.B. direkt vor : <Context path="/soap" docBase="~/test/soap-2_3_1/webapps/soap" debug="1" reloadable="true"> – Benötigte JARs: soap.jar, xerces.jar, mail.jar, activation.jar kopieren nach../ jakarta-tomcat-5.0.12/common/lib/

14 Server SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... Deployment Tomcat konfigurieren – CLASSPATH anpassen in../jakarta-tomcat-5.0.12/bin/setClasspath.sh # Set standard CLASSPATH CLASSPATH= "$JAVA_HOME"/lib/tools.jar: ~ /java/classes: Tomcat starten/stoppen – cd../jakarta-tomcat-5.0.12/ – bin/startup.sh – bin/shutdown.sh

15 Server SOAP-Service - Java-Class (JavaBean) - EJB - NonJava -... Deployment Service deployen – http://localhost:8080/soap/ – Run the admin client – Deploy ID=urn:ServerInfo Provider Class=bps.soap.service.ServerInfo Methods=greeting, getServerDate, getServerOS, getServerJDKVersion, getAllInfos

16 SOAP-Client Client - Java-Client-App - NonJava -... package bps.soap.client; import org.apache.soap.rpc.*; import org.apache.soap.*; import java.net.*; import java.util.Vector; public class InfoClient { public String getServerInfos(String name) { try {......................... } catch(MalformedURLException mue) {..} catch(SOAPException soape) {.. } return null; } public static void main(String[] args) { if(args.length<1) {... } InfoClient ic = new InfoClient(); System.out.println(ic.getServerInfos(args[0])); }

17 SOAP-Client Client - Java-Client-App - NonJava -... // *** soap-rpcrouter-url URL soapURL = new URL("http://localhost:8080/soap/servlet/rpcrouter"); // *** call Call call = new Call(); // *** urn call.setTargetObjectURI("urn:ServerInfo"); // *** method call.setMethodName("getAllInfos"); call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC ); // *** parameter Parameter paramName = new Parameter("name", String.class, name, Constants.NS_URI_SOAP_ENC ); Vector params = new Vector(); params.add(paramName); call.setParams(params);

18 SOAP-Client Client - Java-Client-App - NonJava -... // *** invokation Response response = call.invoke(soapURL, ""); // *** response-handling if(response.generatedFault()) { return "Response generates fault: " + response.getFault().getFaultString(); } else { Parameter returnParam = response.getReturnValue(); return returnParam.getValue().toString(); }

19 Quellen http://www.informatik.fh-wiesbaden.de/~ssadi001 Apache-SOAP (v2.3.1) – http://ws.apache.org/soap/ Tomcat (v5.0.12) – http://jakarta.apache.org/tomcat/ Apache Xerces (xerces.jar v1.4.4) – http://xml.apache.org/xerces-j/ JavaMail (mail.jar v1.1.3) – http://java.sun.com/products/javamail/ JavaBeans Activation Framework (activation.jar v1.0.2) – http://java.sun.com/products/beans/glasgow/jaf.ht ml


Download ppt "SOAP – RPC SimpleObjectAccessProtocol RemoteProcedureCall mittels XML über Port 80 Sascha Sadikni BPS – Präsentation."

Similar presentations


Ads by Google