You are on page 1of 1

WEB SERVIS S DVIJE OPERACIJE

1. File-new project-java web- web application NEXT (Project name: OduzmiP..Servi


s) NEXT (Server: GlassFish Server) NEXt FINISH
2. OduzimanjePServisa (desni klik-new-web service) WebServiceName: OduzmiPomnozi
; Package: hr.org.foi.servis FINISH
3. (sivo i @webmethod i prvu vitiastu zagradu obirsati) - DESIGN - add operation
(Name: oduzmi) (return type: int)
-> ADD a-int ; b-int - OK ..... add operation (Name: Pomnozi) (return type:
int)
-> ADD x-ont ; y-int - OK ..... - SOURCE
4. @WebMethod(operationName = "Oduzmi")... return 0; (obirsati 0 i napisati a-b)
5. @WebMethod(operationName = "Pomnozi")...return 0; (obrisati 0 i napisati x*y)
6. OduzmiPomnoziServis - desni klik - Deploy
7. OduzimanjePServisa (kliknemo na +, Web Services +, OduzmiPomnozi - desni klik
- Test Web Serivce )
1. File - new project - Java - Java desktop application - NEXT, NeXT, (project n
ame: DesktopPozivaServisOP - FINISH
2. (na desnoj strani imamo Palette) dodamo: ->Labele (Prvi broj, Drugi broj,Rezu
ltat)
-> Button group (pod text upi emo: 2), -> Text Field (pod text upi emo: 32) -> Bu
tton (upi mo: "Oduzmi") i jo jedan Button "Pomnozi"
3. Dvostruki klik na Button - Action - Create new action; Action Method - Akcija
Oduzimanja - OK
4. Ispod @Action...public void-AkcijaOduzimanja () { } -> desni klik-insert code
- Call Web Service Operation - (ne dogodi se ni ta)
5. DesktopPozivaServisOP - desni klik - Web Servise Client - Browse - OduzmiPomn
oziServis stavimo +..otvori se ispod "OduzmiPomnozi" - OK
Package: hr.servis.klijent - FINISH
6. Ispod @Action...public void-AkcijaOduzimanja () { } -> desni klik-insert code
- Call Web Service Operation
(otvaramo plusice i odaberemo Oduzmi(s crvenim neim);
7. private static int oduzmi (int a, int b) {neee to..} nakon toga -> insert code
- call web service application - pomnozi (s crvenim)
8. @Action public void AkcijaOduzimanja () { Integer rezultat = oduzmi(new Integ
er(jTextFieldl.getText()), new Integer(jTextFieldl.getText()) );
jLabel3.setText("Rezultat oduzimanja je " + rezultat ); }
9. DESIGN - gumb pomno i-> dvostruki klik- Action - create new action; Actions met
hod: akcijaMnozenja - OK
10. @Action public void akcijaMnozenja() { Integer rezultat = pomnozi(new Integ
er(jTextFieldl.getText()), new Integer(jTextFieldl.getText()) );
jLabel3.setText("Rezultat mnozenja je " + rezultat ); }
11.DesktopPozivaServisOP - desni klik - Run

You might also like