You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Alessio Brescia <al...@projectweb.it> on 2008/06/10 17:33:38 UTC

Customizing Axis2 XML response generation

Hi everyone!

I've got a little question.

I created a Web service with NetBeans that returns an array of custom objects.
Every custom object is an array of little custom objects.
I tested the service into Internet Explorer 7 and this is a piece of the response:

- <ns:contenutoTabellaResponse xmlns:ns="http://nuovoRitorno" xmlns:ax21="http://nuovoRitorno/xsd">
- <ns:return type="nuovoRitorno.RigaQuery">
- <ax21:campiValori type="nuovoRitorno.CellaQuery">
  <ax21:nomeCampo>id</ax21:nomeCampo> 
  <ax21:valoreCampo>1</ax21:valoreCampo> 
  </ax21:campiValori>
- <ax21:campiValori type="nuovoRitorno.CellaQuery">
  <ax21:nomeCampo>descrizione</ax21:nomeCampo> 
  <ax21:valoreCampo>ADMIN SITO</ax21:valoreCampo> 
  </ax21:campiValori>
- <ax21:campiValori type="nuovoRitorno.CellaQuery">
  <ax21:nomeCampo>idMenu</ax21:nomeCampo> 
  <ax21:valoreCampo>3</ax21:valoreCampo> 
  </ax21:campiValori>
  </ns:return>
- <ns:return type="nuovoRitorno.RigaQuery">
- <ax21:campiValori type="nuovoRitorno.CellaQuery">
  <ax21:nomeCampo>id</ax21:nomeCampo> 
  <ax21:valoreCampo>4</ax21:valoreCampo> 
  </ax21:campiValori>
- <ax21:campiValori type="nuovoRitorno.CellaQuery">
  <ax21:nomeCampo>descrizione</ax21:nomeCampo> 
  <ax21:valoreCampo>PROGRAMMATORI</ax21:valoreCampo> 
  </ax21:campiValori>
- <ax21:campiValori type="nuovoRitorno.CellaQuery">
  <ax21:nomeCampo>idMenu</ax21:nomeCampo> 
  <ax21:valoreCampo>1</ax21:valoreCampo> 
  </ax21:campiValori>
  </ns:return>

etc.

I want to reduce the size of the XML returned by the service, above all because I work with large databases.
How can I tell Axis2 to return a similar XML:

<ns:contenutoTabellaResponse xmlns:ns="http://nuovoRitorno" xmlns:ax21="http://nuovoRitorno/xsd"> 
- <ns:return type="nuovoRitorno.RigaQuery">
- <ax21:campiValori type="nuovoRitorno.CellaQuery" ax21:nomeCampo="id" ax21:valoreCampo="1" />
<ax21:campiValori type="nuovoRitorno.CellaQuery" ax21:nomeCampo="descrizione" ax21:valoreCampo="ADMIN SITO" />
<ax21:campiValori type="nuovoRitorno.CellaQuery" ax21:nomeCampo="idMenu" ax21:valoreCampo="3" />
</ns:return>

etc.


Thanks in advance!

Re: Customizing Axis2 XML response generation

Posted by Amila Suriarachchi <am...@gmail.com>.
When you deploy a service as a POJO it generates a WSDL in a standard
manner. If it is not the one you want you have to change the wsdl/xsd
accordingly and regenerate the code. you can use wsdl2java tool to generate
the code.

thanks,
Amila.

On Sun, Jun 15, 2008 at 8:35 PM, Anne Thomas Manes <at...@gmail.com>
wrote:

