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
48fbe326
Commit
48fbe326
authored
Aug 04, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Klient7_Dispatch_JAXB
parent
4cba7706
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
ReadByPrice.java
...lient/src/main/java/ogloszenia/generated/ReadByPrice.java
+2
-0
Klient7_Dispatch_JAXB.java
...loszenia/klient_niskopoziomowy/Klient7_Dispatch_JAXB.java
+49
-0
No files found.
OgloszeniaKlient/src/main/java/ogloszenia/generated/ReadByPrice.java
View file @
48fbe326
...
@@ -4,6 +4,7 @@ package ogloszenia.generated;
...
@@ -4,6 +4,7 @@ package ogloszenia.generated;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
jakarta.xml.bind.annotation.XmlAccessType
;
import
jakarta.xml.bind.annotation.XmlAccessType
;
import
jakarta.xml.bind.annotation.XmlAccessorType
;
import
jakarta.xml.bind.annotation.XmlAccessorType
;
import
jakarta.xml.bind.annotation.XmlRootElement
;
import
jakarta.xml.bind.annotation.XmlType
;
import
jakarta.xml.bind.annotation.XmlType
;
...
@@ -27,6 +28,7 @@ import jakarta.xml.bind.annotation.XmlType;
...
@@ -27,6 +28,7 @@ import jakarta.xml.bind.annotation.XmlType;
*
*
*
*
*/
*/
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
@XmlType
(
name
=
"readByPrice"
,
propOrder
=
{
@XmlType
(
name
=
"readByPrice"
,
propOrder
=
{
"min"
,
"min"
,
...
...
OgloszeniaKlient/src/main/java/ogloszenia/klient_niskopoziomowy/Klient7_Dispatch_JAXB.java
0 → 100644
View file @
48fbe326
package
ogloszenia
.
klient_niskopoziomowy
;
import
jakarta.xml.bind.JAXBContext
;
import
jakarta.xml.bind.JAXBException
;
import
jakarta.xml.bind.util.JAXBSource
;
import
jakarta.xml.ws.Dispatch
;
import
jakarta.xml.ws.Service
;
import
ogloszenia.generated.ObjectFactory
;
import
ogloszenia.generated.OgloszeniaService
;
import
ogloszenia.generated.ReadByPrice
;
import
javax.xml.namespace.QName
;
import
javax.xml.transform.Source
;
import
java.math.BigDecimal
;
public
class
Klient7_Dispatch_JAXB
{
/*
* Tutaj zapytanie utworzymy z obiektów (JAXB), a wynik uzyskamy jako XML i przetworzymy.
* Korzystamy z wygenerowanych klas, aby za ich pomocą przygotować zapytanie.
* Tutaj zapytanie jest proste (zakres cen w ogłoszeniu), ale w ten sposób można przygotować też złożone obiekty.
*/
public
static
void
main
(
String
[]
args
)
{
BigDecimal
min
=
new
BigDecimal
(
"12000.00"
);
BigDecimal
max
=
new
BigDecimal
(
"20000.00"
);
try
{
JAXBContext
ctx
=
JAXBContext
.
newInstance
(
ReadByPrice
.
class
);
OgloszeniaService
service
=
new
OgloszeniaService
();
QName
portName
=
OgloszeniaService
.
OgloszeniaPort
;
Dispatch
<
Source
>
dispatch
=
service
.
createDispatch
(
portName
,
Source
.
class
,
Service
.
Mode
.
PAYLOAD
);
ObjectFactory
objectFactory
=
new
ObjectFactory
();
ReadByPrice
readByPrice
=
objectFactory
.
createReadByPrice
();
readByPrice
.
setMin
(
min
);
readByPrice
.
setMax
(
max
);
// Wskazujemy obiekt Javy, z którego ma powstać treść XML zapytania
JAXBSource
src
=
new
JAXBSource
(
ctx
,
readByPrice
);
Source
result
=
dispatch
.
invoke
(
src
);
System
.
out
.
println
(
"Mam wynik: "
+
result
);
Utils
utils
=
new
Utils
();
utils
.
wypiszTransformerem
(
result
);
System
.
out
.
println
(
"Gotowe"
);
}
catch
(
JAXBException
e
)
{
e
.
printStackTrace
();
}
}
}
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