使用xmlbeans将@WebService(SOAPBinding.ParameterStyle.BARE)部署到JBoss EAP 6.1

时间:2013-12-11 13:15:52

标签: web-services jboss xsd cxf xmlbeans

请勿关闭该浏览器标签!

我认为我的问题是xmlbeans。我有一个带有一个ejb @WebService的小耳朵,它有一个xmlbean作为参数。您将看到使用SOAPBinding.ParameterStyle.BARE作为soapbinding样式。

我可以从堆栈跟踪中看到它在尝试的时候失败了...... createBareMessage()

有没有办法告诉cxf使用不同的工厂?

似乎来自错误消息:

Check for use of a JAX-WS-specific type without the JAX-WS service factory bean

以某种方式xmlbeans知道我正在引用该类:

PurchaseOrderDocument.class

并且我没有通过生成的java代码附带的Factory类创建它。即

PurchaseOrderDocument.newInstance()

它一直抛出的错误:


14:33:04,566 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-3) Creating Service {http://ws.creigh.com/}PurchaseOrderBeanService from class com.creigh.ws.PurchaseOrderBean
14:33:04,569 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.subunit."purchase-order-EAR.ear"."purchase-order-EJB.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."purchase-order-EAR.ear"."purchase-order-EJB.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "purchase-order-EJB.jar" of deployment "purchase-order-EAR.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.creigh.ws.PurchaseOrderBean method getPurchaseOrder part {http://ws.creigh.com/}document cannot be mapped to schema. Check for use of a JAX-WS-specific type without the JAX-WS service factory bean.
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:368)
    at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:67)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:250)
    at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:536)
    at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:116)
    at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:128)
    at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:67)
    at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
    ... 5 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Service class com.creigh.ws.PurchaseOrderBean method getPurchaseOrder part {http://ws.creigh.com/}document cannot be mapped to schema. Check for use of a JAX-WS-specific type without the JAX-WS service factory bean.
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createBareMessage(ReflectionServiceFactoryBean.java:1242)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:488)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:540)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:252)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
    at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:453)
    at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:333)
    ... 13 more

我的WebService:

@Stateless
@Local(IPurchaseOrder.class)
@WebService(wsdlLocation="wsdl/PurchaseOrder.wsdl")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL, parameterStyle=SOAPBinding.ParameterStyle.BARE)
//@DataBinding(org.apache.cxf.xmlbeans.XmlBeansDataBinding.class)
public class PurchaseOrderBean implements IPurchaseOrder {

    public PurchaseOrderBean() {
    }

    //This works
    @WebMethod(operationName="sayHello")
    @WebResult(name="result")
    public String sayHello(@WebParam(name="name") String name) {
        return "Hello" + name;
    }

    //This doesn't
    @WebMethod(operationName="getPurchaseOrder")
    @WebResult(name="order")
    public PurchaseOrder getPurchaseOrder(@WebParam(name="document") PurchaseOrderDocument document){
        return document.getPurchaseOrder();
    }
}

数据绑定没有任何区别,因为我认为我在那里混合了cxf的版本。

这是我从我生成java的xsd:

<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:po="http://creigh.com/ee/easypo"
    targetNamespace="http://creigh.com/ee/easypo"
    elementFormDefault="qualified">
    <xs:element name="purchase-order">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="customer" type="po:customer"/>
                <xs:element name="date" type="xs:dateTime"/>
                <xs:element name="line-item" type="po:line-item" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="shipper" type="po:shipper" minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="customer">
        <xs:sequence>
            <xs:element name="name" type="xs:string"/>
            <xs:element name="address" type="xs:string"/>
        </xs:sequence>
        <xs:attribute name="age" type="xs:int"/>
        <xs:attribute name="moo" type="xs:int" default="100"/>
        <xs:attribute name="poo" type="xs:int" fixed="200"/>
    </xs:complexType>
    <xs:complexType name="line-item">
        <xs:sequence>
            <xs:element name="description" type="xs:string"/>
            <xs:element name="per-unit-ounces" type="xs:decimal"/>
            <xs:element name="price" type="xs:decimal"/>
            <xs:element name="quantity" type="xs:integer"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="shipper">
        <xs:sequence>
        <xs:element name="name" type="xs:string"/>
            <xs:element name="per-ounce-rate" type="xs:decimal"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

请大叫!

此致

1 个答案:

答案 0 :(得分:0)

我不相信JBoss在app服务器中包含的CXF版本根本不包含XMLBeans数据绑定。您可能需要在JBoss的CXF设置中添加适当的xmlbeans数据绑定jar(以及其他jar xmlbeans需求),但我不知道如何做到这一点。你可能不得不在JBoss论坛上提问。