> You will need to customize the WSDL generated by NetBeans.
> Currently your types section maps each Java object attribute to an XSD
> element. You need to redefine them as XSD attributes.
>
> Anne
>
> On Tue, Jun 10, 2008 at 11:33 AM, Alessio Brescia
> <al...@projectweb.it> wrote:
> > Hi everyone!
> >
> > I've got a little question.
> >
> > I created a Web service with NetBeans that returns an array of custom
> > objects.
> > Every custom object is an array of little custom objects.
> > I tested the service into Internet Explorer 7 and this is a piece of the
> > response:
> >
> > - <ns:contenutoTabellaResponse xmlns:ns="http://nuovoRitorno"
> > xmlns:ax21="http://nuovoRitorno/xsd">
> > - <ns:return type="nuovoRitorno.RigaQuery">
> > - <ax21:campiValori type="nuovoRitorno.CellaQuery">
> >   <ax21:nomeCampo>id</ax21:nomeCampo>
> >   <ax21:valoreCampo>1</ax21:valoreCampo>
> >   </ax21:campiValori>
> > - <ax21:campiValori type="nuovoRitorno.CellaQuery">
> >   <ax21:nomeCampo>descrizione</ax21:nomeCampo>
> >   <ax21:valoreCampo>ADMIN SITO</ax21:valoreCampo>
> >   </ax21:campiValori>
> > - <ax21:campiValori type="nuovoRitorno.CellaQuery">
> >   <ax21:nomeCampo>idMenu</ax21:nomeCampo>
> >   <ax21:valoreCampo>3</ax21:valoreCampo>
> >   </ax21:campiValori>
> >   </ns:return>
> > - <ns:return type="nuovoRitorno.RigaQuery">
> > - <ax21:campiValori type="nuovoRitorno.CellaQuery">
> >   <ax21:nomeCampo>id</ax21:nomeCampo>
> >   <ax21:valoreCampo>4</ax21:valoreCampo>
> >   </ax21:campiValori>
> > - <ax21:campiValori type="nuovoRitorno.CellaQuery">
> >   <ax21:nomeCampo>descrizione</ax21:nomeCampo>
> >   <ax21:valoreCampo>PROGRAMMATORI</ax21:valoreCampo>
> >   </ax21:campiValori>
> > - <ax21:campiValori type="nuovoRitorno.CellaQuery">
> >   <ax21:nomeCampo>idMenu</ax21:nomeCampo>
> >   <ax21:valoreCampo>1</ax21:valoreCampo>
> >   </ax21:campiValori>
> >   </ns:return>
> >
> > etc.
> >
> > I want to reduce the size of the XML returned by the service, above all
> > because I work with large databases.
> > How can I tell Axis2 to return a similar XML:
> >
> > <ns:contenutoTabellaResponse xmlns:ns="http://nuovoRitorno"
> > xmlns:ax21="http://nuovoRitorno/xsd">
> > - <ns:return type="nuovoRitorno.RigaQuery">
> > - <ax21:campiValori type="nuovoRitorno.CellaQuery" ax21:nomeCampo="id"
> > ax21:valoreCampo="1" />
> > <ax21:campiValori type="nuovoRitorno.CellaQuery"
> > ax21:nomeCampo="descrizione" ax21:valoreCampo="ADMIN SITO" />
> > <ax21:campiValori type="nuovoRitorno.CellaQuery" ax21:nomeCampo="idMenu"
> > ax21:valoreCampo="3" />
> > </ns:return>
> >
> > etc.
> >
> >
> > Thanks in advance!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: Customizing Axis2 XML response generation

Posted by Anne Thomas Manes <at...@gmail.com>.
You will need to customize the WSDL generated by NetBeans.
Currently your types section maps each Java object attribute to an XSD
element. You need to redefine them as XSD attributes.

Anne

On Tue, Jun 10, 2008 at 11:33 AM, Alessio Brescia
<al...@projectweb.it> wrote:
> Hi everyone!
>
> I've got a little question.
>
> I created a Web service with NetBeans that returns an array of custom
> objects.
> Every custom object is an array of little custom objects.
> I tested the service into Internet Explorer 7 and this is a piece of the
> response:
>
> - <ns:contenutoTabellaResponse xmlns:ns="http://nuovoRitorno"
> xmlns:ax21="http://nuovoRitorno/xsd">
> - <ns:return type="nuovoRitorno.RigaQuery">
> - <ax21:campiValori type="nuovoRitorno.CellaQuery">
>   <ax21:nomeCampo>id</ax21:nomeCampo>
>   <ax21:valoreCampo>1</ax21:valoreCampo>
>   </ax21:campiValori>
> - <ax21:campiValori type="nuovoRitorno.CellaQuery">
>   <ax21:nomeCampo>descrizione</ax21:nomeCampo>
>   <ax21:valoreCampo>ADMIN SITO</ax21:valoreCampo>
>   </ax21:campiValori>
> - <ax21:campiValori type="nuovoRitorno.CellaQuery">
>   <ax21:nomeCampo>idMenu</ax21:nomeCampo>
>   <ax21:valoreCampo>3</ax21:valoreCampo>
>   </ax21:campiValori>
>   </ns:return>
> - <ns:return type="nuovoRitorno.RigaQuery">
> - <ax21:campiValori type="nuovoRitorno.CellaQuery">
>   <ax21:nomeCampo>id</ax21:nomeCampo>
>   <ax21:valoreCampo>4</ax21:valoreCampo>
>   </ax21:campiValori>
> - <ax21:campiValori type="nuovoRitorno.CellaQuery">
>   <ax21:nomeCampo>descrizione</ax21:nomeCampo>
>   <ax21:valoreCampo>PROGRAMMATORI</ax21:valoreCampo>
>   </ax21:campiValori>
> - <ax21:campiValori type="nuovoRitorno.CellaQuery">
>   <ax21:nomeCampo>idMenu</ax21:nomeCampo>
>   <ax21:valoreCampo>1</ax21:valoreCampo>
>   </ax21:campiValori>
>   </ns:return>
>
> etc.
>
> I want to reduce the size of the XML returned by the service, above all
> because I work with large databases.
> How can I tell Axis2 to return a similar XML:
>
> <ns:contenutoTabellaResponse xmlns:ns="http://nuovoRitorno"
> xmlns:ax21="http://nuovoRitorno/xsd">
> - <ns:return type="nuovoRitorno.RigaQuery">
> - <ax21:campiValori type="nuovoRitorno.CellaQuery" ax21:nomeCampo="id"
> ax21:valoreCampo="1" />
> <ax21:campiValori type="nuovoRitorno.CellaQuery"
> ax21:nomeCampo="descrizione" ax21:valoreCampo="ADMIN SITO" />
> <ax21:campiValori type="nuovoRitorno.CellaQuery" ax21:nomeCampo="idMenu"
> ax21:valoreCampo="3" />
> </ns:return>
>
> etc.
>
>
> Thanks in advance!

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org