Initial Contribution
Signed-off-by: Vinay Vishal <vinay.vishal@oracle.com>
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/README b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/README
new file mode 100644
index 0000000..333179e
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/README
@@ -0,0 +1,2 @@
+
+This tests for clients with @WebserviceRefs and other annotations like MTOM, etc
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.properties b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.properties
new file mode 100644
index 0000000..2e76a39
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.properties
@@ -0,0 +1,24 @@
+<!--
+
+ Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+
+<property name="module" value="wsRef-webservice-features"/>
+<property name="appname" value="${module}"/>
+<property name="assemble" value="${build.classes.dir}/archive"/>
+<property name="web.xml" value="./web.xml"/>
+
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.xml b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.xml
new file mode 100644
index 0000000..8797c23
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/build.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0"?>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!DOCTYPE project [
+<!ENTITY commonSetup SYSTEM "file:./../../../../config/properties.xml">
+<!ENTITY commonBuild SYSTEM "file:./../../../../config/common.xml">
+<!ENTITY commonRun SYSTEM "file:./../../../../config/run.xml">
+<!ENTITY jaxwsTools SYSTEM "file:../../annotations/jaxwstools.xml">
+<!ENTITY testproperties SYSTEM "file:./build.properties">
+]>
+
+<project name="wsRef-webservicefeatures" default="all" basedir=".">
+
+ &commonSetup;
+ &commonBuild;
+ &commonRun;
+ &testproperties;
+ &jaxwsTools;
+
+
+ <path id="classpath">
+ <fileset dir="${env.S1AS_HOME}/modules">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${env.S1AS_HOME}/modules/endorsed">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${env.APS_HOME}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="bootclasspath">
+ <fileset dir="${env.S1AS_HOME}/modules/endorsed">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <target name="all" depends="clean, setup, undeploy"/>
+
+ <target name="clean" depends="init-common">
+ <antcall target="clean-common"/>
+ <delete dir="${env.S1AS_HOME}/build/localwsdl"/>
+ </target>
+
+ <target name="setup" depends="assemble-web, deploy-app, assemble-client, deploy-client,runtest1"/>
+
+ <target name="compile" depends="init-common">
+ <antcall target="compile-common">
+ <param name="src" value="endpoint"/>
+ </antcall>
+ </target>
+
+ <target name="assemble-web" depends="init-common, compile">
+ <antcall target="pkg-war">
+ <param name="war.classes" value="${build.classes.dir}"/>
+ <param name="war.file" value="${assemble.dir}/${appname}-web.war"/>
+ </antcall>
+ </target>
+
+ <target name="runtest1" depends="init-common">
+ <mkdir dir="${build.classes.dir}/client"/>
+ <javac srcdir="." destdir="${build.classes.dir}/client"
+ classpath="${env.APS_HOME}/lib/reporter.jar"
+ includes="client/**"/>
+ <unjar src="${env.APS_HOME}/lib/reporter.jar" dest="${build.classes.dir}/client"/>
+ <java classname="client.TestClient">
+ <classpath>
+ <pathelement path="${build.classes.dir}/client"/>
+ </classpath>
+ <arg value="http://${http.host}:${http.port}/wsejbclient/RequestProcessor"/>
+ </java>
+ </target>
+
+
+ <target name="assemble-client" depends="init-common">
+ <mkdir dir="${build.classes.dir}/webclient/WEB-INF/classes"/>
+ <antcall target="wsimport">
+ <param name="wsimport.args"
+ value="-p client -Xendorsed -keep -d ${build.classes.dir}/webclient/WEB-INF/classes http://${http.host}:${http.port}/HelloService/Hello?WSDL"/>
+ </antcall>
+ <javac srcdir="." destdir="${build.classes.dir}/webclient/WEB-INF/classes"
+ includes="webclient/**">
+ <classpath refid="classpath"/>
+ <compilerarg value="-Djava.endorsed.dirs=${env.S1AS_HOME}/modules/endorsed"/>
+ </javac>
+
+ <copy file="client-web.xml" tofile="${build.classes.dir}/webclient/WEB-INF/web.xml"/>
+ <jar destfile="${assemble.dir}/wsejbclient.war" basedir="${build.classes.dir}/webclient" includes="**"/>
+ </target>
+
+
+ <target name="deploy-client" depends="init-common">
+ <property name="client.war" value="${assemble.dir}/wsejbclient.war"/>
+ <echo message="Deploying wsclient.war from ${basedir}." level="verbose"/>
+ <exec executable="${ASADMIN}">
+ <arg line="deploy"/>
+ <arg line="--user ${admin.user}"/>
+ <arg line="--passwordfile ${admin.password.file}"/>
+ <arg line="--host ${admin.host}"/>
+ <arg line="--port ${admin.port}"/>
+ <arg line="${client.war}"/>
+ </exec>
+ </target>
+
+ <target name="undeploy-client" depends="init-common">
+ <exec executable="${ASADMIN}">
+ <arg line="undeploy"/>
+ <arg line="--user ${admin.user}"/>
+ <arg line="--passwordfile ${admin.password.file}"/>
+ <arg line="--host ${admin.host}"/>
+ <arg line="--port ${admin.port}"/>
+ <arg line="wsejbclient"/>
+ </exec>
+ </target>
+
+ <target name="deploy-app">
+ <antcall target="deploy-war-common">
+ <param name="contextroot" value="${appname}"/>
+ </antcall>
+ </target>
+
+
+
+ <target name="undeploy" depends="init-common">
+ <antcall target="undeploy-war-common"/>
+ <antcall target="undeploy-client"/>
+ </target>
+
+
+</project>
+
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/client-web.xml b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/client-web.xml
new file mode 100644
index 0000000..027dfce
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/client-web.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <description>A test application</description>
+ <display-name>WebTier</display-name>
+ <servlet>
+ <display-name>centralServlet</display-name>
+ <servlet-name>RequestProcessor</servlet-name>
+ <servlet-class>client.Client</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>RequestProcessor</servlet-name>
+ <url-pattern>/RequestProcessor</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>54</session-timeout>
+ </session-config>
+</web-app>
+
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/client/TestClient.java b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/client/TestClient.java
new file mode 100644
index 0000000..ffd76f5
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/client/TestClient.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package client;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+public class TestClient {
+
+ private static SimpleReporterAdapter stat =
+ new SimpleReporterAdapter("appserv-tests");
+
+ public boolean found1 = false;
+ public boolean found2 = false;
+
+ public static void main (String[] args) {
+ stat.addDescription("WSREF-features");
+ TestClient client = new TestClient();
+ client.doTest(args);
+ stat.printSummary("WSREF-features");
+ }
+
+ public void doTest(String[] args) {
+
+ String url = args[0];
+ try {
+ int code = invokeServlet(url);
+ report(code);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ private int invokeServlet(String url) throws Exception {
+ log("Invoking url = " + url);
+ URL u = new URL(url);
+ HttpURLConnection c1 = (HttpURLConnection)u.openConnection();
+ int code = c1.getResponseCode();
+ InputStream is = c1.getInputStream();
+ BufferedReader input = new BufferedReader (new InputStreamReader(is));
+ String line = null;
+ while ((line = input.readLine()) != null) {
+ log(line);
+ if(line.indexOf("So the RESULT OF HELLO SERVICE IS") != -1)
+ found1 = true;
+ if(line.indexOf("[Hello All]") != -1)
+ found2 = true;
+ }
+ return code;
+ }
+
+ private void report(int code) {
+ if(code != 200) {
+ log("Incorrect return code: " + code);
+ fail();
+ }
+ if(!found1) {
+ fail();
+ }
+ if(!found2) {
+ fail();
+ }
+ pass();
+ }
+
+ private void log(String message) {
+ System.out.println("[client.TestClient]:: " + message);
+ }
+
+ private void pass() {
+ stat.addStatus("WSREF-features", stat.PASS);
+ }
+
+ private void fail() {
+ stat.addStatus("WSREF-features", stat.FAIL);
+ }
+}
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/endpoint/Hello.java b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/endpoint/Hello.java
new file mode 100644
index 0000000..c4edf73
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/endpoint/Hello.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package endpoint;
+
+import javax.jws.WebService;
+import javax.jws.WebMethod;
+
+@javax.ejb.Stateless
+@WebService(
+ name="Hello",
+ serviceName="HelloService",
+ targetNamespace="http://example.com/Hello"
+)
+public class Hello {
+ public Hello() {}
+
+ @WebMethod(operationName="sayHello", action="urn:SayHello")
+ public String sayHello(String who) {
+ return "Hello " + who;
+ }
+}
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/web.xml b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/web.xml
new file mode 100644
index 0000000..aae527e
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+
+
+</web-app>
+
diff --git a/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/webclient/Client.java b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/webclient/Client.java
new file mode 100644
index 0000000..b6aa70c
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/webservice/ejb_annotations/wsRef-webservice-features/webclient/Client.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package client;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.xml.ws.*;
+import javax.xml.ws.soap.*;
+
+public class Client extends HttpServlet {
+
+ @javax.xml.ws.WebServiceRef(HelloService.class)
+ @MTOM(enabled=true)
+ @RespectBinding
+ @Addressing (required = false,enabled=true)
+
+ Hello hiport;
+
+ public void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws javax.servlet.ServletException {
+ doPost(req, resp);
+ }
+
+ public void doPost(HttpServletRequest req, HttpServletResponse resp)
+ throws javax.servlet.ServletException {
+ try {
+ com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true;
+ String ret = hiport.sayHello("All");
+ PrintWriter out = resp.getWriter();
+ resp.setContentType("text/html");
+ out.println("<html>");
+ out.println("<head>");
+ out.println("<title>TestServlet</title>");
+ out.println("</head>");
+ out.println("<body>");
+ out.println("<p>");
+ out.println("So the RESULT OF HELLO SERVICE IS :");
+ out.println("</p>");
+ out.println("[" + ret + "]");
+ out.println("</body>");
+ out.println("</html>");
+ out.flush();
+ out.close();
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
+