Hi,
I'm generating service POJO with Javassist, and I can't specify parameter names of my method. So I'm doing the following for having a WSDL with the correct parameter names (otherwise I get param0, param1, ...) :

AxisService generatedService = AxisService.createService(pojoService.getName(), axis2context
                   .getAxisConfiguration());

               // retrieve input parameters of model
List<ModelParam> inParameters = AxisServiceGenerator.getInParameters(modelService);

// retrieve schemas of service (see wsdl for getting an idea of xml structure)
               ArrayList<?> schemas = generatedService.getSchema();
               // for all schemas of service
               for (Object object : schemas) {
                   XmlSchema serviceSchema = (XmlSchema) object;
XmlSchemaObjectTable schemaElements = serviceSchema.getElements();
                   // search XmlSchemaElement with service name
for (Iterator<?> iter = schemaElements.getValues(); iter.hasNext();) {
                       Object next = iter.next();
                       if (next instanceof XmlSchemaElement) {
XmlSchemaElement schemaElement = (XmlSchemaElement) next; if (schemaElement.getName().equals(modelService.name)) { // this one is a complex type with a sequence of the parameters XmlSchemaComplexType schemaComplexType = (XmlSchemaComplexType) schemaElement
                                       .getSchemaType();
XmlSchemaSequence schemaSequence = (XmlSchemaSequence) schemaComplexType.getParticle();

// iterate on element on sequence, and change element name XmlSchemaObjectCollection items = schemaSequence.getItems();
                               for (int j = 0; j < items.getCount(); j++) {
XmlSchemaElement element = (XmlSchemaElement) items.getItem(j); element.setName(inParameters.get(j).name.replace('.', '_'));
                               }

                           }
                       }
                   }
               }

               // adding axis2 service to axis2 registry
axis2context.getAxisConfiguration().addService(generatedService);

Is there a cleaner way to do that?
Thanks

--
Gabriel <[EMAIL PROTECTED]>
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to