Presentation is loading. Please wait.

Presentation is loading. Please wait.

ClaRA web services V. Gyurjyan Clas12 Software Meeting 03.10.2008.

Similar presentations


Presentation on theme: "ClaRA web services V. Gyurjyan Clas12 Software Meeting 03.10.2008."— Presentation transcript:

1 ClaRA web services V. Gyurjyan Clas12 Software Meeting 03.10.2008

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

3 Java Client Application package geometryws_client_application; import javax.xml.ws.BindingProvider; /** * @author gurjyan */ public class Main { /** * @param 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, "http://sca2.jlab.org:8080/GeometryWSApplication/GeometryWSService?wsdl"); 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 --%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> JSP Page ClaRA GeometryService JSP client! <% 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 } %>

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; /** * * @author gurjyan */ public class ClientServlet extends HttpServlet { @WebServiceRef(wsdlLocation = "http://sca2.jlab.org:8080/GeometryWSApplication/GeometryWSService?wsdl") private GeometryWSService service; /** * Processes requests for both HTTP GET and POST methods. * @param request servlet request * @param 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(" "); out.println(" Servlet ClientServlet "); out.println(" "); out.println(" Servlet ClientServlet at " + request.getContextPath () + " "); 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(" "); } finally { out.close(); }


Download ppt "ClaRA web services V. Gyurjyan Clas12 Software Meeting 03.10.2008."

Similar presentations


Ads by Google