java - JAX-WS WebService via CXF provides inaccurate wsdl -
i've deployed simple jax-ws service, built contract-first. in jax-ws endpoint configuration, specify location of original wsdl. however, not wsdl returned cxf. original wsdl contains policy statements important part of contract, , should visible in wsdl service consumers.
i know wsdl location i'm setting on endpoint correct. when it's not correct, deployment of war fails. i've logged value double-check.
when deployed locally, service available @ http://localhost:8080/store-web-0.1.0/services/store.
problem: wsdl available @ http://localhost:8080/store-web-0.1.0/services/store?wsdl not contain policy statements can seen in original wsdl. leaving out important part of contract not acceptable.
question: why wsdl available @ http://localhost:8080/store-web-0.1.0/services/store?wsdl missing policy statements , not original wsdl configured on jax-ws endpoint?
additional details below. please let me know if there's other information you'd see.
thanks in advance!
details
we're using: jboss eap 6.2, cxf 2.7.16 (moving cxf 3.x not option), spring 4.1.6
we exclude 'webservices' subsystem in our jboss-deployment-descriptor.xml file
jax-ws configuration class
@bean storeimpl storeimpl() { return new storeimpl(); } @bean public endpoint storeserviceendpoint() { endpointimpl endpoint = new endpointimpl(storeimpl()); endpoint.publish("/store"); // configuration located in war, wsdl in separate jar string wsdllocation = this.getclass().getresource("/store.wsdl").tostring(); endpoint.setwsdllocation(wsdllocation); return endpoint; }
web service implementation class
@webservice(endpointinterface = "my.service.store", servicename = "store") public class storeimpl implements store { public storeimpl() { } @override public buysomethingresponse buysomething(buysomethingrequest buysomethingrequest) { // operation implementation code here return response; } }
web application initialization
@order(value=1) public class storewebinitializer implements webapplicationinitializer { @override public void onstartup(servletcontext container) throws servletexception { annotationconfigwebapplicationcontext context = new annotationconfigwebapplicationcontext(); context.register(jaxwsendpointconfig.class); container.addlistener(new contextloaderlistener(context)); } } @order(value=2) public class cxfwebinitializer implements webapplicationinitializer { @override public void onstartup(servletcontext container) throws servletexception { servletregistration.dynamic dispatcher = container.addservlet("cxfservlet", cxfservlet.class); dispatcher.addmapping("/services/*"); } }
i able find issues, of there 3.
issue #1 seen in jax-ws configuration class code included in question, setting wsdl location after publishing endpoint.
issues #2 , #3 @webservice
annotation on storeimpl
class needed 2 additional attributes set: targetnamespace
, portname
. values needed to, obviously, match defined in original wsdl.
Comments
Post a Comment