Есть проблема - я написал веб сервис, клиент которого адекватно генерил заглушки, и каким то образом перестал это делать. Написан сервер, рабочий сервер, у него есть wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8 svn-revision#13980. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8 svn-revision#13980. -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://util/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://util/" name="HibernateWebServiceImplService">
<import namespace="http://service/" location="http://localhost:8080/ChallengeServer/?wsdl=1" />
<binding xmlns:ns1="http://service/" name="HibernateWebServiceImplPortBinding" type="ns1:HibernateWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<operation name="save">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://service/" />
</input>
<output>
<soap:body use="literal" namespace="http://service/" />
</output>
</operation>
<operation name="getUserPurchases">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://service/" />
</input>
<output>
<soap:body use="literal" namespace="http://service/" />
</output>
</operation>
<operation name="getAllProducts">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://service/" />
</input>
<output>
<soap:body use="literal" namespace="http://service/" />
</output>
</operation>
<operation name="findByUser">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://service/" />
</input>
<output>
<soap:body use="literal" namespace="http://service/" />
</output>
</operation>
<operation name="openSession">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://service/" />
</input>
<output>
<soap:body use="literal" namespace="http://service/" />
</output>
</operation>
<operation name="closeSession">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://service/" />
</input>
<output>
<soap:body use="literal" namespace="http://service/" />
</output>
</operation>
</binding>
<service name="HibernateWebServiceImplService">
<port name="HibernateWebServiceImplPort" binding="tns:HibernateWebServiceImplPortBinding">
<soap:address location="http://localhost:8080/ChallengeServer/" />
</port>
</service>
</definitions>
Такая структура сервера и описание сервиса:
Каким то образом не корректно деплоится на томкат как видно из wsdl. Ниже приведу web.xml и sun-jaxws.xml:
web.xml
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>webservice</servlet-name>
<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webservice</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
</web-app>
sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
<endpoint name="HibernateWebService" url-pattern="/"
implementation="util.HibernateWebServiceImpl"/>
</endpoints>
У меня есть тестовый класс, которым я проверил работоспособность подключения к бд и работой с ее данных:
package test;
import model.*;
import org.apache.log4j.Logger;
import service.HibernateWebService;
import util.*;
public class ApplicationMainTest {
public static void main(String[] args) {
System.out.println("Hibernate tutorial");
Logger log = Logger.getLogger("util/HibernateSessionFactory.java");
HibernateWebService service = new HibernateWebServiceImpl();
SendModel<ProductsEntity> products = service.getAllProducts();
for (int i = 0; i < products.getList().size(); i++) {
System.out.println(products.getList().get(i).getProductName());
}
SendModel<UsersEntity> user = service.findByUser("admin","admin");
if (user != null) {
System.out.println("Username: " + user.getUser().getUsername());
System.out.println("Password: " + user.getUser().getPassword());
} else {
System.out.println("User not found!!!");
}
}
}
Вывод:
Hibernate: select productsen0_.idProduct as idProduc1_0_, productsen0_.productName as productN2_0_ from challenge.products productsen0_
product1
product2
product3
product4
product5
product6
Hibernate: select usersentit0_.idUser as idUser1_2_, usersentit0_.password as password2_2_, usersentit0_.username as username3_2_ from challenge.users usersentit0_ where usersentit0_.username='admin' and usersentit0_.password='admin'
Username: admin
Password: admin
Сборка персонального компьютера от Artline: умный выбор для современных пользователей