Don't close that browser tab!
My issue is xmlbeans I think. I have a small ear with one ejb @WebService that has a xmlbean as a parameter. You will see is uses SOAPBinding.ParameterStyle.BARE as a soapbinding style.
I can see from the stacktrace that it fails at the point it tries to...
createBareMessage()
Is there some way to tell cxf to use a different Factory?
It seems from the error message:
Check for use of a JAX-WS-specific type without the JAX-WS service factory bean
that somehow xmlbeans knows that I'm referencing the class:
PurchaseOrderDocument.class
and that I didn't create it via the Factory class that comes with the generated java code. i.e.
PurchaseOrderDocument.newInstance()
The error it keeps throwing:
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
My 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();
}
}
The databinding didn't make any difference because I think I'm mixing up versions of cxf there.
This is my xsd I generated the java from:
<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>
Please yelp!
Regards
I don't believe the version of CXF that JBoss includes in the app server contains the XMLBeans databinding at all. You likely would need to add the appropriate xmlbeans databinding jar (and other jars xmlbeans needs) into JBoss's CXF setup, but I have no idea how to do that. You'd likely have to ask on the JBoss forums.