From edd3417aacb2ef43a28f98510b08ece61c4d201f Mon Sep 17 00:00:00 2001 From: Ayrat Date: Tue, 25 Apr 2017 23:14:34 +0300 Subject: [PATCH 1/9] add news in news.jsp --- src/main/resources/hibernate.properties | 2 +- web/WEB-INF/views/document.jsp | 2 +- web/WEB-INF/views/news.jsp | 39 ++++++++++++++++++++++--- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/main/resources/hibernate.properties b/src/main/resources/hibernate.properties index bf39aa5..39f3615 100644 --- a/src/main/resources/hibernate.properties +++ b/src/main/resources/hibernate.properties @@ -5,4 +5,4 @@ hibernate.password=root hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect hibernate.show_sql=true hibernate.format_sql=true -hibernate.hbm2ddl.auto=create +hibernate.hbm2ddl.auto=update diff --git a/web/WEB-INF/views/document.jsp b/web/WEB-INF/views/document.jsp index 676cda3..3b1dadf 100644 --- a/web/WEB-INF/views/document.jsp +++ b/web/WEB-INF/views/document.jsp @@ -37,7 +37,7 @@ success: function (result) { $('#response').html(JSON.stringify(result)); }, - error: function (jqXHR, textStatus, errorThrpwn) { + error: function (jqXHR, textStatus, errorThrown) { $('#response').html(JSON.stringify(jqXHR)); } }); diff --git a/web/WEB-INF/views/news.jsp b/web/WEB-INF/views/news.jsp index 78cb43e..87071cf 100644 --- a/web/WEB-INF/views/news.jsp +++ b/web/WEB-INF/views/news.jsp @@ -7,6 +7,29 @@ + + + + + + +
+ news: + +
From a64b214020e5af701f4ac58ce394da6d1fcfdcf8 Mon Sep 17 00:00:00 2001 From: Ayrat Date: Tue, 25 Apr 2017 23:25:38 +0300 Subject: [PATCH 2/9] add delete news by id in news.jsp --- web/WEB-INF/views/news.jsp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/web/WEB-INF/views/news.jsp b/web/WEB-INF/views/news.jsp index 87071cf..bfea907 100644 --- a/web/WEB-INF/views/news.jsp +++ b/web/WEB-INF/views/news.jsp @@ -48,6 +48,24 @@ }; + + +
- news: - + +
+
@@ -83,6 +103,15 @@
+ + + + +
+ + Id: +
+
From af2a376ac2bba9687801713979cc158ecf142a10 Mon Sep 17 00:00:00 2001 From: sherXan Date: Wed, 26 Apr 2017 02:20:52 +0300 Subject: [PATCH 3/9] index on feauture-webface2: c1f9efd add oneToMany --- .../java/io/delivery/config/AppConfig.java | 12 + .../io/delivery/controller/AppController.java | 24 +- .../java/net/webservicex/ConversionRate.java | 95 +++++ .../webservicex/ConversionRateResponse.java | 56 +++ src/main/java/net/webservicex/Currency.java | 336 ++++++++++++++++++ .../java/net/webservicex/CurrencyClient.java | 30 ++ .../net/webservicex/CurrencyConvertor.java | 94 +++++ .../webservicex/CurrencyConvertorSoap.java | 44 +++ .../java/net/webservicex/ObjectFactory.java | 61 ++++ .../java/net/webservicex/package-info.java | 2 + web/WEB-INF/views/hello.jsp | 2 + web/WEB-INF/views/resultconvert.jsp | 11 + 12 files changed, 765 insertions(+), 2 deletions(-) create mode 100644 src/main/java/net/webservicex/ConversionRate.java create mode 100644 src/main/java/net/webservicex/ConversionRateResponse.java create mode 100644 src/main/java/net/webservicex/Currency.java create mode 100644 src/main/java/net/webservicex/CurrencyClient.java create mode 100644 src/main/java/net/webservicex/CurrencyConvertor.java create mode 100644 src/main/java/net/webservicex/CurrencyConvertorSoap.java create mode 100644 src/main/java/net/webservicex/ObjectFactory.java create mode 100644 src/main/java/net/webservicex/package-info.java create mode 100644 web/WEB-INF/views/resultconvert.jsp diff --git a/src/main/java/io/delivery/config/AppConfig.java b/src/main/java/io/delivery/config/AppConfig.java index 1a05eaa..0bf4789 100644 --- a/src/main/java/io/delivery/config/AppConfig.java +++ b/src/main/java/io/delivery/config/AppConfig.java @@ -10,6 +10,8 @@ import io.delivery.model.impl.TableCreatorImpl; import io.delivery.service.*; import io.delivery.service.impl.*; +import net.webservicex.ConversionRate; +import net.webservicex.CurrencyClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -122,5 +124,15 @@ public OfficeDao officeDao(){ CustomerDao customerDao() { return new CustomerDaoImpl(Customer.class); } + + @Bean + public CurrencyClient currencyClient(){ + return new CurrencyClient(); + } + + @Bean + public ConversionRate conversionRate(){ + return new ConversionRate(); + } } diff --git a/src/main/java/io/delivery/controller/AppController.java b/src/main/java/io/delivery/controller/AppController.java index ec4bea9..d83a9f2 100644 --- a/src/main/java/io/delivery/controller/AppController.java +++ b/src/main/java/io/delivery/controller/AppController.java @@ -4,6 +4,9 @@ import io.delivery.model.Message; import io.delivery.model.TableCreator; import io.delivery.service.*; +import net.webservicex.ConversionRate; +import net.webservicex.Currency; +import net.webservicex.CurrencyClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Controller; @@ -13,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; +import javax.xml.soap.SOAPException; +import java.io.IOException; + @Controller public class AppController { @Autowired @@ -33,6 +39,10 @@ public class AppController { private TableCreator tableCreator; @Autowired private Test test; + @Autowired + private CurrencyClient currencyClient; + @Autowired + private ConversionRate conversionRate; @RequestMapping(value = {"/password/{password}"}, method = RequestMethod.GET) public ModelAndView passwordEncode(@PathVariable("password") String password) { @@ -71,8 +81,18 @@ public String noregisration() { return "/noregistration"; } - @RequestMapping(value = "/documentApi") - public String getDocumentInfo(){ + @RequestMapping(value = "/documentApi") + public String getDocumentInfo() { return "document"; } + + @RequestMapping(value = {"/currency/{convert}"}, method = RequestMethod.GET) + public ModelAndView currencyConvertor (@PathVariable("convert") String convert) throws IOException, SOAPException { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("resultconvert"); + modelAndView.addObject("result", currencyClient.result()); + modelAndView.addObject("fromCurrency",conversionRate.getFromCurrency()); + modelAndView.addObject("toCurrency", conversionRate.getToCurrency()); + return modelAndView; + } } diff --git a/src/main/java/net/webservicex/ConversionRate.java b/src/main/java/net/webservicex/ConversionRate.java new file mode 100644 index 0000000..37f4e1f --- /dev/null +++ b/src/main/java/net/webservicex/ConversionRate.java @@ -0,0 +1,95 @@ + +package net.webservicex; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="FromCurrency" type="{http://www.webserviceX.NET/}Currency"/>
+ *         <element name="ToCurrency" type="{http://www.webserviceX.NET/}Currency"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "fromCurrency", + "toCurrency" +}) +@XmlRootElement(name = "ConversionRate") +public class ConversionRate { + + @XmlElement(name = "FromCurrency", required = true) + @XmlSchemaType(name = "string") + protected Currency fromCurrency; + @XmlElement(name = "ToCurrency", required = true) + @XmlSchemaType(name = "string") + protected Currency toCurrency; + + /** + * Gets the value of the fromCurrency property. + * + * @return + * possible object is + * {@link Currency } + * + */ + public Currency getFromCurrency() { + return fromCurrency; + } + + /** + * Sets the value of the fromCurrency property. + * + * @param value + * allowed object is + * {@link Currency } + * + */ + public void setFromCurrency(Currency value) { + this.fromCurrency = value; + } + + /** + * Gets the value of the toCurrency property. + * + * @return + * possible object is + * {@link Currency } + * + */ + public Currency getToCurrency() { + return toCurrency; + } + + /** + * Sets the value of the toCurrency property. + * + * @param value + * allowed object is + * {@link Currency } + * + */ + public void setToCurrency(Currency value) { + this.toCurrency = value; + } + +} diff --git a/src/main/java/net/webservicex/ConversionRateResponse.java b/src/main/java/net/webservicex/ConversionRateResponse.java new file mode 100644 index 0000000..4580df1 --- /dev/null +++ b/src/main/java/net/webservicex/ConversionRateResponse.java @@ -0,0 +1,56 @@ + +package net.webservicex; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ConversionRateResult" type="{http://www.w3.org/2001/XMLSchema}double"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "conversionRateResult" +}) +@XmlRootElement(name = "ConversionRateResponse") +public class ConversionRateResponse { + + @XmlElement(name = "ConversionRateResult") + protected double conversionRateResult; + + /** + * Gets the value of the conversionRateResult property. + * + */ + public double getConversionRateResult() { + return conversionRateResult; + } + + /** + * Sets the value of the conversionRateResult property. + * + */ + public void setConversionRateResult(double value) { + this.conversionRateResult = value; + } + +} diff --git a/src/main/java/net/webservicex/Currency.java b/src/main/java/net/webservicex/Currency.java new file mode 100644 index 0000000..69e1627 --- /dev/null +++ b/src/main/java/net/webservicex/Currency.java @@ -0,0 +1,336 @@ + +package net.webservicex; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for Currency. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="Currency">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="AFA"/>
+ *     <enumeration value="ALL"/>
+ *     <enumeration value="DZD"/>
+ *     <enumeration value="ARS"/>
+ *     <enumeration value="AWG"/>
+ *     <enumeration value="AUD"/>
+ *     <enumeration value="BSD"/>
+ *     <enumeration value="BHD"/>
+ *     <enumeration value="BDT"/>
+ *     <enumeration value="BBD"/>
+ *     <enumeration value="BZD"/>
+ *     <enumeration value="BMD"/>
+ *     <enumeration value="BTN"/>
+ *     <enumeration value="BOB"/>
+ *     <enumeration value="BWP"/>
+ *     <enumeration value="BRL"/>
+ *     <enumeration value="GBP"/>
+ *     <enumeration value="BND"/>
+ *     <enumeration value="BIF"/>
+ *     <enumeration value="XOF"/>
+ *     <enumeration value="XAF"/>
+ *     <enumeration value="KHR"/>
+ *     <enumeration value="CAD"/>
+ *     <enumeration value="CVE"/>
+ *     <enumeration value="KYD"/>
+ *     <enumeration value="CLP"/>
+ *     <enumeration value="CNY"/>
+ *     <enumeration value="COP"/>
+ *     <enumeration value="KMF"/>
+ *     <enumeration value="CRC"/>
+ *     <enumeration value="HRK"/>
+ *     <enumeration value="CUP"/>
+ *     <enumeration value="CYP"/>
+ *     <enumeration value="CZK"/>
+ *     <enumeration value="DKK"/>
+ *     <enumeration value="DJF"/>
+ *     <enumeration value="DOP"/>
+ *     <enumeration value="XCD"/>
+ *     <enumeration value="EGP"/>
+ *     <enumeration value="SVC"/>
+ *     <enumeration value="EEK"/>
+ *     <enumeration value="ETB"/>
+ *     <enumeration value="EUR"/>
+ *     <enumeration value="FKP"/>
+ *     <enumeration value="GMD"/>
+ *     <enumeration value="GHC"/>
+ *     <enumeration value="GIP"/>
+ *     <enumeration value="XAU"/>
+ *     <enumeration value="GTQ"/>
+ *     <enumeration value="GNF"/>
+ *     <enumeration value="GYD"/>
+ *     <enumeration value="HTG"/>
+ *     <enumeration value="HNL"/>
+ *     <enumeration value="HKD"/>
+ *     <enumeration value="HUF"/>
+ *     <enumeration value="ISK"/>
+ *     <enumeration value="INR"/>
+ *     <enumeration value="IDR"/>
+ *     <enumeration value="IQD"/>
+ *     <enumeration value="ILS"/>
+ *     <enumeration value="JMD"/>
+ *     <enumeration value="JPY"/>
+ *     <enumeration value="JOD"/>
+ *     <enumeration value="KZT"/>
+ *     <enumeration value="KES"/>
+ *     <enumeration value="KRW"/>
+ *     <enumeration value="KWD"/>
+ *     <enumeration value="LAK"/>
+ *     <enumeration value="LVL"/>
+ *     <enumeration value="LBP"/>
+ *     <enumeration value="LSL"/>
+ *     <enumeration value="LRD"/>
+ *     <enumeration value="LYD"/>
+ *     <enumeration value="LTL"/>
+ *     <enumeration value="MOP"/>
+ *     <enumeration value="MKD"/>
+ *     <enumeration value="MGF"/>
+ *     <enumeration value="MWK"/>
+ *     <enumeration value="MYR"/>
+ *     <enumeration value="MVR"/>
+ *     <enumeration value="MTL"/>
+ *     <enumeration value="MRO"/>
+ *     <enumeration value="MUR"/>
+ *     <enumeration value="MXN"/>
+ *     <enumeration value="MDL"/>
+ *     <enumeration value="MNT"/>
+ *     <enumeration value="MAD"/>
+ *     <enumeration value="MZM"/>
+ *     <enumeration value="MMK"/>
+ *     <enumeration value="NAD"/>
+ *     <enumeration value="NPR"/>
+ *     <enumeration value="ANG"/>
+ *     <enumeration value="NZD"/>
+ *     <enumeration value="NIO"/>
+ *     <enumeration value="NGN"/>
+ *     <enumeration value="KPW"/>
+ *     <enumeration value="NOK"/>
+ *     <enumeration value="OMR"/>
+ *     <enumeration value="XPF"/>
+ *     <enumeration value="PKR"/>
+ *     <enumeration value="XPD"/>
+ *     <enumeration value="PAB"/>
+ *     <enumeration value="PGK"/>
+ *     <enumeration value="PYG"/>
+ *     <enumeration value="PEN"/>
+ *     <enumeration value="PHP"/>
+ *     <enumeration value="XPT"/>
+ *     <enumeration value="PLN"/>
+ *     <enumeration value="QAR"/>
+ *     <enumeration value="ROL"/>
+ *     <enumeration value="RUB"/>
+ *     <enumeration value="WST"/>
+ *     <enumeration value="STD"/>
+ *     <enumeration value="SAR"/>
+ *     <enumeration value="SCR"/>
+ *     <enumeration value="SLL"/>
+ *     <enumeration value="XAG"/>
+ *     <enumeration value="SGD"/>
+ *     <enumeration value="SKK"/>
+ *     <enumeration value="SIT"/>
+ *     <enumeration value="SBD"/>
+ *     <enumeration value="SOS"/>
+ *     <enumeration value="ZAR"/>
+ *     <enumeration value="LKR"/>
+ *     <enumeration value="SHP"/>
+ *     <enumeration value="SDD"/>
+ *     <enumeration value="SRG"/>
+ *     <enumeration value="SZL"/>
+ *     <enumeration value="SEK"/>
+ *     <enumeration value="CHF"/>
+ *     <enumeration value="SYP"/>
+ *     <enumeration value="TWD"/>
+ *     <enumeration value="TZS"/>
+ *     <enumeration value="THB"/>
+ *     <enumeration value="TOP"/>
+ *     <enumeration value="TTD"/>
+ *     <enumeration value="TND"/>
+ *     <enumeration value="TRL"/>
+ *     <enumeration value="USD"/>
+ *     <enumeration value="AED"/>
+ *     <enumeration value="UGX"/>
+ *     <enumeration value="UAH"/>
+ *     <enumeration value="UYU"/>
+ *     <enumeration value="VUV"/>
+ *     <enumeration value="VEB"/>
+ *     <enumeration value="VND"/>
+ *     <enumeration value="YER"/>
+ *     <enumeration value="YUM"/>
+ *     <enumeration value="ZMK"/>
+ *     <enumeration value="ZWD"/>
+ *     <enumeration value="TRY"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "Currency") +@XmlEnum +public enum Currency { + + AFA, + ALL, + DZD, + ARS, + AWG, + AUD, + BSD, + BHD, + BDT, + BBD, + BZD, + BMD, + BTN, + BOB, + BWP, + BRL, + GBP, + BND, + BIF, + XOF, + XAF, + KHR, + CAD, + CVE, + KYD, + CLP, + CNY, + COP, + KMF, + CRC, + HRK, + CUP, + CYP, + CZK, + DKK, + DJF, + DOP, + XCD, + EGP, + SVC, + EEK, + ETB, + EUR, + FKP, + GMD, + GHC, + GIP, + XAU, + GTQ, + GNF, + GYD, + HTG, + HNL, + HKD, + HUF, + ISK, + INR, + IDR, + IQD, + ILS, + JMD, + JPY, + JOD, + KZT, + KES, + KRW, + KWD, + LAK, + LVL, + LBP, + LSL, + LRD, + LYD, + LTL, + MOP, + MKD, + MGF, + MWK, + MYR, + MVR, + MTL, + MRO, + MUR, + MXN, + MDL, + MNT, + MAD, + MZM, + MMK, + NAD, + NPR, + ANG, + NZD, + NIO, + NGN, + KPW, + NOK, + OMR, + XPF, + PKR, + XPD, + PAB, + PGK, + PYG, + PEN, + PHP, + XPT, + PLN, + QAR, + ROL, + RUB, + WST, + STD, + SAR, + SCR, + SLL, + XAG, + SGD, + SKK, + SIT, + SBD, + SOS, + ZAR, + LKR, + SHP, + SDD, + SRG, + SZL, + SEK, + CHF, + SYP, + TWD, + TZS, + THB, + TOP, + TTD, + TND, + TRL, + USD, + AED, + UGX, + UAH, + UYU, + VUV, + VEB, + VND, + YER, + YUM, + ZMK, + ZWD, + TRY; + + public String value() { + return name(); + } + + public static Currency fromValue(String v) { + return valueOf(v); + } + +} diff --git a/src/main/java/net/webservicex/CurrencyClient.java b/src/main/java/net/webservicex/CurrencyClient.java new file mode 100644 index 0000000..03e87a4 --- /dev/null +++ b/src/main/java/net/webservicex/CurrencyClient.java @@ -0,0 +1,30 @@ +package net.webservicex; + +import org.springframework.beans.factory.annotation.Autowired; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.ws.Service; +import java.io.IOException; +import java.net.URL; + +public class CurrencyClient { + private final String ADDRESS = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"; + @Autowired + ConversionRate conversionRate; + + public CurrencyClient() { + } + + public double result() throws SOAPException, IOException { + URL url = new URL(ADDRESS); + QName qName = new QName("http://www.webserviceX.NET/", "CurrencyConvertor"); + Service service = Service.create(url, qName); + + CurrencyConvertorSoap convertorSoap = service.getPort(CurrencyConvertorSoap.class); + conversionRate.setFromCurrency(Currency.EUR); + conversionRate.setToCurrency(Currency.RUB); + + return convertorSoap.conversionRate(conversionRate.getFromCurrency(), conversionRate.getToCurrency()); + } +} diff --git a/src/main/java/net/webservicex/CurrencyConvertor.java b/src/main/java/net/webservicex/CurrencyConvertor.java new file mode 100644 index 0000000..b88d8b1 --- /dev/null +++ b/src/main/java/net/webservicex/CurrencyConvertor.java @@ -0,0 +1,94 @@ + +package net.webservicex; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "CurrencyConvertor", targetNamespace = "http://www.webserviceX.NET/", wsdlLocation = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL") +public class CurrencyConvertor + extends Service +{ + + private final static URL CURRENCYCONVERTOR_WSDL_LOCATION; + private final static WebServiceException CURRENCYCONVERTOR_EXCEPTION; + private final static QName CURRENCYCONVERTOR_QNAME = new QName("http://www.webserviceX.NET/", "CurrencyConvertor"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + CURRENCYCONVERTOR_WSDL_LOCATION = url; + CURRENCYCONVERTOR_EXCEPTION = e; + } + + public CurrencyConvertor() { + super(__getWsdlLocation(), CURRENCYCONVERTOR_QNAME); + } + + public CurrencyConvertor(WebServiceFeature... features) { + super(__getWsdlLocation(), CURRENCYCONVERTOR_QNAME, features); + } + + public CurrencyConvertor(URL wsdlLocation) { + super(wsdlLocation, CURRENCYCONVERTOR_QNAME); + } + + public CurrencyConvertor(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, CURRENCYCONVERTOR_QNAME, features); + } + + public CurrencyConvertor(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public CurrencyConvertor(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns CurrencyConvertorSoap + */ + @WebEndpoint(name = "CurrencyConvertorSoap") + public CurrencyConvertorSoap getCurrencyConvertorSoap() { + return super.getPort(new QName("http://www.webserviceX.NET/", "CurrencyConvertorSoap"), CurrencyConvertorSoap.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns CurrencyConvertorSoap + */ + @WebEndpoint(name = "CurrencyConvertorSoap") + public CurrencyConvertorSoap getCurrencyConvertorSoap(WebServiceFeature... features) { + return super.getPort(new QName("http://www.webserviceX.NET/", "CurrencyConvertorSoap"), CurrencyConvertorSoap.class, features); + } + + private static URL __getWsdlLocation() { + if (CURRENCYCONVERTOR_EXCEPTION!= null) { + throw CURRENCYCONVERTOR_EXCEPTION; + } + return CURRENCYCONVERTOR_WSDL_LOCATION; + } + +} diff --git a/src/main/java/net/webservicex/CurrencyConvertorSoap.java b/src/main/java/net/webservicex/CurrencyConvertorSoap.java new file mode 100644 index 0000000..185aef3 --- /dev/null +++ b/src/main/java/net/webservicex/CurrencyConvertorSoap.java @@ -0,0 +1,44 @@ + +package net.webservicex; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebService(name = "CurrencyConvertorSoap", targetNamespace = "http://www.webserviceX.NET/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface CurrencyConvertorSoap { + + + /** + *
Get conversion rate from one currency to another currency

Differenct currency Code and Names around the world

AFA-Afghanistan Afghani
ALL-Albanian Lek
DZD-Algerian Dinar
ARS-Argentine Peso
AWG-Aruba Florin
AUD-Australian Dollar
BSD-Bahamian Dollar
BHD-Bahraini Dinar
BDT-Bangladesh Taka
BBD-Barbados Dollar
BZD-Belize Dollar
BMD-Bermuda Dollar
BTN-Bhutan Ngultrum
BOB-Bolivian Boliviano
BWP-Botswana Pula
BRL-Brazilian Real
GBP-British Pound
BND-Brunei Dollar
BIF-Burundi Franc
XOF-CFA Franc (BCEAO)
XAF-CFA Franc (BEAC)
KHR-Cambodia Riel
CAD-Canadian Dollar
CVE-Cape Verde Escudo
KYD-Cayman Islands Dollar
CLP-Chilean Peso
CNY-Chinese Yuan
COP-Colombian Peso
KMF-Comoros Franc
CRC-Costa Rica Colon
HRK-Croatian Kuna
CUP-Cuban Peso
CYP-Cyprus Pound
CZK-Czech Koruna
DKK-Danish Krone
DJF-Dijibouti Franc
DOP-Dominican Peso
XCD-East Caribbean Dollar
EGP-Egyptian Pound
SVC-El Salvador Colon
EEK-Estonian Kroon
ETB-Ethiopian Birr
EUR-Euro
FKP-Falkland Islands Pound
GMD-Gambian Dalasi
GHC-Ghanian Cedi
GIP-Gibraltar Pound
XAU-Gold Ounces
GTQ-Guatemala Quetzal
GNF-Guinea Franc
GYD-Guyana Dollar
HTG-Haiti Gourde
HNL-Honduras Lempira
HKD-Hong Kong Dollar
HUF-Hungarian Forint
ISK-Iceland Krona
INR-Indian Rupee
IDR-Indonesian Rupiah
IQD-Iraqi Dinar
ILS-Israeli Shekel
JMD-Jamaican Dollar
JPY-Japanese Yen
JOD-Jordanian Dinar
KZT-Kazakhstan Tenge
KES-Kenyan Shilling
KRW-Korean Won
KWD-Kuwaiti Dinar
LAK-Lao Kip
LVL-Latvian Lat
LBP-Lebanese Pound
LSL-Lesotho Loti
LRD-Liberian Dollar
LYD-Libyan Dinar
LTL-Lithuanian Lita
MOP-Macau Pataca
MKD-Macedonian Denar
MGF-Malagasy Franc
MWK-Malawi Kwacha
MYR-Malaysian Ringgit
MVR-Maldives Rufiyaa
MTL-Maltese Lira
MRO-Mauritania Ougulya
MUR-Mauritius Rupee
MXN-Mexican Peso
MDL-Moldovan Leu
MNT-Mongolian Tugrik
MAD-Moroccan Dirham
MZM-Mozambique Metical
MMK-Myanmar Kyat
NAD-Namibian Dollar
NPR-Nepalese Rupee
ANG-Neth Antilles Guilder
NZD-New Zealand Dollar
NIO-Nicaragua Cordoba
NGN-Nigerian Naira
KPW-North Korean Won
NOK-Norwegian Krone
OMR-Omani Rial
XPF-Pacific Franc
PKR-Pakistani Rupee
XPD-Palladium Ounces
PAB-Panama Balboa
PGK-Papua New Guinea Kina
PYG-Paraguayan Guarani
PEN-Peruvian Nuevo Sol
PHP-Philippine Peso
XPT-Platinum Ounces
PLN-Polish Zloty
QAR-Qatar Rial
ROL-Romanian Leu
RUB-Russian Rouble
WST-Samoa Tala
STD-Sao Tome Dobra
SAR-Saudi Arabian Riyal
SCR-Seychelles Rupee
SLL-Sierra Leone Leone
XAG-Silver Ounces
SGD-Singapore Dollar
SKK-Slovak Koruna
SIT-Slovenian Tolar
SBD-Solomon Islands Dollar
SOS-Somali Shilling
ZAR-South African Rand
LKR-Sri Lanka Rupee
SHP-St Helena Pound
SDD-Sudanese Dinar
SRG-Surinam Guilder
SZL-Swaziland Lilageni
SEK-Swedish Krona
TRY-Turkey Lira
CHF-Swiss Franc
SYP-Syrian Pound
TWD-Taiwan Dollar
TZS-Tanzanian Shilling
THB-Thai Baht
TOP-Tonga Pa'anga
TTD-Trinidad&amp;Tobago Dollar
TND-Tunisian Dinar
TRL-Turkish Lira
USD-U.S. Dollar
AED-UAE Dirham
UGX-Ugandan Shilling
UAH-Ukraine Hryvnia
UYU-Uruguayan New Peso
VUV-Vanuatu Vatu
VEB-Venezuelan Bolivar
VND-Vietnam Dong
YER-Yemen Riyal
YUM-Yugoslav Dinar
ZMK-Zambian Kwacha
ZWD-Zimbabwe Dollar

+ * + * @param toCurrency + * @param fromCurrency + * @return + * returns double + */ + @WebMethod(operationName = "ConversionRate", action = "http://www.webserviceX.NET/ConversionRate") + @WebResult(name = "ConversionRateResult", targetNamespace = "http://www.webserviceX.NET/") + @RequestWrapper(localName = "ConversionRate", targetNamespace = "http://www.webserviceX.NET/", className = "net.webservicex.ConversionRate") + @ResponseWrapper(localName = "ConversionRateResponse", targetNamespace = "http://www.webserviceX.NET/", className = "net.webservicex.ConversionRateResponse") + public double conversionRate( + @WebParam(name = "FromCurrency", targetNamespace = "http://www.webserviceX.NET/") + Currency fromCurrency, + @WebParam(name = "ToCurrency", targetNamespace = "http://www.webserviceX.NET/") + Currency toCurrency); + +} diff --git a/src/main/java/net/webservicex/ObjectFactory.java b/src/main/java/net/webservicex/ObjectFactory.java new file mode 100644 index 0000000..cf24281 --- /dev/null +++ b/src/main/java/net/webservicex/ObjectFactory.java @@ -0,0 +1,61 @@ + +package net.webservicex; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the net.webservicex package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _Double_QNAME = new QName("http://www.webserviceX.NET/", "double"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: net.webservicex + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ConversionRate } + * + */ + public ConversionRate createConversionRate() { + return new ConversionRate(); + } + + /** + * Create an instance of {@link ConversionRateResponse } + * + */ + public ConversionRateResponse createConversionRateResponse() { + return new ConversionRateResponse(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link Double }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.webserviceX.NET/", name = "double") + public JAXBElement createDouble(Double value) { + return new JAXBElement(_Double_QNAME, Double.class, null, value); + } + +} diff --git a/src/main/java/net/webservicex/package-info.java b/src/main/java/net/webservicex/package-info.java new file mode 100644 index 0000000..75a1aa8 --- /dev/null +++ b/src/main/java/net/webservicex/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.webserviceX.NET/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package net.webservicex; diff --git a/web/WEB-INF/views/hello.jsp b/web/WEB-INF/views/hello.jsp index 5152595..00e16ac 100644 --- a/web/WEB-INF/views/hello.jsp +++ b/web/WEB-INF/views/hello.jsp @@ -9,6 +9,7 @@

${info}

${answ}

+
<%--
@@ -32,5 +33,6 @@

Без регистрации

<%--
--%>
+ diff --git a/web/WEB-INF/views/resultconvert.jsp b/web/WEB-INF/views/resultconvert.jsp new file mode 100644 index 0000000..39a137f --- /dev/null +++ b/web/WEB-INF/views/resultconvert.jsp @@ -0,0 +1,11 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + +

${fromCurrency} / ${toCurrency}

+${result} + + From eb137a88be1bb7a3b484ef3542bc88afe666518f Mon Sep 17 00:00:00 2001 From: sherXan Date: Wed, 26 Apr 2017 02:50:06 +0300 Subject: [PATCH 4/9] fix conflict --- .../java/io/delivery/config/AppConfig.java | 14 ++++++-------- .../io/delivery/controller/AppController.java | 18 +++++++----------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/main/java/io/delivery/config/AppConfig.java b/src/main/java/io/delivery/config/AppConfig.java index 0f7c9de..bd2c18f 100644 --- a/src/main/java/io/delivery/config/AppConfig.java +++ b/src/main/java/io/delivery/config/AppConfig.java @@ -8,12 +8,9 @@ import io.delivery.model.impl.NewsCreatorImpl; import io.delivery.service.*; import io.delivery.service.impl.*; -<<<<<<< HEAD import net.yandex.speller.services.spellservice.Client; -======= import net.webservicex.ConversionRate; import net.webservicex.CurrencyClient; ->>>>>>> 3be55427a41c3f88d4138f363bf4cc871c5a5385 import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -128,18 +125,19 @@ public CustomerDao customerDao() { } @Bean -<<<<<<< HEAD + public Client client() { return new Client(); -======= - public CurrencyClient currencyClient(){ + } + + @Bean + public CurrencyClient currencyClient() { return new CurrencyClient(); } @Bean - public ConversionRate conversionRate(){ + public ConversionRate conversionRate() { return new ConversionRate(); ->>>>>>> 3be55427a41c3f88d4138f363bf4cc871c5a5385 } } diff --git a/src/main/java/io/delivery/controller/AppController.java b/src/main/java/io/delivery/controller/AppController.java index 21c22d9..1f79b6f 100644 --- a/src/main/java/io/delivery/controller/AppController.java +++ b/src/main/java/io/delivery/controller/AppController.java @@ -4,13 +4,10 @@ import io.delivery.model.Message; import io.delivery.model.TableCreator; import io.delivery.service.*; -<<<<<<< HEAD import net.yandex.speller.services.spellservice.Client; -======= import net.webservicex.ConversionRate; import net.webservicex.Currency; import net.webservicex.CurrencyClient; ->>>>>>> 3be55427a41c3f88d4138f363bf4cc871c5a5385 import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Controller; @@ -44,13 +41,12 @@ public class AppController { @Autowired private Test test; @Autowired -<<<<<<< HEAD private Client client; -======= + @Autowired private CurrencyClient currencyClient; @Autowired private ConversionRate conversionRate; ->>>>>>> 3be55427a41c3f88d4138f363bf4cc871c5a5385 + @RequestMapping(value = {"/password/{password}"}, method = RequestMethod.GET) public ModelAndView passwordEncode(@PathVariable("password") String password) { @@ -94,21 +90,21 @@ public String getDocumentInfo() { return "document"; } -<<<<<<< HEAD @RequestMapping(value = {"/word/{check}"}, method = RequestMethod.GET) public ModelAndView checkWord(@PathVariable("check") String check) throws IOException, SOAPException { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("spell"); modelAndView.addObject("info", client.result(check)); -======= + return modelAndView; + } + @RequestMapping(value = {"/currency/{convert}"}, method = RequestMethod.GET) - public ModelAndView currencyConvertor (@PathVariable("convert") String convert) throws IOException, SOAPException { + public ModelAndView currencyConvertor(@PathVariable("convert") String convert) throws IOException, SOAPException { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("resultconvert"); modelAndView.addObject("result", currencyClient.result()); - modelAndView.addObject("fromCurrency",conversionRate.getFromCurrency()); + modelAndView.addObject("fromCurrency", conversionRate.getFromCurrency()); modelAndView.addObject("toCurrency", conversionRate.getToCurrency()); ->>>>>>> 3be55427a41c3f88d4138f363bf4cc871c5a5385 return modelAndView; } } From dbd8ef3534e52b15087bf609879f36cb71da61ba Mon Sep 17 00:00:00 2001 From: Ayrat Date: Wed, 26 Apr 2017 13:38:34 +0300 Subject: [PATCH 5/9] add soap service --- .../xml/CelsiusToFahrenheit.java | 64 +++++++++++++ .../xml/CelsiusToFahrenheitResponse.java | 64 +++++++++++++ .../www_w3schools_com/xml/ClientTemp.java | 22 +++++ .../xml/FahrenheitToCelsius.java | 64 +++++++++++++ .../xml/FahrenheitToCelsiusResponse.java | 64 +++++++++++++ .../www_w3schools_com/xml/ObjectFactory.java | 77 +++++++++++++++ .../www_w3schools_com/xml/TempConvert.java | 94 +++++++++++++++++++ .../xml/TempConvertSoap.java | 54 +++++++++++ .../www_w3schools_com/xml/package-info.java | 2 + .../java/io/delivery/config/AppConfig.java | 6 ++ .../io/delivery/controller/AppController.java | 14 ++- .../java/net/webservicex/ObjectFactory.java | 30 +++--- web/WEB-INF/views/temperatur.jsp | 9 ++ 13 files changed, 547 insertions(+), 17 deletions(-) create mode 100644 src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheit.java create mode 100644 src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheitResponse.java create mode 100644 src/main/java/https/www_w3schools_com/xml/ClientTemp.java create mode 100644 src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsius.java create mode 100644 src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsiusResponse.java create mode 100644 src/main/java/https/www_w3schools_com/xml/ObjectFactory.java create mode 100644 src/main/java/https/www_w3schools_com/xml/TempConvert.java create mode 100644 src/main/java/https/www_w3schools_com/xml/TempConvertSoap.java create mode 100644 src/main/java/https/www_w3schools_com/xml/package-info.java create mode 100644 web/WEB-INF/views/temperatur.jsp diff --git a/src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheit.java b/src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheit.java new file mode 100644 index 0000000..a1c72f6 --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheit.java @@ -0,0 +1,64 @@ + +package https.www_w3schools_com.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Celsius" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "celsius" +}) +@XmlRootElement(name = "CelsiusToFahrenheit") +public class CelsiusToFahrenheit { + + @XmlElement(name = "Celsius") + protected String celsius; + + /** + * Gets the value of the celsius property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCelsius() { + return celsius; + } + + /** + * Sets the value of the celsius property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCelsius(String value) { + this.celsius = value; + } + +} diff --git a/src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheitResponse.java b/src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheitResponse.java new file mode 100644 index 0000000..5f925bc --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/CelsiusToFahrenheitResponse.java @@ -0,0 +1,64 @@ + +package https.www_w3schools_com.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CelsiusToFahrenheitResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "celsiusToFahrenheitResult" +}) +@XmlRootElement(name = "CelsiusToFahrenheitResponse") +public class CelsiusToFahrenheitResponse { + + @XmlElement(name = "CelsiusToFahrenheitResult") + protected String celsiusToFahrenheitResult; + + /** + * Gets the value of the celsiusToFahrenheitResult property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCelsiusToFahrenheitResult() { + return celsiusToFahrenheitResult; + } + + /** + * Sets the value of the celsiusToFahrenheitResult property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCelsiusToFahrenheitResult(String value) { + this.celsiusToFahrenheitResult = value; + } + +} diff --git a/src/main/java/https/www_w3schools_com/xml/ClientTemp.java b/src/main/java/https/www_w3schools_com/xml/ClientTemp.java new file mode 100644 index 0000000..029f629 --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/ClientTemp.java @@ -0,0 +1,22 @@ +package https.www_w3schools_com.xml; + +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.ws.Service; +import java.io.IOException; +import java.net.URL; + +public class ClientTemp { + private static final String ADDRESS = "https://www.w3schools.com/xml/tempconvert.asmx?WSDL"; + + public ClientTemp() { + } + + public String result(String convert) throws SOAPException, IOException { + URL url = new URL(ADDRESS); + QName qName = new QName("https://www.w3schools.com/xml/", "TempConvert"); + Service service = Service.create(url, qName); + TempConvertSoap hello = service.getPort(TempConvertSoap.class); + return hello.celsiusToFahrenheit(convert); + } +} diff --git a/src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsius.java b/src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsius.java new file mode 100644 index 0000000..2ddce77 --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsius.java @@ -0,0 +1,64 @@ + +package https.www_w3schools_com.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Fahrenheit" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "fahrenheit" +}) +@XmlRootElement(name = "FahrenheitToCelsius") +public class FahrenheitToCelsius { + + @XmlElement(name = "Fahrenheit") + protected String fahrenheit; + + /** + * Gets the value of the fahrenheit property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFahrenheit() { + return fahrenheit; + } + + /** + * Sets the value of the fahrenheit property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFahrenheit(String value) { + this.fahrenheit = value; + } + +} diff --git a/src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsiusResponse.java b/src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsiusResponse.java new file mode 100644 index 0000000..39a629c --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/FahrenheitToCelsiusResponse.java @@ -0,0 +1,64 @@ + +package https.www_w3schools_com.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="FahrenheitToCelsiusResult" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "fahrenheitToCelsiusResult" +}) +@XmlRootElement(name = "FahrenheitToCelsiusResponse") +public class FahrenheitToCelsiusResponse { + + @XmlElement(name = "FahrenheitToCelsiusResult") + protected String fahrenheitToCelsiusResult; + + /** + * Gets the value of the fahrenheitToCelsiusResult property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFahrenheitToCelsiusResult() { + return fahrenheitToCelsiusResult; + } + + /** + * Sets the value of the fahrenheitToCelsiusResult property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFahrenheitToCelsiusResult(String value) { + this.fahrenheitToCelsiusResult = value; + } + +} diff --git a/src/main/java/https/www_w3schools_com/xml/ObjectFactory.java b/src/main/java/https/www_w3schools_com/xml/ObjectFactory.java new file mode 100644 index 0000000..bcf6695 --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/ObjectFactory.java @@ -0,0 +1,77 @@ + +package https.www_w3schools_com.xml; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the https.www_w3schools_com.xml package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _String_QNAME = new QName("https://www.w3schools.com/xml/", "string"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: https.www_w3schools_com.xml + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link CelsiusToFahrenheit } + * + */ + public CelsiusToFahrenheit createCelsiusToFahrenheit() { + return new CelsiusToFahrenheit(); + } + + /** + * Create an instance of {@link FahrenheitToCelsius } + * + */ + public FahrenheitToCelsius createFahrenheitToCelsius() { + return new FahrenheitToCelsius(); + } + + /** + * Create an instance of {@link FahrenheitToCelsiusResponse } + * + */ + public FahrenheitToCelsiusResponse createFahrenheitToCelsiusResponse() { + return new FahrenheitToCelsiusResponse(); + } + + /** + * Create an instance of {@link CelsiusToFahrenheitResponse } + * + */ + public CelsiusToFahrenheitResponse createCelsiusToFahrenheitResponse() { + return new CelsiusToFahrenheitResponse(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "https://www.w3schools.com/xml/", name = "string") + public JAXBElement createString(String value) { + return new JAXBElement(_String_QNAME, String.class, null, value); + } + +} diff --git a/src/main/java/https/www_w3schools_com/xml/TempConvert.java b/src/main/java/https/www_w3schools_com/xml/TempConvert.java new file mode 100644 index 0000000..b6ca269 --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/TempConvert.java @@ -0,0 +1,94 @@ + +package https.www_w3schools_com.xml; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "TempConvert", targetNamespace = "https://www.w3schools.com/xml/", wsdlLocation = "https://www.w3schools.com/xml/tempconvert.asmx?WSDL") +public class TempConvert + extends Service +{ + + private final static URL TEMPCONVERT_WSDL_LOCATION; + private final static WebServiceException TEMPCONVERT_EXCEPTION; + private final static QName TEMPCONVERT_QNAME = new QName("https://www.w3schools.com/xml/", "TempConvert"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL("https://www.w3schools.com/xml/tempconvert.asmx?WSDL"); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + TEMPCONVERT_WSDL_LOCATION = url; + TEMPCONVERT_EXCEPTION = e; + } + + public TempConvert() { + super(__getWsdlLocation(), TEMPCONVERT_QNAME); + } + + public TempConvert(WebServiceFeature... features) { + super(__getWsdlLocation(), TEMPCONVERT_QNAME, features); + } + + public TempConvert(URL wsdlLocation) { + super(wsdlLocation, TEMPCONVERT_QNAME); + } + + public TempConvert(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, TEMPCONVERT_QNAME, features); + } + + public TempConvert(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public TempConvert(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns TempConvertSoap + */ + @WebEndpoint(name = "TempConvertSoap") + public TempConvertSoap getTempConvertSoap() { + return super.getPort(new QName("https://www.w3schools.com/xml/", "TempConvertSoap"), TempConvertSoap.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns TempConvertSoap + */ + @WebEndpoint(name = "TempConvertSoap") + public TempConvertSoap getTempConvertSoap(WebServiceFeature... features) { + return super.getPort(new QName("https://www.w3schools.com/xml/", "TempConvertSoap"), TempConvertSoap.class, features); + } + + private static URL __getWsdlLocation() { + if (TEMPCONVERT_EXCEPTION!= null) { + throw TEMPCONVERT_EXCEPTION; + } + return TEMPCONVERT_WSDL_LOCATION; + } + +} diff --git a/src/main/java/https/www_w3schools_com/xml/TempConvertSoap.java b/src/main/java/https/www_w3schools_com/xml/TempConvertSoap.java new file mode 100644 index 0000000..73fba7f --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/TempConvertSoap.java @@ -0,0 +1,54 @@ + +package https.www_w3schools_com.xml; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebService(name = "TempConvertSoap", targetNamespace = "https://www.w3schools.com/xml/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface TempConvertSoap { + + + /** + * + * @param fahrenheit + * @return + * returns java.lang.String + */ + @WebMethod(operationName = "FahrenheitToCelsius", action = "https://www.w3schools.com/xml/FahrenheitToCelsius") + @WebResult(name = "FahrenheitToCelsiusResult", targetNamespace = "https://www.w3schools.com/xml/") + @RequestWrapper(localName = "FahrenheitToCelsius", targetNamespace = "https://www.w3schools.com/xml/", className = "https.www_w3schools_com.xml.FahrenheitToCelsius") + @ResponseWrapper(localName = "FahrenheitToCelsiusResponse", targetNamespace = "https://www.w3schools.com/xml/", className = "https.www_w3schools_com.xml.FahrenheitToCelsiusResponse") + public String fahrenheitToCelsius( + @WebParam(name = "Fahrenheit", targetNamespace = "https://www.w3schools.com/xml/") + String fahrenheit); + + /** + * + * @param celsius + * @return + * returns java.lang.String + */ + @WebMethod(operationName = "CelsiusToFahrenheit", action = "https://www.w3schools.com/xml/CelsiusToFahrenheit") + @WebResult(name = "CelsiusToFahrenheitResult", targetNamespace = "https://www.w3schools.com/xml/") + @RequestWrapper(localName = "CelsiusToFahrenheit", targetNamespace = "https://www.w3schools.com/xml/", className = "https.www_w3schools_com.xml.CelsiusToFahrenheit") + @ResponseWrapper(localName = "CelsiusToFahrenheitResponse", targetNamespace = "https://www.w3schools.com/xml/", className = "https.www_w3schools_com.xml.CelsiusToFahrenheitResponse") + public String celsiusToFahrenheit( + @WebParam(name = "Celsius", targetNamespace = "https://www.w3schools.com/xml/") + String celsius); + +} diff --git a/src/main/java/https/www_w3schools_com/xml/package-info.java b/src/main/java/https/www_w3schools_com/xml/package-info.java new file mode 100644 index 0000000..5c04403 --- /dev/null +++ b/src/main/java/https/www_w3schools_com/xml/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "https://www.w3schools.com/xml/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package https.www_w3schools_com.xml; diff --git a/src/main/java/io/delivery/config/AppConfig.java b/src/main/java/io/delivery/config/AppConfig.java index bd2c18f..fa45c71 100644 --- a/src/main/java/io/delivery/config/AppConfig.java +++ b/src/main/java/io/delivery/config/AppConfig.java @@ -1,5 +1,6 @@ package io.delivery.config; +import https.www_w3schools_com.xml.ClientTemp; import io.delivery.dao.*; import io.delivery.dao.impl.*; import io.delivery.entity.*; @@ -139,5 +140,10 @@ public CurrencyClient currencyClient() { public ConversionRate conversionRate() { return new ConversionRate(); } + + @Bean + public ClientTemp clientTemp() { + return new ClientTemp(); + } } diff --git a/src/main/java/io/delivery/controller/AppController.java b/src/main/java/io/delivery/controller/AppController.java index 1f79b6f..1c8107b 100644 --- a/src/main/java/io/delivery/controller/AppController.java +++ b/src/main/java/io/delivery/controller/AppController.java @@ -1,13 +1,13 @@ package io.delivery.controller; +import https.www_w3schools_com.xml.ClientTemp; import io.delivery.model.Answer; import io.delivery.model.Message; import io.delivery.model.TableCreator; import io.delivery.service.*; -import net.yandex.speller.services.spellservice.Client; import net.webservicex.ConversionRate; -import net.webservicex.Currency; import net.webservicex.CurrencyClient; +import net.yandex.speller.services.spellservice.Client; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Controller; @@ -46,6 +46,8 @@ public class AppController { private CurrencyClient currencyClient; @Autowired private ConversionRate conversionRate; + @Autowired + private ClientTemp clientTemp; @RequestMapping(value = {"/password/{password}"}, method = RequestMethod.GET) @@ -107,4 +109,12 @@ public ModelAndView currencyConvertor(@PathVariable("convert") String convert) t modelAndView.addObject("toCurrency", conversionRate.getToCurrency()); return modelAndView; } + + @RequestMapping(value = {"/temp/{convert}"}, method = RequestMethod.GET) + public ModelAndView convertTemp(@PathVariable("convert") String convert) throws IOException, SOAPException { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("temperatur"); + modelAndView.addObject("convertTemp", clientTemp.result(convert)); + return modelAndView; + } } diff --git a/src/main/java/net/webservicex/ObjectFactory.java b/src/main/java/net/webservicex/ObjectFactory.java index cf24281..e9859da 100644 --- a/src/main/java/net/webservicex/ObjectFactory.java +++ b/src/main/java/net/webservicex/ObjectFactory.java @@ -8,18 +8,18 @@ /** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the net.webservicex package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the net.webservicex package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are * provided in this class. - * + * */ @XmlRegistry public class ObjectFactory { @@ -28,14 +28,14 @@ public class ObjectFactory { /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: net.webservicex - * + * */ public ObjectFactory() { } /** * Create an instance of {@link ConversionRate } - * + * */ public ConversionRate createConversionRate() { return new ConversionRate(); @@ -43,7 +43,7 @@ public ConversionRate createConversionRate() { /** * Create an instance of {@link ConversionRateResponse } - * + * */ public ConversionRateResponse createConversionRateResponse() { return new ConversionRateResponse(); @@ -51,7 +51,7 @@ public ConversionRateResponse createConversionRateResponse() { /** * Create an instance of {@link JAXBElement }{@code <}{@link Double }{@code >}} - * + * */ @XmlElementDecl(namespace = "http://www.webserviceX.NET/", name = "double") public JAXBElement createDouble(Double value) { diff --git a/web/WEB-INF/views/temperatur.jsp b/web/WEB-INF/views/temperatur.jsp new file mode 100644 index 0000000..529176f --- /dev/null +++ b/web/WEB-INF/views/temperatur.jsp @@ -0,0 +1,9 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + ${convertTemp} + + From d44df98fcbebc4667ca8aabb6af616cece5f407f Mon Sep 17 00:00:00 2001 From: sherXan Date: Wed, 26 Apr 2017 19:45:32 +0300 Subject: [PATCH 6/9] add @RequestParam to CurrencyConvertor --- .../java/io/delivery/controller/AppController.java | 14 ++++++++++---- src/main/java/net/webservicex/CurrencyClient.java | 6 +++--- web/WEB-INF/views/hello.jsp | 4 ++-- web/WEB-INF/views/resultconvert.jsp | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/delivery/controller/AppController.java b/src/main/java/io/delivery/controller/AppController.java index 1c8107b..66631df 100644 --- a/src/main/java/io/delivery/controller/AppController.java +++ b/src/main/java/io/delivery/controller/AppController.java @@ -6,6 +6,7 @@ import io.delivery.model.TableCreator; import io.delivery.service.*; import net.webservicex.ConversionRate; +import net.webservicex.Currency; import net.webservicex.CurrencyClient; import net.yandex.speller.services.spellservice.Client; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import javax.xml.soap.SOAPException; @@ -101,16 +103,20 @@ public ModelAndView checkWord(@PathVariable("check") String check) throws IOExce } @RequestMapping(value = {"/currency/{convert}"}, method = RequestMethod.GET) - public ModelAndView currencyConvertor(@PathVariable("convert") String convert) throws IOException, SOAPException { + /** + * http://localhost:8080/currency/CAD?to=EUR + */ + public ModelAndView currencyConvertor(@PathVariable("convert") Currency convert, + @RequestParam (value = "to") Currency toCurrency) throws IOException, SOAPException { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("resultconvert"); - modelAndView.addObject("result", currencyClient.result()); + modelAndView.addObject("result", currencyClient.result(convert, toCurrency)); modelAndView.addObject("fromCurrency", conversionRate.getFromCurrency()); - modelAndView.addObject("toCurrency", conversionRate.getToCurrency()); + modelAndView.addObject("to", conversionRate.getToCurrency()); return modelAndView; } - @RequestMapping(value = {"/temp/{convert}"}, method = RequestMethod.GET) + @RequestMapping(value = {"/temp/{convert}"}, method = RequestMethod.GET) public ModelAndView convertTemp(@PathVariable("convert") String convert) throws IOException, SOAPException { ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("temperatur"); diff --git a/src/main/java/net/webservicex/CurrencyClient.java b/src/main/java/net/webservicex/CurrencyClient.java index 03e87a4..032542e 100644 --- a/src/main/java/net/webservicex/CurrencyClient.java +++ b/src/main/java/net/webservicex/CurrencyClient.java @@ -16,14 +16,14 @@ public class CurrencyClient { public CurrencyClient() { } - public double result() throws SOAPException, IOException { + public double result(Currency fromCurrency, Currency toCurrency) throws SOAPException, IOException { URL url = new URL(ADDRESS); QName qName = new QName("http://www.webserviceX.NET/", "CurrencyConvertor"); Service service = Service.create(url, qName); CurrencyConvertorSoap convertorSoap = service.getPort(CurrencyConvertorSoap.class); - conversionRate.setFromCurrency(Currency.EUR); - conversionRate.setToCurrency(Currency.RUB); + conversionRate.setFromCurrency(fromCurrency); + conversionRate.setToCurrency(toCurrency); return convertorSoap.conversionRate(conversionRate.getFromCurrency(), conversionRate.getToCurrency()); } diff --git a/web/WEB-INF/views/hello.jsp b/web/WEB-INF/views/hello.jsp index 00e16ac..df665e1 100644 --- a/web/WEB-INF/views/hello.jsp +++ b/web/WEB-INF/views/hello.jsp @@ -16,9 +16,9 @@ <%--method="post"--%> <%--action="/registration">--%>

-

Регистрация

+

Регистрация


-

Телефон/Электронная почта

+

Телефон/Электронная почта

diff --git a/web/WEB-INF/views/resultconvert.jsp b/web/WEB-INF/views/resultconvert.jsp index 39a137f..fd598a2 100644 --- a/web/WEB-INF/views/resultconvert.jsp +++ b/web/WEB-INF/views/resultconvert.jsp @@ -5,7 +5,7 @@ -

${fromCurrency} / ${toCurrency}

+

${fromCurrency} / ${to}

${result} From 0dfbf076f0d065a7354ec9c910a9eee32f98db3f Mon Sep 17 00:00:00 2001 From: Ayrat Date: Sat, 29 Apr 2017 13:19:45 +0300 Subject: [PATCH 7/9] add soap service integration --- .../java/io/delivery/config/AppConfig.java | 6 + .../io/delivery/controller/AppController.java | 11 ++ src/main/java/t320/nks34/HelloClient.java | 25 ++++ src/main/java/t320/nks34/HelloName.java | 65 ++++++++++ .../java/t320/nks34/HelloNameResponse.java | 65 ++++++++++ src/main/java/t320/nks34/HelloService.java | 116 ++++++++++++++++++ .../java/t320/nks34/HelloServicePortType.java | 40 ++++++ src/main/java/t320/nks34/ObjectFactory.java | 71 +++++++++++ src/main/java/t320/nks34/package-info.java | 6 + web/WEB-INF/views/soap.jsp | 9 ++ web/WEB-INF/views/test.jsp | 7 -- 11 files changed, 414 insertions(+), 7 deletions(-) create mode 100644 src/main/java/t320/nks34/HelloClient.java create mode 100644 src/main/java/t320/nks34/HelloName.java create mode 100644 src/main/java/t320/nks34/HelloNameResponse.java create mode 100644 src/main/java/t320/nks34/HelloService.java create mode 100644 src/main/java/t320/nks34/HelloServicePortType.java create mode 100644 src/main/java/t320/nks34/ObjectFactory.java create mode 100644 src/main/java/t320/nks34/package-info.java create mode 100644 web/WEB-INF/views/soap.jsp diff --git a/src/main/java/io/delivery/config/AppConfig.java b/src/main/java/io/delivery/config/AppConfig.java index fa45c71..7054423 100644 --- a/src/main/java/io/delivery/config/AppConfig.java +++ b/src/main/java/io/delivery/config/AppConfig.java @@ -21,6 +21,7 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl; +import t320.nks34.HelloClient; @Configuration @PropertySource(value = {"classpath:util.properties"}) @@ -145,5 +146,10 @@ public ConversionRate conversionRate() { public ClientTemp clientTemp() { return new ClientTemp(); } + + @Bean + public HelloClient helloClient() { + return new HelloClient(); + } } diff --git a/src/main/java/io/delivery/controller/AppController.java b/src/main/java/io/delivery/controller/AppController.java index 66631df..a42399b 100644 --- a/src/main/java/io/delivery/controller/AppController.java +++ b/src/main/java/io/delivery/controller/AppController.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; +import t320.nks34.HelloClient; import javax.xml.soap.SOAPException; import java.io.IOException; @@ -50,6 +51,8 @@ public class AppController { private ConversionRate conversionRate; @Autowired private ClientTemp clientTemp; + @Autowired + private HelloClient helloClient; @RequestMapping(value = {"/password/{password}"}, method = RequestMethod.GET) @@ -123,4 +126,12 @@ public ModelAndView convertTemp(@PathVariable("convert") String convert) throws modelAndView.addObject("convertTemp", clientTemp.result(convert)); return modelAndView; } + + @RequestMapping(value = {"/testSoap/{check}"}, method = RequestMethod.GET) + public ModelAndView testSoap(@PathVariable("check") String check) throws IOException, SOAPException { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("soap"); + modelAndView.addObject("test", helloClient.result(check)); + return modelAndView; + } } diff --git a/src/main/java/t320/nks34/HelloClient.java b/src/main/java/t320/nks34/HelloClient.java new file mode 100644 index 0000000..b484718 --- /dev/null +++ b/src/main/java/t320/nks34/HelloClient.java @@ -0,0 +1,25 @@ +package t320.nks34; + +import javax.xml.bind.JAXBElement; +import javax.xml.namespace.QName; +import javax.xml.soap.SOAPException; +import javax.xml.ws.Service; +import java.io.IOException; +import java.net.URL; + +public class HelloClient { + private static final String ADDRESS = "http://t320webservices.open.ac.uk/t320/services/HelloService?wsdl"; + + public HelloClient() { + } + + public String result(String check) throws SOAPException, IOException{ + URL url = new URL(ADDRESS); + QName qName = new QName("http://nks34.t320", "HelloService"); + Service service = Service.create(url, qName); + HelloServicePortType hello = service.getPort(HelloServicePortType.class); + HelloName helloName = new HelloName(); + helloName.setName(new JAXBElement<>(qName, String.class, check)); + return helloName.getName().toString(); + } +} diff --git a/src/main/java/t320/nks34/HelloName.java b/src/main/java/t320/nks34/HelloName.java new file mode 100644 index 0000000..9d505ff --- /dev/null +++ b/src/main/java/t320/nks34/HelloName.java @@ -0,0 +1,65 @@ + +package t320.nks34; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "name" +}) +@XmlRootElement(name = "helloName") +public class HelloName { + + @XmlElementRef(name = "name", namespace = "http://nks34.t320", type = JAXBElement.class, required = false) + protected JAXBElement name; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setName(JAXBElement value) { + this.name = value; + } + +} diff --git a/src/main/java/t320/nks34/HelloNameResponse.java b/src/main/java/t320/nks34/HelloNameResponse.java new file mode 100644 index 0000000..41d94c8 --- /dev/null +++ b/src/main/java/t320/nks34/HelloNameResponse.java @@ -0,0 +1,65 @@ + +package t320.nks34; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "_return" +}) +@XmlRootElement(name = "helloNameResponse") +public class HelloNameResponse { + + @XmlElementRef(name = "return", namespace = "http://nks34.t320", type = JAXBElement.class, required = false) + protected JAXBElement _return; + + /** + * Gets the value of the return property. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public JAXBElement getReturn() { + return _return; + } + + /** + * Sets the value of the return property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link String }{@code >} + * + */ + public void setReturn(JAXBElement value) { + this._return = value; + } + +} diff --git a/src/main/java/t320/nks34/HelloService.java b/src/main/java/t320/nks34/HelloService.java new file mode 100644 index 0000000..c030ec5 --- /dev/null +++ b/src/main/java/t320/nks34/HelloService.java @@ -0,0 +1,116 @@ + +package t320.nks34; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "HelloService", targetNamespace = "http://nks34.t320", wsdlLocation = "http://t320webservices.open.ac.uk/t320/services/HelloService?wsdl") +public class HelloService + extends Service +{ + + private final static URL HELLOSERVICE_WSDL_LOCATION; + private final static WebServiceException HELLOSERVICE_EXCEPTION; + private final static QName HELLOSERVICE_QNAME = new QName("http://nks34.t320", "HelloService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL("http://t320webservices.open.ac.uk/t320/services/HelloService?wsdl"); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + HELLOSERVICE_WSDL_LOCATION = url; + HELLOSERVICE_EXCEPTION = e; + } + + public HelloService() { + super(__getWsdlLocation(), HELLOSERVICE_QNAME); + } + + public HelloService(WebServiceFeature... features) { + super(__getWsdlLocation(), HELLOSERVICE_QNAME, features); + } + + public HelloService(URL wsdlLocation) { + super(wsdlLocation, HELLOSERVICE_QNAME); + } + + public HelloService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, HELLOSERVICE_QNAME, features); + } + + public HelloService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public HelloService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns HelloServicePortType + */ + @WebEndpoint(name = "HelloServiceSOAP11port_https") + public HelloServicePortType getHelloServiceSOAP11PortHttps() { + return super.getPort(new QName("http://nks34.t320", "HelloServiceSOAP11port_https"), HelloServicePortType.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns HelloServicePortType + */ + @WebEndpoint(name = "HelloServiceSOAP11port_https") + public HelloServicePortType getHelloServiceSOAP11PortHttps(WebServiceFeature... features) { + return super.getPort(new QName("http://nks34.t320", "HelloServiceSOAP11port_https"), HelloServicePortType.class, features); + } + + /** + * + * @return + * returns HelloServicePortType + */ + @WebEndpoint(name = "HelloServiceSOAP11port_http1") + public HelloServicePortType getHelloServiceSOAP11PortHttp1() { + return super.getPort(new QName("http://nks34.t320", "HelloServiceSOAP11port_http1"), HelloServicePortType.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns HelloServicePortType + */ + @WebEndpoint(name = "HelloServiceSOAP11port_http1") + public HelloServicePortType getHelloServiceSOAP11PortHttp1(WebServiceFeature... features) { + return super.getPort(new QName("http://nks34.t320", "HelloServiceSOAP11port_http1"), HelloServicePortType.class, features); + } + + private static URL __getWsdlLocation() { + if (HELLOSERVICE_EXCEPTION!= null) { + throw HELLOSERVICE_EXCEPTION; + } + return HELLOSERVICE_WSDL_LOCATION; + } + +} diff --git a/src/main/java/t320/nks34/HelloServicePortType.java b/src/main/java/t320/nks34/HelloServicePortType.java new file mode 100644 index 0000000..a865000 --- /dev/null +++ b/src/main/java/t320/nks34/HelloServicePortType.java @@ -0,0 +1,40 @@ + +package t320.nks34; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.9-b130926.1035 + * Generated source version: 2.2 + * + */ +@WebService(name = "HelloServicePortType", targetNamespace = "http://nks34.t320") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface HelloServicePortType { + + + /** + * + * @param name + * @return + * returns java.lang.String + */ + @WebMethod(action = "urn:helloName") + @WebResult(targetNamespace = "http://nks34.t320") + @RequestWrapper(localName = "helloName", targetNamespace = "http://nks34.t320", className = "t320.nks34.HelloName") + @ResponseWrapper(localName = "helloNameResponse", targetNamespace = "http://nks34.t320", className = "t320.nks34.HelloNameResponse") + public String helloName( + @WebParam(name = "name", targetNamespace = "http://nks34.t320") + String name); + +} diff --git a/src/main/java/t320/nks34/ObjectFactory.java b/src/main/java/t320/nks34/ObjectFactory.java new file mode 100644 index 0000000..8f4705a --- /dev/null +++ b/src/main/java/t320/nks34/ObjectFactory.java @@ -0,0 +1,71 @@ + +package t320.nks34; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the t320.nks34 package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _HelloNameResponseReturn_QNAME = new QName("http://nks34.t320", "return"); + private final static QName _HelloNameName_QNAME = new QName("http://nks34.t320", "name"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: t320.nks34 + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link HelloNameResponse } + * + */ + public HelloNameResponse createHelloNameResponse() { + return new HelloNameResponse(); + } + + /** + * Create an instance of {@link HelloName } + * + */ + public HelloName createHelloName() { + return new HelloName(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://nks34.t320", name = "return", scope = HelloNameResponse.class) + public JAXBElement createHelloNameResponseReturn(String value) { + return new JAXBElement(_HelloNameResponseReturn_QNAME, String.class, HelloNameResponse.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://nks34.t320", name = "name", scope = HelloName.class) + public JAXBElement createHelloNameName(String value) { + return new JAXBElement(_HelloNameName_QNAME, String.class, HelloName.class, value); + } + +} diff --git a/src/main/java/t320/nks34/package-info.java b/src/main/java/t320/nks34/package-info.java new file mode 100644 index 0000000..2aaa65d --- /dev/null +++ b/src/main/java/t320/nks34/package-info.java @@ -0,0 +1,6 @@ +/** + * HelloService + * + */ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://nks34.t320", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package t320.nks34; diff --git a/web/WEB-INF/views/soap.jsp b/web/WEB-INF/views/soap.jsp new file mode 100644 index 0000000..77fa157 --- /dev/null +++ b/web/WEB-INF/views/soap.jsp @@ -0,0 +1,9 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + +${test} + + diff --git a/web/WEB-INF/views/test.jsp b/web/WEB-INF/views/test.jsp index 6d7ba6c..bb6e13f 100644 --- a/web/WEB-INF/views/test.jsp +++ b/web/WEB-INF/views/test.jsp @@ -1,10 +1,3 @@ -<%-- - Created by IntelliJ IDEA. - User: ccomo - Date: 29.03.2017 - Time: 20:31 - To change this template use File | Settings | File Templates. ---%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> From 95ea52292a502598d0020ecba76993bbc0d430ed Mon Sep 17 00:00:00 2001 From: sherXan Date: Wed, 3 May 2017 19:38:01 +0300 Subject: [PATCH 8/9] refactor noregistration.jsp --- .../NoRegistrationCustomerController.java | 2 +- ...oRegistratioinCustomerIntegrationTest.java | 2 - web/WEB-INF/views/noregistration.jsp | 137 +++++++++++++----- web/WEB-INF/views/registration.jsp | 86 ++++++----- 4 files changed, 150 insertions(+), 77 deletions(-) diff --git a/src/main/java/io/delivery/controller/NoRegistrationCustomerController.java b/src/main/java/io/delivery/controller/NoRegistrationCustomerController.java index c637238..7dd583b 100644 --- a/src/main/java/io/delivery/controller/NoRegistrationCustomerController.java +++ b/src/main/java/io/delivery/controller/NoRegistrationCustomerController.java @@ -9,7 +9,7 @@ import java.util.List; @Controller -@RequestMapping("/noregcustomer") +@RequestMapping("/noregistration") public class NoRegistrationCustomerController { final private NoRegistrationCustomerService noRegistrationCustomerService; diff --git a/src/test/java/io/delivery/entity/NoRegistratioinCustomerIntegrationTest.java b/src/test/java/io/delivery/entity/NoRegistratioinCustomerIntegrationTest.java index ec1a23a..80dde70 100644 --- a/src/test/java/io/delivery/entity/NoRegistratioinCustomerIntegrationTest.java +++ b/src/test/java/io/delivery/entity/NoRegistratioinCustomerIntegrationTest.java @@ -1,7 +1,5 @@ package io.delivery.entity; -import io.delivery.entity.Document; -import io.delivery.entity.NoRegistrationCustomer; import org.junit.Test; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.*; diff --git a/web/WEB-INF/views/noregistration.jsp b/web/WEB-INF/views/noregistration.jsp index d29cbe3..266b6df 100644 --- a/web/WEB-INF/views/noregistration.jsp +++ b/web/WEB-INF/views/noregistration.jsp @@ -1,35 +1,102 @@ -<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%> -<%----%> -<%----%> - <%--Title--%> - <%----%> - <%----%> -<%----%> -<%----%> -<%----%> - <%--
--%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%--
--%> - <%--Регистрация--%> - <%--
Имя
Телефон
Адрес доставки
--%> - <%----%> - <%----%> - <%--
--%> -<%--

--%> -<%----%> -<%----%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + + +
+
+
+

Данные для заказа

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+ + + + + + + + + + + + + +
IDNAME
Get NoregCustomer by idGET/noregistration/get/id/{id} + Id: + +
+
+
+ RESPONSE +
+
+
+ + + diff --git a/web/WEB-INF/views/registration.jsp b/web/WEB-INF/views/registration.jsp index 946f3b7..11a963b 100644 --- a/web/WEB-INF/views/registration.jsp +++ b/web/WEB-INF/views/registration.jsp @@ -1,39 +1,47 @@ -<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%> -<%----%> -<%----%> - <%--Title--%> - <%----%> - <%----%> -<%----%> -<%----%> -<%----%> - <%--
--%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%----%> - <%--
--%> - <%--Регистрация--%> - <%--
Имя
Адрес
Телефон
Электронная почта
--%> - <%----%> - <%----%> - <%--
--%> - <%--
--%> -<%----%> -<%----%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + +
+
+
+

РЕГИСТРАЦИЯ

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+ + + From b866aea46a4cec4abd7315e575464bf6c46584a8 Mon Sep 17 00:00:00 2001 From: sherXan Date: Wed, 10 May 2017 11:38:56 +0300 Subject: [PATCH 9/9] add customer.jsp refactor hello, noregistration --- .../io/delivery/controller/AppController.java | 6 +- web/WEB-INF/views/customer.jsp | 82 +++++++++++++++++++ web/WEB-INF/views/hello.jsp | 47 ++++++----- web/WEB-INF/views/noregistration.jsp | 31 +++---- 4 files changed, 128 insertions(+), 38 deletions(-) create mode 100644 web/WEB-INF/views/customer.jsp diff --git a/src/main/java/io/delivery/controller/AppController.java b/src/main/java/io/delivery/controller/AppController.java index a42399b..1b6f19c 100644 --- a/src/main/java/io/delivery/controller/AppController.java +++ b/src/main/java/io/delivery/controller/AppController.java @@ -82,9 +82,9 @@ public String secure() { return "/secure"; } - @RequestMapping(value = "/registration") - public String registration() { - return "/registration"; + @RequestMapping(value = "/customer") + public String customer() { + return "/customer"; } @RequestMapping(value = "/noregistration") diff --git a/web/WEB-INF/views/customer.jsp b/web/WEB-INF/views/customer.jsp new file mode 100644 index 0000000..c822580 --- /dev/null +++ b/web/WEB-INF/views/customer.jsp @@ -0,0 +1,82 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + Title + + + + + + +
+
+
+

РЕГИСТРАЦИЯ

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+
+
+ RESPONSE +
+
+
+ + + diff --git a/web/WEB-INF/views/hello.jsp b/web/WEB-INF/views/hello.jsp index df665e1..5448bad 100644 --- a/web/WEB-INF/views/hello.jsp +++ b/web/WEB-INF/views/hello.jsp @@ -11,27 +11,32 @@

${answ}

-
- <%--
- <%--method="post"--%> - <%--action="/registration">--%> -

-

Регистрация

-
-

Телефон/Электронная почта

-

-

-

-
-

- ??? ВХОД ЧЕРЕЗ СОЦСЕТИ ??? -

-

-

Вы у нас впервые?

-

-

Регистрация

-

Без регистрации

- <%--
--%> +
+
+
+

Вход

+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+

Вы у нас впервые?

+

+

Регистрация

+

Без регистрации

+
+
+
diff --git a/web/WEB-INF/views/noregistration.jsp b/web/WEB-INF/views/noregistration.jsp index 266b6df..ef3db10 100644 --- a/web/WEB-INF/views/noregistration.jsp +++ b/web/WEB-INF/views/noregistration.jsp @@ -22,11 +22,11 @@ } }) } - var RestPost = function (client_name) { + var RestPost = function (client_name, postPhone, address) { var JSONObject = { 'name': client_name, - 'phoneNumber': "5555555555555555", - 'address': "Klond" + 'phoneNumber': postPhone, + 'address': address } $.ajax({ type: 'POST', @@ -37,7 +37,6 @@ async: false, success: function (result) { $('#response').html(JSON.stringify(result)); - }, error: function (jqXHR, textStatus, errorThrown) { $('#response').html(JSON.stringify(jqXHR)); @@ -46,35 +45,39 @@ }; +
+
+

Данные для заказа

+
+
-
-

Данные для заказа

-
- +
- +
- +
- +
- +
- @@ -90,7 +93,7 @@ -
+
RESPONSE