Skip to content

Commit cbd30dc

Browse files
committed
Merge branch 'master' of git@github.com:javaee-samples/javaee7-samples.git
2 parents 3d70737 + 65fc6a7 commit cbd30dc

27 files changed

Lines changed: 652 additions & 42 deletions

File tree

jaxrpc/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Java EE 7 Samples: JAX-RPC 1.1#
1+
# Java EE 7 Samples: JAX-RPC 1.1 #
22

3-
The [JSR 109](https://jcp.org/en/jsr/detail?id=109) specification is the old generation web services API predating JAX-WS
3+
The [JSR 101](https://jcp.org/en/jsr/detail?id=101) specification is the old generation web services API predating JAX-WS, which in fact was
4+
to become JAX-RPC 2.0.
45

5-
JAX-RPC is **pruned** from Java EE, and **should not be used** anymore. This sample is only provided for historical purposes.
6+
JAX-RPC 1.x is **pruned** from Java EE, and **should not be used** anymore. This sample is only provided for historical purposes.
67

78
## Samples ##
89

9-
- jaxrpc-endpoint
10+
- **jaxrpc-endpoint** - *Defines a very basic hello endpoint (as all classical JAX-RPC examples did), generates the required .wsdl and mapping files, deploys the service, and calls it via two client side approaches: dynamic proxy and DII.*
11+
- **jaxrpc-security** - *Like `jaxrpc-endpoint`, but the service is protected and requires SOAP message level authentication via an encrypted username/password credential in the security header, and calls it via generated Stubs. (to keep the sample somewhat restricted in size does not sign the message)*
1012

1113
## How to run
1214

jaxrpc/jaxrpc-endpoint/build.xml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project name="hello" default="client" basedir=".">
2+
<project name="hello" default="server" basedir=".">
33

44
<taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile"/>
55

@@ -14,17 +14,5 @@
1414
config = "./src/main/resources/HelloService.xml">
1515
</wscompile>
1616
</target>
17-
18-
<target name="client">
19-
<echo>hello</echo>
20-
<wscompile
21-
client = "true"
22-
verbose = "true"
23-
keep = "true"
24-
base = "target"
25-
features = "rpcliteral"
26-
config = "./src/main/resources/config.xml">
27-
</wscompile>
28-
</target>
29-
17+
3018
</project>

jaxrpc/jaxrpc-endpoint/pom.xml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<goal>run</goal>
4242
</goals>
4343
<configuration>
44-
<tasks>
44+
<target>
4545
<java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="true"
4646
dir="." taskname="Ant-JAX-RPC server">
4747
<classpath refid="maven.compile.classpath" />
@@ -57,28 +57,7 @@
5757
<copy file="${project.build.directory}/MyHelloService.wsdl" todir="src/main/webapp/WEB-INF/wsdl" verbose="true"/>
5858

5959
<copy file="${project.build.directory}/mapping.xml" todir="src/main/webapp/WEB-INF" verbose="true"/>
60-
61-
62-
<!--
63-
<java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="true"
64-
dir="." timeout="4000000" taskname="Ant-JAX-RPC">
65-
<classpath refid="maven.compile.classpath" />
66-
<arg value="-buildfile" />
67-
<arg file="build.xml" />
68-
<arg value="client" />
69-
<jvmarg value="-Xdebug" />
70-
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" />
71-
</java>
72-
73-
74-
<echo>Copying generated sources</echo>
75-
<copy todir="${project.build.directory}/generated-sources/antrun" verbose="true">
76-
<fileset dir="target/hello"/>
77-
</copy>
78-
-->
79-
80-
81-
</tasks>
60+
</target>
8261
</configuration>
8362
</execution>
8463
</executions>

jaxrpc/jaxrpc-endpoint/src/main/webapp/WEB-INF/web.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
This web.xml file defines a "virtual" servlet class (the class is not really a Servlet), which is a JAX-RPC
4+
specific requirement for Servlet containers to allow, so it can be mapped to a URL pattern.
5+
6+
Copyright Payara Services Limited
7+
-->
28
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
39
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
410
version="3.0">

jaxrpc/jaxrpc-security/build.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
This ant build file will be called by the Maven main build file, which will set the classpath
5+
needed to executed the tasks correctly.
6+
7+
Copyright Payara Services Limited
8+
9+
-->
10+
<project name="hello" default="client" basedir=".">
11+
12+
<taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile"/>
13+
14+
<target name="server">
15+
<echo>wscompile server</echo>
16+
<wscompile
17+
verbose = "true"
18+
define = "true"
19+
mapping = "target/mapping.xml"
20+
keep = "true"
21+
base = "target"
22+
nonClassDir = "target"
23+
config = "./src/main/resources/wscompile-server-config.xml">
24+
</wscompile>
25+
</target>
26+
27+
<target name="client">
28+
<echo>wscompile client</echo>
29+
<wscompile
30+
client = "true"
31+
verbose = "true"
32+
keep = "true"
33+
base = "target"
34+
security = "./src/test/resources/client-security.xml"
35+
config = "./src/test/resources/wscompile-client-config.xml">
36+
</wscompile>
37+
</target>
38+
39+
</project>

jaxrpc/jaxrpc-security/pom.xml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
3+
4+
<parent>
5+
<groupId>org.javaee7</groupId>
6+
<artifactId>jaxrpc</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
</parent>
9+
10+
<artifactId>jaxrpc-security</artifactId>
11+
<packaging>war</packaging>
12+
<name>Java EE 7 Sample: jaxrpc - jaxrpc-security</name>
13+
14+
<dependencies>
15+
16+
<!--
17+
The full Metro stack contains the code from com.sun.xml.rpc:jaxrpc-impl:1.1.3
18+
and com.sun.xml.wss:xws-security:2.4.0 in an updated version (with the JDK 8 fixes).
19+
Meaning it contains Wscompile and SecurityPlugin
20+
-->
21+
<dependency>
22+
<groupId>org.glassfish.metro</groupId>
23+
<artifactId>webservices-rt</artifactId>
24+
<version>2.4.0</version>
25+
</dependency>
26+
27+
<!--
28+
Include Ant and AntLauncher, so we can execute wscompile in a forked JVM, which on its turn allows
29+
us to debug wscompile (a lot of debugging was needed to get this sample to eventually work)
30+
-->
31+
32+
<dependency>
33+
<groupId>org.apache.ant</groupId>
34+
<artifactId>ant</artifactId>
35+
<version>1.7.0</version>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.apache.ant</groupId>
40+
<artifactId>ant-launcher</artifactId>
41+
<version>1.10.3</version>
42+
</dependency>
43+
</dependencies>
44+
45+
46+
<build>
47+
<finalName>jaxrpc-security</finalName>
48+
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-antrun-plugin</artifactId>
52+
<version>1.8</version>
53+
<executions>
54+
<execution>
55+
<phase>process-classes</phase>
56+
<goals>
57+
<goal>run</goal>
58+
</goals>
59+
<configuration>
60+
<target>
61+
<!--
62+
Generate the server artifacts first; the .wsdl and mapping.xml file.
63+
-->
64+
<java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="true" dir="." taskname="Ant-JAX-RPC server">
65+
<classpath refid="maven.compile.classpath" />
66+
<arg value="-buildfile" />
67+
<arg file="build.xml" />
68+
<arg value="server" />
69+
<!--
70+
<jvmarg value="-Xdebug" />
71+
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" />
72+
-->
73+
</java>
74+
75+
<echo>Copying generated .wsdl and mapping.xml files</echo>
76+
77+
<copy file="${project.build.directory}/MyHelloService.wsdl" todir="src/main/webapp/WEB-INF/wsdl" verbose="true" />
78+
<copy file="${project.build.directory}/mapping.xml" todir="src/main/webapp/WEB-INF" verbose="true" />
79+
80+
<!--
81+
Generate the client artifacts next. These depend on the .wsdl file generated in the
82+
previous step
83+
-->
84+
<java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="true" dir="." timeout="4000000"
85+
taskname="Ant-JAX-RPC client">
86+
<classpath refid="maven.compile.classpath" />
87+
<arg value="-buildfile" />
88+
<arg file="build.xml" />
89+
<arg value="client" />
90+
<jvmarg value="-Djavax.xml.accessExternalSchema=all" />
91+
92+
<!--
93+
<jvmarg value="-Xdebug" />
94+
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" />
95+
-->
96+
</java>
97+
98+
<echo>Copying generated stub sources</echo>
99+
100+
<copy todir="./src/test/java/stub" verbose="true" overwrite="true">
101+
<fileset dir="target/stub/">
102+
<include name="**/*.java" />
103+
</fileset>
104+
</copy>
105+
</target>
106+
</configuration>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
111+
112+
<!-- ### C O M P I L E ### -->
113+
114+
<plugin>
115+
<groupId>org.apache.maven.plugins</groupId>
116+
<artifactId>maven-compiler-plugin</artifactId>
117+
<version>3.7.0</version>
118+
119+
<configuration>
120+
<fork>true</fork>
121+
<compilerArgument>-XDignore.symbol.file</compilerArgument>
122+
</configuration>
123+
124+
<executions>
125+
<execution>
126+
<id>default-compile</id>
127+
<phase>compile</phase>
128+
<goals>
129+
<goal>compile</goal>
130+
</goals>
131+
</execution>
132+
133+
<execution>
134+
<id>compile-generated</id>
135+
<phase>generate-test-sources</phase>
136+
<goals>
137+
<goal>compile</goal>
138+
</goals>
139+
</execution>
140+
</executions>
141+
</plugin>
142+
143+
<plugin>
144+
<artifactId>maven-enforcer-plugin</artifactId>
145+
<configuration>
146+
<rules>
147+
<requireJavaVersion>
148+
<version>$1.8</version>
149+
</requireJavaVersion>
150+
</rules>
151+
</configuration>
152+
<executions>
153+
<execution>
154+
<goals>
155+
<goal>enforce</goal>
156+
</goals>
157+
</execution>
158+
</executions>
159+
</plugin>
160+
</plugins>
161+
</build>
162+
</project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** Copyright Payara Services Limited **/
2+
3+
package org.javaee7.jaxrpc.security;
4+
5+
import java.rmi.Remote;
6+
import java.rmi.RemoteException;
7+
8+
/**
9+
* The mandated interface for a JAX-RPC remote web service.
10+
*
11+
* <p>
12+
* Note the mandated extension from the {@link Remote} interface
13+
* and the service method having to throw a {@link RemoteException}.
14+
*
15+
* @author Arjan Tijms
16+
*
17+
*/
18+
public interface HelloService extends Remote {
19+
String sayHello(String input) throws RemoteException;
20+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/** Copyright Payara Services Limited **/
2+
3+
package org.javaee7.jaxrpc.security;
4+
5+
/**
6+
* Implementation class for the JAX-RPC remote web service.
7+
*
8+
* @author Arjan Tijms
9+
*
10+
*/
11+
public class HelloServiceImpl implements HelloService {
12+
13+
public String sayHello(String input) {
14+
return "Hello " + input;
15+
}
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
This configuration file is used by wscompile and the server target.
4+
See build.xml in the root of this module.
5+
6+
It is used for generating the .wsdl file that describes the interface in excruciating detail, and the mapping.xml
7+
file which, baggars belief, contains even more detail about the interface.
8+
9+
Copyright Payara Services Limited
10+
-->
11+
<configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
12+
<service packageName="org.javaee7.jaxrpc.security" name="MyHelloService" targetNamespace="urn:sample" typeNamespace="urn:sample">
13+
<interface name="org.javaee7.jaxrpc.security.HelloService" />
14+
</service>
15+
</configuration>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/mapping.xml

0 commit comments

Comments
 (0)