gpt4 book ai didi

java - 没有 Java EE 容器 1.6 和 1.7 的 JAX-WS Web 服务

转载 作者:行者123 更新时间:2023-12-01 05:05:32 25 4
gpt4 key购买 nike

我正在尝试这个tutorial在 java 1.7 中,但如果我选择 java 1.6,我会得到这个异常:

Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.company.jaxws.stockquote.service.jaxws.GetQuote is not found. Have you run APT to generate them?
at com.sun.xml.internal.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:256)
at com.sun.xml.internal.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:567)
at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:514)
at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:341)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:227)
at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:308)
at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:174)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:420)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:439)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:208)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:138)
at com.company.jaxws.stockquote.service.StockQuoteService.publish(StockQuoteService.java:49)
at com.company.jaxws.stockquote.service.StockQuoteService.main(StockQuoteService.java:81)
Java Result: 1

来源可用here

欢迎所有建议。

最佳答案

Try to add  @SOAPBinding to your server endpoint implementation class.it may resolve the problem.


@WebService(name = "StockQuote", serviceName = "StockQuoteService")
@SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL)
public class StockQuoteImpl {
@WebMethod(operationName = "getQuote")
public double getQuote(String ticker) {
double result = 0.0;
if (ticker.equals("MHP")) {
result = 50.0;
} else if (ticker.equals("IBM")) {
result = 83.0;
}
return result;
}
}

关于java - 没有 Java EE 容器 1.6 和 1.7 的 JAX-WS Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12741461/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com