You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Golam Chowdhury <Go...@fieldworker.com> on 2007/09/28 15:59:34 UTC

FW: Customize tags

Hi,



Lets say I have a class

############################################################################
package com.fw.webservice;

import java.io.Serializable;


public class Data implements Serializable {
	private String id;
	private String lat;
	private String lon;
	private String time;
	
	public Data(String lat,String lon, String time){
		setLat(lat);
		setLon(lon);
		setTime(time);
	}
	
	public void setId(String id){
		this.id = id;
	}
	
	public void setLat(String lat){
		this.lat = lat;
	}
	public void setLon(String lon){
		this.lon = lon;
	}
	public void setTime(String time){
		this.time = time;
	}
	
	public String getLat(){
		return lat;
	}
	public String getLon(){
		return lon;
	}
	public String getTime(){
		return time;
	}
	public String getId(){
		return id;
	}
}


############################################################################
Axis returns  looks like

 <data>
		 <id>1</id>	
             <lat>42.2323</lat>

             <lon>80.2323</lon>

             <time>2006-09-22</time>
</data>


Question:
How can I add attribute to the data tag? So it looks like the following:

<data id=1>		 
             <lat>42.2323</lat>

             <lon>80.2323</lon>

             <time>2006-09-22</time>
</data>


Thanks in advance for all your help.

Golam



-----Original Message-----
From: Paul Fremantle [mailto:pzfreo@gmail.com] 
Sent: Thursday, September 27, 2007 12:46 PM
To: axis-user@ws.apache.org
Subject: Re: Customize tags

Oh I'm sorry if I was wrong!!!

Paul

On 9/27/07, Deepal jayasinghe <de...@gmail.com> wrote:
> Hi Golam ,
> Just add the following tag into your services.xml
>
> <schema elementFormDefaultQualified="false"/>
>
>
> Thanks
> Deepal
> >
> > Hi,
> >
> >
> >
> > Axis2 generates:
> >
> >
> >
> > <ax24:data type="com.fw.webservice.Data">
> >
> > <ax24:lat>43.40391</ax24:lat>
> >
> > <ax24:lon>-80.04648</ax24:lon>
> >
> > <ax24:time>2006-07-28 00:40:02.0</ax24:time>
> >
> > </ax24:data>
> >
> >
> >
> >
> >
> > What I want is:
> >
> >
> >
> > <data>
> >
> >             <lat>42.2323</lat>
> >
> >             <lon>80.2323</lon>
> >
> >             <time>2006-09-22</time>
> >
> > </data>
> >
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

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


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


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


Re: FW: Customize tags

Posted by Paul Fremantle <pz...@gmail.com>.
Golam

Once you start to get to this level of complexity you really need to
start from the WSDL in a contract first model. There may be other ways
I haven't yet figured out, but the simplest approach is to create a
WSDL (you can start from the one generated by your current setup -
just browse http:://127.0.0.1/axis2/services/YourService?wsdl - also
Eclipse WebTools has good editing facilities).

That way you can define the exact schema you need.

Paul

On 9/28/07, Golam Chowdhury <Go...@fieldworker.com> wrote:
> Hi,
>
>
>
> Lets say I have a class
>
> ############################################################################
> package com.fw.webservice;
>
> import java.io.Serializable;
>
>
> public class Data implements Serializable {
>         private String id;
>         private String lat;
>         private String lon;
>         private String time;
>
>         public Data(String lat,String lon, String time){
>                 setLat(lat);
>                 setLon(lon);
>                 setTime(time);
>         }
>
>         public void setId(String id){
>                 this.id = id;
>         }
>
>         public void setLat(String lat){
>                 this.lat = lat;
>         }
>         public void setLon(String lon){
>                 this.lon = lon;
>         }
>         public void setTime(String time){
>                 this.time = time;
>         }
>
>         public String getLat(){
>                 return lat;
>         }
>         public String getLon(){
>                 return lon;
>         }
>         public String getTime(){
>                 return time;
>         }
>         public String getId(){
>                 return id;
>         }
> }
>
>
> ############################################################################
> Axis returns  looks like
>
>  <data>
>                  <id>1</id>
>              <lat>42.2323</lat>
>
>              <lon>80.2323</lon>
>
>              <time>2006-09-22</time>
> </data>
>
>
> Question:
> How can I add attribute to the data tag? So it looks like the following:
>
> <data id=1>
>              <lat>42.2323</lat>
>
>              <lon>80.2323</lon>
>
>              <time>2006-09-22</time>
> </data>
>
>
> Thanks in advance for all your help.
>
> Golam
>
>
>
> -----Original Message-----
> From: Paul Fremantle [mailto:pzfreo@gmail.com]
> Sent: Thursday, September 27, 2007 12:46 PM
> To: axis-user@ws.apache.org
> Subject: Re: Customize tags
>
> Oh I'm sorry if I was wrong!!!
>
> Paul
>
> On 9/27/07, Deepal jayasinghe <de...@gmail.com> wrote:
> > Hi Golam ,
> > Just add the following tag into your services.xml
> >
> > <schema elementFormDefaultQualified="false"/>
> >
> >
> > Thanks
> > Deepal
> > >
> > > Hi,
> > >
> > >
> > >
> > > Axis2 generates:
> > >
> > >
> > >
> > > <ax24:data type="com.fw.webservice.Data">
> > >
> > > <ax24:lat>43.40391</ax24:lat>
> > >
> > > <ax24:lon>-80.04648</ax24:lon>
> > >
> > > <ax24:time>2006-07-28 00:40:02.0</ax24:time>
> > >
> > > </ax24:data>
> > >
> > >
> > >
> > >
> > >
> > > What I want is:
> > >
> > >
> > >
> > > <data>
> > >
> > >             <lat>42.2323</lat>
> > >
> > >             <lon>80.2323</lon>
> > >
> > >             <time>2006-09-22</time>
> > >
> > > </data>
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

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