Commit c4fe0997 by Patryk Czarnik

PiatekSerwer - wersja bez walidacji

parent 51885136
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
/.idea/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>pl.alx.kjava</groupId>
<artifactId>PiatekSerwer</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package usluga.model;
import java.time.LocalTime;
public class Dane {
private int numer;
private String wiadomosc;
private String czas;
public Dane() {
}
public Dane(int numer, String wiadomosc, String czas) {
this.numer = numer;
this.wiadomosc = wiadomosc;
this.czas = czas;
}
public Dane(int numer, String wiadomosc) {
this(numer, wiadomosc, LocalTime.now().toString());
}
public String getWiadomosc() {
return wiadomosc;
}
public void setWiadomosc(String wiadomosc) {
this.wiadomosc = wiadomosc;
}
public int getNumer() {
return numer;
}
public String getCzas() {
return czas;
}
@Override
public String toString() {
return "Dane [numer=" + numer + ", wiadomosc=" + wiadomosc + ", czas=" + czas + "]";
}
}
package usluga.model;
import jakarta.xml.bind.annotation.XmlElement;
public class Osoba {
@XmlElement(required=true)
private String imie;
@XmlElement(required=true)
private String nazwisko;
private Integer nrButa;
public Osoba() {
}
public Osoba(String imie, String nazwisko, Integer nrButa) {
this.imie = imie;
this.nazwisko = nazwisko;
this.nrButa = nrButa;
}
public String getImie() {
return imie;
}
public void setImie(String imie) {
this.imie = imie;
}
public String getNazwisko() {
return nazwisko;
}
public void setNazwisko(String nazwisko) {
this.nazwisko = nazwisko;
}
public Integer getNrButa() {
return nrButa;
}
public void setNrButa(Integer nrButa) {
this.nrButa = nrButa;
}
@Override
public String toString() {
return "Osoba [imie=" + imie + ", nazwisko=" + nazwisko + ", nrButa=" + nrButa + "]";
}
}
@XmlAccessorType(XmlAccessType.FIELD)
package usluga.model;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAccessType;
package usluga.soap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.atomic.AtomicInteger;
import jakarta.jws.WebParam;
import jakarta.jws.WebResult;
import jakarta.jws.WebService;
import usluga.model.Dane;
import usluga.model.Osoba;
@WebService(wsdlLocation = "/WEB-INF/wsdl/UslugaService.wsdl",
targetNamespace = "http://soap.pcz/",
name = "Usluga",
portName = "UslugaPort",
serviceName = "UslugaService")
public class Usluga {
private final AtomicInteger licznik = new AtomicInteger();
private final List<Osoba> osoby = Collections.synchronizedList(new ArrayList<>());
@WebResult(name="dane")
public Dane pobierzDane(@WebParam(name="imie") String imie) {
return new Dane(licznik.incrementAndGet(), "Witaj " + imie);
}
public void zarejestruj(@WebParam(name="osoba") Osoba osoba) {
osoby.add(osoba);
}
@WebResult(name="osoba")
public Osoba pobierzOsobe(@WebParam(name="nr") int nr) throws NoSuchElementException {
synchronized(osoby) {
if(nr < osoby.size()) {
return osoby.get(nr);
} else {
throw new NoSuchElementException("Nie ma osoby nr " + nr);
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="UslugaService" targetNamespace="http://soap.pcz/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://soap.pcz/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://soap.pcz/" schemaLocation="UslugaService_schema1.xsd"></import>
</schema>
</wsdl:types>
<wsdl:message name="pobierzDaneResponse">
<wsdl:part name="parameters" element="tns:pobierzDaneResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="pobierzOsobe">
<wsdl:part name="parameters" element="tns:pobierzOsobe">
</wsdl:part>
</wsdl:message>
<wsdl:message name="zarejestruj">
<wsdl:part name="parameters" element="tns:zarejestruj">
</wsdl:part>
</wsdl:message>
<wsdl:message name="zarejestrujResponse">
<wsdl:part name="parameters" element="tns:zarejestrujResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="NoSuchElementException">
<wsdl:part name="NoSuchElementException" element="tns:NoSuchElementException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="pobierzOsobeResponse">
<wsdl:part name="parameters" element="tns:pobierzOsobeResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="pobierzDane">
<wsdl:part name="parameters" element="tns:pobierzDane">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Usluga">
<wsdl:operation name="pobierzOsobe">
<wsdl:input name="pobierzOsobe" message="tns:pobierzOsobe">
</wsdl:input>
<wsdl:output name="pobierzOsobeResponse" message="tns:pobierzOsobeResponse">
</wsdl:output>
<wsdl:fault name="NoSuchElementException" message="tns:NoSuchElementException">
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="zarejestruj">
<wsdl:input name="zarejestruj" message="tns:zarejestruj">
</wsdl:input>
<wsdl:output name="zarejestrujResponse" message="tns:zarejestrujResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="pobierzDane">
<wsdl:input name="pobierzDane" message="tns:pobierzDane">
</wsdl:input>
<wsdl:output name="pobierzDaneResponse" message="tns:pobierzDaneResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UslugaServiceSoapBinding" type="tns:Usluga">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="pobierzOsobe">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="pobierzOsobe">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="pobierzOsobeResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="NoSuchElementException">
<soap:fault name="NoSuchElementException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="zarejestruj">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="zarejestruj">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="zarejestrujResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="pobierzDane">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="pobierzDane">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="pobierzDaneResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UslugaService">
<wsdl:port name="UslugaPort" binding="tns:UslugaServiceSoapBinding">
<soap:address location="http://localhost/UslugaService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<xs:schema xmlns:tns="http://soap.pcz/" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://soap.pcz/" version="1.0">
<xs:element name="pobierzDane" type="tns:pobierzDane"></xs:element>
<xs:element name="pobierzDaneResponse" type="tns:pobierzDaneResponse"></xs:element>
<xs:element name="pobierzOsobe" type="tns:pobierzOsobe"></xs:element>
<xs:element name="pobierzOsobeResponse" type="tns:pobierzOsobeResponse"></xs:element>
<xs:element name="zarejestruj" type="tns:zarejestruj"></xs:element>
<xs:element name="zarejestrujResponse" type="tns:zarejestrujResponse"></xs:element>
<xs:complexType name="pobierzOsobe">
<xs:sequence>
<xs:element name="nr" type="xs:int"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="pobierzOsobeResponse">
<xs:sequence>
<xs:element minOccurs="0" name="osoba" type="tns:osoba"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="osoba">
<xs:sequence>
<xs:element name="imie" type="xs:string"></xs:element>
<xs:element name="nazwisko" type="xs:string"></xs:element>
<xs:element minOccurs="0" name="nrButa" type="tns:NumerButa"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="zarejestruj">
<xs:sequence>
<xs:element minOccurs="0" name="osoba" type="tns:osoba"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="zarejestrujResponse">
<xs:sequence></xs:sequence>
</xs:complexType>
<xs:complexType name="pobierzDane">
<xs:sequence>
<xs:element minOccurs="0" name="imie" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="pobierzDaneResponse">
<xs:sequence>
<xs:element minOccurs="0" name="dane" type="tns:dane"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="dane">
<xs:sequence>
<xs:element name="numer" type="xs:int"></xs:element>
<xs:element minOccurs="0" name="wiadomosc" type="xs:string"></xs:element>
<xs:element minOccurs="0" name="czas" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="NoSuchElementException" type="tns:NoSuchElementException"></xs:element>
<xs:complexType name="NoSuchElementException">
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="NumerButa">
<xs:restriction base="xs:int">
<xs:minExclusive value="0"/>
<xs:maxInclusive value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment