Support for SOAP Header elements on JBossAS 7.0.1
rjbaty Aug 25, 2011 5:16 PMBeen further getting into the JBossWS-CXF implementation contained in the JBossAS 7 stack. We have a couple endpoints that make use of a SOAP Header element in their WSDL definition. To test this out on JBossAS 7 I created a sample service to ensure this was still supported. The sections of my example WSDL file for this are shown below:
<message name="register"> <part name="parameters" element="tns:register"/> <part name="RJBHeader" element="tns:RJBHeader"/> </message> <message name="registerResponse"> <part name="result" element="tns:registerResponse"/> </message> <portType name="AutoRegister"> <operation name="register" parameterOrder="parameters RJBHeader"> <input message="tns:register"/> <output message="tns:registerResponse"/> </operation> </portType> <binding name="AutoRegisterBinding" type="tns:AutoRegister"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> <operation name="register"> <soap:operation soapAction=""/> <input> <soap:body use="literal" parts="parameters"/> <soap:header message="tns:register" part="RJBHeader" use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding>
The RJBHeader is the POJO that gets sent in the SOAP Header section, nothing complex so I didn't include it here. When this WSDL is generated using CXF it creates what I believe is referred to as a Doc/Lit Bare endpoint like this.
/** * This class was generated by Apache CXF 2.4.1 * 2011-08-25T10:09:59.082-05:00 * Generated source version: 2.4.1 * */ @WebService(targetNamespace = "http://header.ws4.rjb", name = "AutoRegister") @XmlSeeAlso({ObjectFactory.class}) @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public interface AutoRegister { @WebResult(name = "registerResponse", targetNamespace = "http://header.ws4.rjb", partName = "result") @WebMethod public RegisterResponse register( @WebParam(partName = "parameters", name = "register", targetNamespace = "http://header.ws4.rjb") Register parameters, @WebParam(partName = "RJBHeader", name = "RJBHeader", targetNamespace = "http://header.ws4.rjb", header = true) RjbHeader rjbHeader ); }
I think the generation does this because of the Header element but I am not sure. At any rate, this endpoint deploys fine and things are good.
Taking this WSDL, generating a servlet client and running it I seem to be getting an issue when trying to create the Servcie and Port classes.
15:55:15,473 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/rjbWS4Client].[AutoRegisterClientServlet]] (http--0.0.0.0-8080-2) Servlet.service() for servlet AutoRegisterClientServlet threw exception: java.lang.NoClassDefFoundError: javax.wsdl.extensions.soap12.SOAP12HeaderFault from [Module "deployment.RJBatyWebServiceEAR-4.1.ear.RJBatyWebService4Client-4.1.war:main" from Service Module Loader] at $Proxy99.<clinit>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_21] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [:1.6.0_21] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [:1.6.0_21] at java.lang.reflect.Constructor.newInstance(Unknown Source) [:1.6.0_21] at java.lang.reflect.Proxy.newProxyInstance(Unknown Source) [:1.6.0_21] at org.apache.cxf.tools.util.SOAPBindingUtil.getProxy(SOAPBindingUtil.java:89) [cxf-tools-common-2.4.1.jar:2.4.1] at org.apache.cxf.tools.util.SOAPBindingUtil.getSoapHeader(SOAPBindingUtil.java:229) [cxf-tools-common-2.4.1.jar:2.4.1] at org.apache.cxf.binding.soap.SoapBindingFactory.addMessageFromBinding(SoapBindingFactory.java:444) [cxf-rt-bindings-soap-2.4.1.jar:2.4.1] at org.apache.cxf.binding.AbstractBindingFactory.copyExtensors(AbstractBindingFactory.java:120) [cxf-rt-core-2.4.1.jar:2.4.1] at org.apache.cxf.binding.AbstractBindingFactory.initializeBindingInfo(AbstractBindingFactory.java:99) [cxf-rt-core-2.4.1.jar:2.4.1] at org.apache.cxf.binding.soap.SoapBindingFactory.createBindingInfo(SoapBindingFactory.java:625) [cxf-rt-bindings-soap-2.4.1.jar:2.4.1] at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildBinding(WSDLServiceBuilder.java:487) [cxf-rt-core-2.4.1.jar:2.4.1] at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:349) [cxf-rt-core-2.4.1.jar:2.4.1] at org.apache.cxf.wsdl11.WSDLServiceBuilder.buildServices(WSDLServiceBuilder.java:198) [cxf-rt-core-2.4.1.jar:2.4.1] at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:142) [cxf-rt-core-2.4.1.jar:2.4.1] at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:382) [cxf-rt-frontend-simple-2.4.1.jar:2.4.1] at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:499) [cxf-rt-frontend-simple-2.4.1.jar:2.4.1] at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241) [cxf-rt-frontend-simple-2.4.1.jar:2.4.1] at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202) [cxf-rt-frontend-jaxws-2.4.1.jar:2.4.1] at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101) [cxf-rt-frontend-simple-2.4.1.jar:2.4.1] at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90) [cxf-rt-frontend-simple-2.4.1.jar:2.4.1] at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152) [cxf-rt-frontend-simple-2.4.1.jar:2.4.1] at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142) [cxf-rt-frontend-jaxws-2.4.1.jar:2.4.1] at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464) [cxf-rt-frontend-jaxws-2.4.1.jar:2.4.1] at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331) [cxf-rt-frontend-jaxws-2.4.1.jar:2.4.1] at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318) [cxf-rt-frontend-jaxws-2.4.1.jar:2.4.1] at javax.xml.ws.Service.getPort(Service.java:99) [jboss-jaxws-api_2.2_spec-2.0.0.Final.jar:2.0.0.Final] at rjb.ws4.header.AutoRegisterService.getAutoRegisterPort(AutoRegisterService.java:78) [classes:]
Do these type of endpoints require the WSDL12 jar libraries? I tried to add this to my MANIFEST.MF file
Dependencies: org.apache.ws.security, org.jboss.ws.cxf.jbossws-cxf-client, javax.wsdl4j.api services
To get access to the javax WSDL4J classes but that seemed to screw up other service types I have. Wondering which way to go for this.
Robert