Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
javab_20230928
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
javab_20230928
Commits
4c937405
Commit
4c937405
authored
Nov 10, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wydzielenie interfejsu webserwisowego
parent
3172720b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
28 deletions
+94
-28
pom.xml
Wielomodulowy/pom.xml
+2
-0
pom.xml
Wielomodulowy/wielomodulowy-soap_api/pom.xml
+24
-0
Sklep.java
...ielomodulowy-soap_api/src/main/java/sklep/soap/Sklep.java
+39
-0
pom.xml
Wielomodulowy/wielomodulowy-soap_klient/pom.xml
+19
-0
pom.xml
Wielomodulowy/wielomodulowy-soap_serwer/pom.xml
+1
-7
SklepImpl.java
...ulowy-soap_serwer/src/main/java/sklep/soap/SklepImpl.java
+9
-21
No files found.
Wielomodulowy/pom.xml
View file @
4c937405
...
...
@@ -21,5 +21,7 @@
<module>
wielomodulowy-web
</module>
<module>
wielomodulowy-ear
</module>
<module>
wielomodulowy-soap_serwer
</module>
<module>
wielomodulowy-soap_klient
</module>
<module>
wielomodulowy-soap_api
</module>
</modules>
</project>
Wielomodulowy/wielomodulowy-soap_api/pom.xml
0 → 100644
View file @
4c937405
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
pl.alx.kjava
</groupId>
<artifactId>
Wielomodulowy
</artifactId>
<version>
1.0
</version>
</parent>
<artifactId>
wielomodulowy-soap_api
</artifactId>
<dependencies>
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
wielomodulowy-baza
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
jakarta.xml.ws
</groupId>
<artifactId>
jakarta.xml.ws-api
</artifactId>
<version>
4.0.0
</version>
</dependency>
</dependencies>
</project>
Wielomodulowy/wielomodulowy-soap_api/src/main/java/sklep/soap/Sklep.java
0 → 100644
View file @
4c937405
package
sklep
.
soap
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
jakarta.jws.WebParam
;
import
jakarta.jws.WebResult
;
import
jakarta.jws.WebService
;
import
sklep.db.DBException
;
import
sklep.db.RecordNotFound
;
import
sklep.model.Customer
;
import
sklep.model.Order
;
import
sklep.model.Product
;
@WebService
public
interface
Sklep
{
@WebResult
(
name
=
"product"
)
public
List
<
Product
>
readAll
()
throws
DBException
;
@WebResult
(
name
=
"product"
)
public
List
<
Product
>
readByPrice
(
@WebParam
(
name
=
"min"
)
BigDecimal
min
,
@WebParam
(
name
=
"max"
)
BigDecimal
max
)
throws
DBException
;
@WebResult
(
name
=
"product"
)
public
Product
readOne
(
@WebParam
(
name
=
"id"
)
int
productId
)
throws
DBException
,
RecordNotFound
;
public
void
saveProduct
(
@WebParam
(
name
=
"product"
)
Product
product
)
throws
DBException
;
@WebResult
(
name
=
"customer"
)
public
Customer
oneCustomer
(
@WebParam
(
name
=
"email"
)
String
email
)
throws
DBException
,
RecordNotFound
;
@WebResult
(
name
=
"order"
)
public
Order
oneOrder
(
@WebParam
(
name
=
"id"
)
int
orderId
)
throws
DBException
,
RecordNotFound
;
@WebResult
(
name
=
"bytes"
)
public
byte
[]
getPhoto
(
@WebParam
(
name
=
"id"
)
int
productId
)
throws
DBException
,
RecordNotFound
;
public
void
savePhoto
(
@WebParam
(
name
=
"id"
)
int
productId
,
@WebParam
(
name
=
"bytes"
)
byte
[]
bytes
);
}
Wielomodulowy/wielomodulowy-soap_klient/pom.xml
0 → 100644
View file @
4c937405
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
pl.alx.kjava
</groupId>
<artifactId>
Wielomodulowy
</artifactId>
<version>
1.0
</version>
</parent>
<artifactId>
wielomodulowy-soap_klient
</artifactId>
<dependencies>
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
wielomodulowy-soap_api
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
Wielomodulowy/wielomodulowy-soap_serwer/pom.xml
View file @
4c937405
...
...
@@ -12,12 +12,6 @@
<dependencies>
<dependency>
<groupId>
jakarta.xml.ws
</groupId>
<artifactId>
jakarta.xml.ws-api
</artifactId>
<version>
4.0.0
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
jakarta.servlet
</groupId>
<artifactId>
jakarta.servlet-api
</artifactId>
<version>
6.0.0
</version>
...
...
@@ -25,7 +19,7 @@
</dependency>
<dependency>
<groupId>
${project.groupId}
</groupId>
<artifactId>
wielomodulowy-
model
</artifactId>
<artifactId>
wielomodulowy-
soap_api
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
...
...
Wielomodulowy/wielomodulowy-soap_serwer/src/main/java/sklep/soap/Sklep.java
→
Wielomodulowy/wielomodulowy-soap_serwer/src/main/java/sklep/soap/Sklep
Impl
.java
View file @
4c937405
...
...
@@ -3,8 +3,6 @@ package sklep.soap;
import
java.math.BigDecimal
;
import
java.util.List
;
import
jakarta.jws.WebParam
;
import
jakarta.jws.WebResult
;
import
jakarta.jws.WebService
;
import
jakarta.xml.ws.soap.MTOM
;
import
sklep.db.CustomerDAO
;
...
...
@@ -17,38 +15,32 @@ import sklep.model.Customer;
import
sklep.model.Order
;
import
sklep.model.Product
;
@WebService
@MTOM
public
class
Sklep
{
@WebService
(
endpointInterface
=
"sklep.soap.Sklep"
)
public
class
SklepImpl
implements
Sklep
{
@WebResult
(
name
=
"product"
)
public
List
<
Product
>
readAll
()
throws
DBException
{
try
(
DBConnection
db
=
DBConnection
.
open
())
{
ProductDAO
productDAO
=
db
.
productDAO
();
return
productDAO
.
readAll
();
}
}
// @ResponseWrapper(localName = "wynikiWyszukiwania", targetNamespace = "http://soap.sklep/")
// @WebResult(name="product", targetNamespace = "http://soap.sklep/model")
@WebResult
(
name
=
"product"
)
public
List
<
Product
>
readByPrice
(
@WebParam
(
name
=
"min"
)
BigDecimal
min
,
@WebParam
(
name
=
"max"
)
BigDecimal
max
)
throws
DBException
{
public
List
<
Product
>
readByPrice
(
BigDecimal
min
,
BigDecimal
max
)
throws
DBException
{
try
(
DBConnection
db
=
DBConnection
.
open
())
{
ProductDAO
productDAO
=
db
.
productDAO
();
return
productDAO
.
findByPrice
(
min
,
max
);
}
}
@WebResult
(
name
=
"product"
)
public
Product
readOne
(
@WebParam
(
name
=
"id"
)
int
productId
)
throws
DBException
,
RecordNotFound
{
public
Product
readOne
(
int
productId
)
throws
DBException
,
RecordNotFound
{
try
(
DBConnection
db
=
DBConnection
.
open
())
{
ProductDAO
productDAO
=
db
.
productDAO
();
return
productDAO
.
findById
(
productId
);
}
}
public
void
saveProduct
(
@WebParam
(
name
=
"product"
)
Product
product
)
throws
DBException
{
public
void
saveProduct
(
Product
product
)
throws
DBException
{
try
(
DBConnection
db
=
DBConnection
.
open
())
{
ProductDAO
productDAO
=
db
.
productDAO
();
productDAO
.
save
(
product
);
...
...
@@ -56,29 +48,25 @@ public class Sklep {
}
}
@WebResult
(
name
=
"customer"
)
public
Customer
oneCustomer
(
@WebParam
(
name
=
"email"
)
String
email
)
throws
DBException
,
RecordNotFound
{
public
Customer
oneCustomer
(
String
email
)
throws
DBException
,
RecordNotFound
{
try
(
DBConnection
db
=
DBConnection
.
open
())
{
CustomerDAO
customerDAO
=
db
.
customerDAO
();
return
customerDAO
.
findByEmail
(
email
);
}
}
@WebResult
(
name
=
"order"
)
public
Order
oneOrder
(
@WebParam
(
name
=
"id"
)
int
orderId
)
throws
DBException
,
RecordNotFound
{
public
Order
oneOrder
(
int
orderId
)
throws
DBException
,
RecordNotFound
{
try
(
DBConnection
db
=
DBConnection
.
open
())
{
OrderDAO
orderDAO
=
db
.
orderDAO
();
return
orderDAO
.
findById
(
orderId
);
}
}
@WebResult
(
name
=
"bytes"
)
public
byte
[]
getPhoto
(
@WebParam
(
name
=
"id"
)
int
productId
)
throws
DBException
,
RecordNotFound
{
public
byte
[]
getPhoto
(
int
productId
)
throws
DBException
,
RecordNotFound
{
return
PhotoUtil
.
readBytes
(
productId
);
}
public
void
savePhoto
(
@WebParam
(
name
=
"id"
)
int
productId
,
@WebParam
(
name
=
"bytes"
)
byte
[]
bytes
)
{
public
void
savePhoto
(
int
productId
,
byte
[]
bytes
)
{
PhotoUtil
.
writeBytes
(
productId
,
bytes
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment