« Return to Thread: How to generate wsdl programmatically using cxf?

Re: How to generate wsdl programmatically using cxf?

by liw :: Rate this Message:

Reply to Author | View in Thread

Hi Jim,

It was turned out that the generators list is empty when JavaToWSDLProcessor.generate() API is invoked. That's why the wsdl file is empty.

The service is build from spring bean definition. I am able to generate wsdl using WSDLWriter.

Thanks for your inputs,

Li
jim ma wrote:
On Thu, Jul 9, 2009 at 7:50 AM, liw <pattiewang@yahoo.com> wrote:

>
> Hi Jim,
>
> Since I have the service object already, is there any way that I can get
> the
> ServiceInfo for the service instead of creating a one?
>
> If I have to create a ServiceInfo instance, what are the minimum fields I
> need to add before passing it to JavaToWSDLProcessor.
>

yes. you can . What is this service built from ?  Do you use
ReflectionServiceFactoryBean to build it ?


>
>
> Here is the code I have. Unfortunately, the wdl file generated is empty.
>
>
>  private void generateCXFWsdlStream(String serviceName, OutputStream os)
> throws IOException
>    {
>        Service service = getCXFServiceObject(serviceName);
>        List serviceInfos = service.getServiceInfos();
>
>        for (ServiceInfo serviceInfo : service.getServiceInfos()) {
>                System.out.println("serviceInfo targetNamespace" +
> serviceInfo.getTargetNamespace());
>        }
>
>        File tempFile = new File(outdir, serviceName + ".wsdl");
>        JavaToWSDLProcessor wsdlProcessor = new JavaToWSDLProcessor();
>
>        wsdlProcessor.generate((ServiceInfo) serviceInfos.get(0),tempFile);
>    }
>

Did you see some errors when you generate wsdl ? The JavaToWSDLprocessor
will invoke ServiceWSDLBuilder to convert the ServiceInfo to Wsdl
definition. You can debug this class to get more information.


Jim.

 « Return to Thread: How to generate wsdl programmatically using cxf?