Example #1
0
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    // Create the port
    //    URL wsdlURL = getServletContext().getResource("/WEB-INF/wsdl/TestService.wsdl");
    URL wsdlURL = new URL("http://" + hostName + ":8081/jaxws-endpoint?wsdl");
    QName qname = new QName("http://org.jboss.ws/jaxws/endpoint", "EndpointService");
    Service service = Service.create(wsdlURL, qname);
    EndpointInterface port = (EndpointInterface) service.getPort(EndpointInterface.class);

    // Invoke the endpoint
    String param = req.getParameter("param");
    String retStr = port.echo(param);

    // Test epr
    DocumentBuilder builder = getDocumentBuilder();
    assertEndpointReference(
        endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT, builder)),
        TEST_ELEMENT,
        builder);
    assertEndpointReference(
        endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[]) null),
        null,
        builder);

    // Return the result
    PrintWriter pw = new PrintWriter(res.getWriter());
    pw.print(retStr);
    pw.close();
  }