Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_20230801
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
alx_20230801
Commits
f5028386
Commit
f5028386
authored
Aug 04, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
konfiguracja walidacji za pomocą jboss-ws
parent
a7f35985
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
4 deletions
+65
-4
pom.xml
PiatekKlient/pom.xml
+11
-4
Klient1_Normalny.java
...kKlient/src/main/java/usluga/klient/Klient1_Normalny.java
+2
-0
Klient2_Walidacja.java
...Klient/src/main/java/usluga/klient/Klient2_Walidacja.java
+52
-0
No files found.
PiatekKlient/pom.xml
View file @
f5028386
...
@@ -21,10 +21,16 @@
...
@@ -21,10 +21,16 @@
<version>
4.0.0
</version>
<version>
4.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.sun.xml.ws
</groupId>
<groupId>
org.jboss.ws.cxf
</groupId>
<artifactId>
jaxws-rt
</artifactId>
<artifactId>
jbossws-cxf-client
</artifactId>
<version>
4.0.1
</version>
<version>
6.2.0.Final
</version>
<scope>
runtime
</scope>
</dependency>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.sun.xml.ws</groupId>-->
<!-- <artifactId>jaxws-rt</artifactId>-->
<!-- <version>4.0.1</version>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
PiatekKlient/src/main/java/usluga/klient/Klient1_Normalny.java
View file @
f5028386
...
@@ -35,6 +35,8 @@ public class Klient1_Normalny {
...
@@ -35,6 +35,8 @@ public class Klient1_Normalny {
System
.
out
.
println
(
"Zarejetrowane 2"
);
System
.
out
.
println
(
"Zarejetrowane 2"
);
}
catch
(
SOAPFaultException
e
)
{
}
catch
(
SOAPFaultException
e
)
{
System
.
out
.
println
(
"Serwer odrzucił zapytanie. "
+
e
);
System
.
out
.
println
(
"Serwer odrzucił zapytanie. "
+
e
);
System
.
out
.
println
(
e
.
getClass
());
System
.
out
.
println
(
"przyczyna: "
+
e
.
getCause
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Inny błąd: "
+
e
);
System
.
out
.
println
(
"Inny błąd: "
+
e
);
}
}
...
...
PiatekKlient/src/main/java/usluga/klient/Klient2_Walidacja.java
0 → 100644
View file @
f5028386
package
usluga
.
klient
;
import
jakarta.xml.ws.BindingProvider
;
import
jakarta.xml.ws.soap.SOAPFaultException
;
import
usluga.generated.Osoba
;
import
usluga.generated.Usluga
;
import
usluga.generated.UslugaService
;
public
class
Klient2_Walidacja
{
public
static
void
main
(
String
[]
args
)
{
UslugaService
service
=
new
UslugaService
();
Usluga
proxy
=
service
.
getUslugaPort
();
((
BindingProvider
)
proxy
).
getRequestContext
().
put
(
"schema-validation-enabled"
,
true
);
// To włącza walidację wiadomości wychodzących i (na 90%) przychodzących
// w razie niespełniania wymagań operacja zarejestruj (lub inna metoda) wyrzuca wyjątek SOAPFaultException
// z odpowiednimi opisami i "cause"
Osoba
ala
=
new
Osoba
();
ala
.
setImie
(
"Ala"
);
ala
.
setNazwisko
(
"Dodatnia"
);
ala
.
setNrButa
(
30
);
System
.
out
.
println
(
"Rejestruję 1"
);
try
{
proxy
.
zarejestruj
(
ala
);
System
.
out
.
println
(
"Zarejetrowane 1"
);
}
catch
(
SOAPFaultException
e
)
{
System
.
out
.
println
(
"Serwer odrzucił zapytanie. "
+
e
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Inny błąd: "
+
e
);
}
Osoba
ola
=
new
Osoba
();
ola
.
setImie
(
"Ala"
);
ola
.
setNazwisko
(
"Dodatnia"
);
ola
.
setNrButa
(-
30
);
System
.
out
.
println
(
"Rejestruję 2"
);
try
{
proxy
.
zarejestruj
(
ola
);
System
.
out
.
println
(
"Zarejetrowane 2"
);
}
catch
(
SOAPFaultException
e
)
{
System
.
out
.
println
(
"Serwer odrzucił zapytanie. "
+
e
);
System
.
out
.
println
(
e
.
getClass
());
System
.
out
.
println
(
"przyczyna: "
+
e
.
getCause
());
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Inny błąd: "
+
e
);
}
System
.
out
.
println
(
"Gotowe"
);
}
}
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