我正在Java中开发SOAP Service
,但我遇到了这个错误:
WARNING: Mismatch between Java model and WSDL model found, For wsdl operation
{http://database.unitn.it/}isLoginOkay,There is no matching wsdl fault with detail
QName {http://interfaces.database.unitn.it/}Exception
com.sun.xml.internal.ws.spi.db.DatabindingException: Unknown JAXBContext
implementation: class com.sun.xml.bind.v2.runtime.JAXBContextImpl
at com.sun.xml.internal.ws.spi.db.BindingContextFactory.getJAXBFactory(BindingContextFactory.j
ava:192)
at com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:134)
at com.sun.xml.internal.ws.message.jaxb.JAXBMessage.create(JAXBMessage.java:152)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:241)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage(SOAPFaultBuilder.java:224)
at com.sun.xml.internal.ws.wsdl.PayloadQNameBasedOperationFinder.getWSDLOperationMapping(PayloadQNameBasedOperationFinder.java:143)
at com.sun.xml.internal.ws.wsdl.OperationDispatcher.getWSDLOperationMapping(OperationDispatcher.java:82)
at com.sun.xml.internal.ws.api.message.Packet.getWSDLOperationMapping(Packet.java:285)
at com.sun.xml.internal.ws.api.message.Message.getOperation(Message.java:284)
at com.sun.xml.internal.ws.api.message.Message.getOperation(Message.java:302)
at com.sun.xml.internal.ws.api.message.Message.isOneWay(Message.java:379)
...
我正在使用java 1.8,一切都在localhost上运行。 wsdl接缝工作正常。 我不知道问题是什么。我尝试了很多来解决这个问题,但我没有四个没有人讨论过这个问题。 请帮忙。
编辑:
这是出版商:
private static final String mUrl = "http://localhost:" + Ports.MASTER_DATABASE_SERVICE + "/database";
public static void launch() throws Exception
{
System.out.println("----Starting on ..." + mUrl);
Endpoint.publish(mUrl, new Database());
System.out.println("----SOAP Service started!!!!");
}
这里是客户端部分的接口:
@WebService
@SOAPBinding(style = Style.RPC)
public interface DatabaseAPIsInterface
{
@WebMethod
public User isLoginOkay(String password, String email) throws Exception;
}
这里是方法isLoginOkay(...)
@Override
public User isLoginOkay(String password, String email) throws Exception
{
Database db = null;
try
{
db = fromConnectionPool();
Dao<User, Integer> dao = createPersonDAO(db);
throwIfSomeNull(password, email);
QueryBuilder<User, Integer> builder = dao.queryBuilder();
User user = builder.where().eq(User.FIELD_NAME_EMAIL, email).and().eq(User.FIELD_NAME_PASSWORD, password).queryForFirst();
if (user != null) return user;
else throw new FileNotFoundException("User does not exist");
} finally
{
close(db);
}
}
这里是客户端部分:
String mUrl = "http://localhost:" + Ports.MASTER_DATABASE_SERVICE + "/database?wsdl";
URL url = new URL(mUrl);
QName qname = new QName("http://database.unitn.it/", "DatabaseService");
Service service = Service.create(url, qname);
DatabaseInterface database = service.getPort(new QName("http://database.unitn.it/", "DatabasePort"), DatabaseAPIsInterface.class);
User user = database.isLoginOkay(password, email);
System.out.println(user);