Java JAX-WS。SOAP响应主体标记到自定义标记
当我尝试使用部署JAX-WS服务时,在Glassfish 4中收到一个部署时间错误 @WebResult注释的方法。下面是工件Java JAX-WS。SOAP响应主体标记到自定义标记,java,eclipse,soap,jax-ws,glassfish-4,Java,Eclipse,Soap,Jax Ws,Glassfish 4,当我尝试使用部署JAX-WS服务时,在Glassfish 4中收到一个部署时间错误 @WebResult注释的方法。下面是工件 @WebService(name = "TestMartCatalog", targetNamespace = "http://www.testmart.com") public interface ProductCatalogInterface { @WebMethod(action = "fetch_categories", operationName =
@WebService(name = "TestMartCatalog", targetNamespace = "http://www.testmart.com")
public interface ProductCatalogInterface {
@WebMethod(action = "fetch_categories", operationName = "fetchCategories")
public abstract List<String> getProductCatagories();
@WebMethod
public abstract List<String> getProducts(String category);
@WebMethod
public abstract boolean addProduct(String category, String product);
@WebMethod
@WebResult(name="Product")
public abstract List<Product> getProductsv2(String category);
}
@WebService(endpointInterface="come.lets.learn.jaxws.ProductCatalogInterface",
portName="TestMartCatalogPort", serviceName = "TestMartCatalogService")
public class ProductCatalog implements ProductCatalogInterface {
ProductServiceImpl prodImpl = new ProductServiceImpl();
/* (non-Javadoc)
* @see come.lets.learn.jaxws.ProductCatalogInterface#getProductCatagories()
*/
@Override
public List<String> getProductCatagories() {
return prodImpl.getProductCatagories();
}
/* (non-Javadoc)
* @see come.lets.learn.jaxws.ProductCatalogInterface#getProducts(java.lang.String)
*/
@Override
public List<String> getProducts(String category) {
return prodImpl.getProducts(category);
}
/* (non-Javadoc)
* @see come.lets.learn.jaxws.ProductCatalogInterface#addProduct(java.lang.String, java.lang.String)
*/
@Override
public boolean addProduct(String category, String product) {
return prodImpl.addProduct(category, product);
}
/* (non-Javadoc)
* @see come.lets.learn.jaxws.ProductCatalogInterface#getProductsv2(java.lang.String)
*/
@Override
public List<Product> getProductsv2(String category) {
return prodImpl.getProductsv2(category);
}
}
@XmlRootElement(name="Product")
@XmlType(propOrder={"price", "sku", "name"})
public class Product {
private String name;
private String sku;
private double price;
public Product() {
}
public Product(String name, String sku, double price) {
this.name = name;
this.sku = sku;
this.price = price;
}
/**
* @return the name
*/
@XmlElement(name="ProductName")
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the sku
*/
public String getSku() {
return sku;
}
/**
* @param sku the sku to set
*/
public void setSku(String sku) {
this.sku = sku;
}
/**
* @return the price
*/
public double getPrice() {
return price;
}
/**
* @param price the price to set
*/
public void setPrice(double price) {
this.price = price;
}
}
部署时的异常堆栈跟踪如下所示
2014-06-19T13:54:18.859+0530 |警告:部署失败
javax.xml.ws.WebServiceException:类
come.lets.learn.jaxws.jaxws.GetProductsv2Response没有
位于的产品名称的属性
com.sun.xml.ws.server.sei.EndpointResponseMessageBuilder$DocLit.EndpointResponseMessageBuilder.java:258
在
com.sun.xml.ws.server.sei.TieHandler.createResponseMessageBuilderHandler.java:212
位于com.sun.xml.ws.server.sei.TieHandler.TieHandler.java:117
在com.sun.xml.ws.db.DatabindingImpl.DatabindingImpl.java:110
........... 原因:javax.xml.bind.JAXBException:产品不是
类上的有效属性
come.lets.learn.jaxws.jaxws.GetProductsv2Response位于
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessorJAXBContextImpl.java:985
在
com.sun.xml.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessorJAXBRIContextWrapper.java:120
在
com.sun.xml.ws.server.sei.EndpointResponseMessageBuilder$DocLit.EndpointResponseMessageBuilder.java:254
... 61更多。。。。。。。。。。。。。2014-06-19T13:54:18.890+0530严重:
启动后清理期间出现异常失败
org.apache.catalina.LifecycleException:尚未安装Manager
开始于
org.apache.catalina.session.StandardManager.stopStandardManager.java:934
在
org.apache.catalina.core.StandardContext.stopStandardContext.java:6099
位于com.sun.enterprise.web.WebModule.stopWebModule.java:720
.................. 2014-06-19T13:54:18.890+0530严重:
ContainerBase.addChild:开始:
org.apache.catalina.LifecycleeException:java.lang.RuntimeException:
Servlet web服务终结点在发生故障
org.apache.catalina.core.StandardContext.startStandardContext.java:5920
com.sun.enterprise.web.WebModule.startWebModule.java:691 at
org.apache.catalina.core.ContainerBase.addChildInternalContainerBase.java:1041
............ 原因:java.lang.RuntimeException:Servlet web
服务器上的服务端点故障
org.glassfish.webservices.WSServletContextListener.contextInitializedWSServletContextListener.java:109
在
org.apache.catalina.core.StandardContext.contextListenerStartStandardContext.java:5362
.................. 原因:javax.xml.ws.WebServiceException:类
come.lets.learn.jaxws.jaxws.GetProductsv2Response没有
位于的产品名称的属性
com.sun.xml.ws.server.sei.EndpointResponseMessageBuilder$DocLit.EndpointResponseMessageBuilder.java:258
在
com.sun.xml.ws.server.sei.TieHandler.createResponseMessageBuilderHandler.java:212
........... 原因:javax.xml.bind.JAXBException:产品不是
类上的有效属性
come.lets.learn.jaxws.jaxws.GetProductsv2Response位于
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessorJAXBContextImpl.java:985
在
com.sun.xml.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessorJAXBRIContextWrapper.java:120
............... 2014-06-19T13:54:18.890+0530 |警告:
java.lang.IllegalStateException:ContainerBase.addChild:start:
org.apache.catalina.LifecycleeException:java.lang.RuntimeException:
Servlet web服务端点失败
java.lang.IllegalStateException:ContainerBase.addChild:start:
org.apache.catalina.LifecycleeException:java.lang.RuntimeException:
Servlet web服务终结点在发生故障
org.apache.catalina.core.ContainerBase.addChildInternalContainerBase.java:1044
在
org.apache.catalina.core.ContainerBase.addChildContainerBase.java:1024
............. 2014-06-19T13:54:18.890+0530严重:异常
调用类com.sun.enterprise.web.WebApplication启动方法
java.lang.Exception:java.lang.IllegalStateException:
ContainerBase.addChild:start:org.apache.catalina.LifecycleException:
java.lang.RuntimeException:Servlet web服务端点失败
在
com.sun.enterprise.web.WebApplication.startWebApplication.java:168
位于org.glassfish.internal.data.EngineRef.startEngineRef.java:122
位于org.glassfish.internal.data.ModuleInfo.startModuleInfo.java:291
................... 2014-06-19T13:54:18.890+0530严重:异常
在生命周期处理java.lang.Exception期间:
java.lang.IllegalStateException:ContainerBase.addChild:start:
org.apache.catalina.LifecycleeException:java.lang.RuntimeException:
Servlet web服务终结点在发生故障
com.sun.enterprise.web.WebApplication.startWebApplication.java:168
位于org.glassfish.internal.data.EngineRef.startEngineRef.java:122
GetProductsv2Response类看起来像什么?它就在上面,就在接口下面。不,它不是。stacktrace包含对它的引用,这就是为什么我要求您显示它的代码。对不起,我的错误。这 不是我的神器。这将是Glassfish作为其Jax WS部署策略的一部分必须生成的内容。我的直觉是,我给Glassfish运行时的注释与它所期望的不匹配