Presentation is loading. Please wait.

Presentation is loading. Please wait.

V. Gyurjyan Clas12 Software Meeting

Similar presentations


Presentation on theme: "V. Gyurjyan Clas12 Software Meeting"— Presentation transcript:

1 V. Gyurjyan Clas12 Software Meeting 03.10.2008
ClaRA web services V. Gyurjyan Clas12 Software Meeting

2 Geometry services Geometry cMsg Service Web Service
cMsg TCP port = 7788 SOAP HTTP Port = 8080 User

3 Java Client Application
package geometryws_client_application; import javax.xml.ws.BindingProvider; /** gurjyan */ public class Main { args the command line arguments public static void main(String[] args) { try { // Call Web Service Operation org.jlab.clara.ws.client.GeometryWSService service = new org.jlab.clara.ws.client.GeometryWSService(); org.jlab.clara.ws.client.GeometryWS port = service.getGeometryWSPort(); //change the wsdl location ((BindingProvider) port).getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, " java.lang.String component = "SVT"; java.lang.String representation = "ascii"; // TODO process result here java.lang.String result = port.getGeometry(component, representation); System.out.println("Result = " + result); } catch (Exception ex) { ex.printStackTrace(); }

4 JSP client <%-- Document : index Created on : Mar 7, 2008, 10:55:19 AM Author : gurjyan --%> contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h2>ClaRA GeometryService JSP client!</h2> <%-- start web service invocation --%><hr/> <% try { org.jlab.clara.ws.client.GeometryWSService service = new org.jlab.clara.ws.client.GeometryWSService(); org.jlab.clara.ws.client.GeometryWS port = service.getGeometryWSPort(); // TODO initialize WS operation arguments here java.lang.String component = "SVT"; java.lang.String representation = "ascii"; // TODO process result here java.lang.String result = port.getGeometry(component, representation); out.println("Result = "+result); } catch (Exception ex) { // TODO handle custom exceptions here } %> <%-- end web service invocation --%><hr/> </body> </html>

5 Servlet client package org.jlab.clara.ws.client; import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; import javax.xml.ws.WebServiceRef; /** * gurjyan */ public class ClientServlet extends HttpServlet = " private GeometryWSService service; * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. request servlet request response servlet response protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { out.println("<html>"); out.println("<head>"); out.println("<title>Servlet ClientServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet ClientServlet at " + request.getContextPath () + "</h1>"); try { // Call Web Service Operation org.jlab.clara.ws.client.GeometryWS port = service.getGeometryWSPort(); java.lang.String component = "SVT"; java.lang.String representation = "ascii"; // TODO process result here java.lang.String result = port.getGeometry(component, representation); out.println("Result = "+result); } catch (Exception ex) {} out.println("</body>"); out.println("</html>"); } finally { out.close(); }


Download ppt "V. Gyurjyan Clas12 Software Meeting"

Similar presentations


Ads by Google