This works great. However, when using a xsd:include in the wsdl (to import types from an external xsd file) the xsd file can not be retrieved using ?xsd. Is there another option that can be set to solve this issue?
By now i use the following to generate the Wsdl-Definition object: try { final WSDLFactory factory = WSDLFactory.newInstance(); final WSDLReader reader = factory.newWSDLReader(); reader.setFeature("javax.wsdl.verbose", false); reader.setFeature("javax.wsdl.importDocuments", true); final Definition def = reader.readWSDL(null,"MyService.wsdl"); service.addParameter(org.apache.axis2.wsdl.WSDLConstants.WSDL_4_J_DEFINITION, def); } catch (final WSDLException e) { logger.warn("Exception occured. There will be no wsdl file available for this webservice."); } Regards, Niko ----- Original Message ----- From: ssa...@gmail.com To: java-user@axis.apache.org Date: 10.03.2011 12:06:46 Subject: Re: Deploy service programatically - howto use custom wsdl? > Add the following code after service deployment and then try ?wsdl > > AxisConfiguration axisConfig = context.getAxisConfiguration(); > AxisService service = axisConfig.getService("service-name"); > .. > javax.wsdl.Definition definition = <definition of your custom wsdl>; > .. > > service.addParameter(org.apache.axis2.wsdl.WSDLConstants.WSDL_4_J_DEFINITION, > definition); > service.addParameter("useOriginalwsdl", "true"); > > > HTH > > Sanka > > > On Thu, Mar 10, 2011 at 10:28 AM, Nikolaus Krismer <r...@krismer.de> wrote: > > Hi! > > > > are there best practices on how to deploy services programatically? > > I tried different approaches, but i can't figure out how to deploy my own > > wsdl file (so it can be retrived by ?wsdl in the web browser) when > > deploying programatically. > > > > Here are some of my tries: > > 1.) DeploymentEngine.buildService(new FileInputStream(serviceXmlFile), > > context); > > 2.) Build an aar file in code (using ZipOutputStream) and pass the > > generated zip to: > > > > axisConfig.addServiceGroup(DeploymentEngine.loadServiceGroup(aarZipFile, > > context)) > > 3.) Using DeploymentFileData.deploy (also using a generated aar zip file, > > which is generated in code) > > > > All of these approches seem to work (personally i prefer #1), but i can't > > get my original wsdl file (which for #2 and #3 is included in the generated > > aar file) to be used when calling my service in a webbrowser using ?wsdl. > > However, i can deliver my custom wsdl files when deploying aar files to the > > service directory before starting up axis, but since i want to simplify the > > build of the application i would prefer to deploy services at runtime when > > starting the application, and not at buildtime. > > > > Is there a way to deliver a custom wsdl file when deploying services > > programatically? > > > > Regards, > > Niko > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > > For additional commands, e-mail: java-user-h...@axis.apache.org > > > > > > > > -- > Sanka Samaranayake > > PMC Member, Committer, Apache Software Foundation, http://www.apache.org/ > > Telephone: +34 677 864358 > Email: sanka AT apache DOT org > Blog: http://sankas.blogspot.com/ > Linked-in: http://lk.linkedin.com/pub/sanka-samaranayake/4/b2b/3b3 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org