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 ke...@ubs.com on 2007/03/29 16:50:47 UTC

[Axis2] Missing ancestor properties in SOAP response

Taking the bottom up approach, exposing WS via POJOs and letting Axis2
generate WSDL on the fly.   The base properties of the POJO are not
returned in SOAP response, the WSDL is exposed however.

Any help is appreciated.  

As you can see below, the elements in base class, are not in the
response:
			<xs:element name="basePriceDate"
type="xs:dateTime" />
			<xs:element name="changeOneDay" type="xs:float"
/>
			<xs:element name="changeOneMonth"
type="xs:float" />
			<xs:element name="changeOneWeek" type="xs:float"
/>
			<xs:element name="changeThreeMonths"
type="xs:float" />
			<xs:element name="currentPrice" type="xs:float"
/>
	       <xs:element name="intrinsicPrice" type="xs:float" />


Attached WSDL (snippet of complex type generated):

<wsdl:types>
	<xs:schema xmlns:ax21="http://types.ws.gcs.ubs.com/xsd"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://types.ws.gcs.ubs.com/xsd">
	<xs:element name="CDSIndiceReturns" type="ax21:CDSIndiceReturns"
/>
		<xs:complexType name="CDSIndiceReturns">
			<xs:sequence>
			<xs:element name="basePriceDate"
type="xs:dateTime" />
			<xs:element name="changeOneDay" type="xs:float"
/>
			<xs:element name="changeOneMonth"
type="xs:float" />
			<xs:element name="changeOneWeek" type="xs:float"
/>
			<xs:element name="changeThreeMonths"
type="xs:float" />
			<xs:element name="currentPrice" type="xs:float"
/>
			<xs:element name="intrinsicPrice"
type="xs:float" />
			<xs:element name="indiceSeries" nillable="true"
type="xs:string" />
			<xs:element name="indiceVersion" nillable="true"
type="xs:string" />
			<xs:element name="maturityDate"
type="xs:dateTime" />
			<xs:element name="name" nillable="true"
type="xs:string" />
			<xs:element name="onTheRun" nillable="true"
type="xs:string" />
			<xs:element name="redcode" nillable="true"
type="xs:string" />
			<xs:element name="redcodeIdx" nillable="true"
type="xs:string" />
			<xs:element name="symbol" nillable="true"
type="xs:string" />
			<xs:element name="term" nillable="true"
type="xs:string" />
			</xs:sequence>
		</xs:complexType>
	....
	</xs:element>
	...
	<xs:element name="getCDSIndiceReturnsResponse">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded"
name="return" nillable="true" type="ns0:CDSIndiceReturns" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	...
	</xs:schema>
</wsdl:types>

SOAP response:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:getCDSIndiceReturnsResponse xmlns:ns="http://ubs.gcs/xsd">
         <ns:return>
            <indiceSeries xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <indiceVersion xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <maturityDate
xmlns="http://types.ws.gcs.ubs.com/xsd">0001-01-01T00:00:00.202Z</maturi
tyDate>
            <name xmlns="http://types.ws.gcs.ubs.com/xsd">DJ CDX NA -
IG</name>
            <onTheRun xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <redcode xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <redcodeIdx xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <symbol
xmlns="http://types.ws.gcs.ubs.com/xsd">CDXNAIG</symbol>
            <term xmlns="http://types.ws.gcs.ubs.com/xsd"/>
         </ns:return>
         <ns:return>
            <indiceSeries xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <indiceVersion xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <maturityDate
xmlns="http://types.ws.gcs.ubs.com/xsd">0001-01-01T00:00:00.202Z</maturi
tyDate>
            <name xmlns="http://types.ws.gcs.ubs.com/xsd">DJ CDX NA -
XO</name>
            <onTheRun xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <redcode xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <redcodeIdx xmlns="http://types.ws.gcs.ubs.com/xsd"/>
            <symbol
xmlns="http://types.ws.gcs.ubs.com/xsd">CDXNAXO</symbol>
            <term xmlns="http://types.ws.gcs.ubs.com/xsd"/>
         </ns:return>
      </ns:getCDSIndiceReturnsResponse>
   </soapenv:Body>
</soapenv:Envelope>

Java Code (snippet):

public class BaseReturn implements Serializable {

	/* Price/Returns data */
	protected Calendar basePriceDate = null; 
	protected float currentPrice = 0;
	protected float intrinsicPrice = 0;
	protected float changeOneDay = 0;
	protected float changeOneWeek = 0;
	protected float changeOneMonth = 0;
	protected float changeThreeMonths = 0;
...

public class CDSIndiceReturns extends BaseReturn implements Serializable
{
	
	private String   symbol = "";
	private String   name   = "";  
	private String   term   = "";
	private String   indiceSeries  = "";	
	private String   indiceVersion = "";
	private Calendar maturityDate = null;
	private String   onTheRun = "";
	private String   redcode = "";
	private String   redcodeIdx = "";



> ______________________________________________ 
> From: 	Ricci, Ken  
> Sent:	Wednesday, March 28, 2007 12:55 PM
> To:	axis-user@ws.apache.org
> Cc:	Ricci, Ken
> Subject:	[Axis2] Bean generated WSDL missing ancestor properties
> in SOAP response
> 
> I have a base bean, ClassA with a few properties.   The ClassA is
> extended by ClassB for some additional properties.   The generated
> WSDL for ClassB is correct.  However, the SOAP response omits all the
> elements/values from the ancestor (ClassA)
> 
> Is this allowed in Axis2?   I tried to create additional getters
> methods in ClassB for the ClassA attributes.   That will give me the
> correct SOAP response, but double the generate WSDL elements for the
> ClassA attributes.   That confuses the WS client.
> 
> Help is appreciated.
> 
> Thx, Ken

Re: [Axis2] Missing ancestor properties in SOAP response

Posted by Martin Gainty <mg...@hotmail.com>.
[Axis2] Missing ancestor properties in SOAP responsewow..Good Find Ken!
I was able to reproduce the problem by 

introducing a new Base class

public class StockQuoteServiceSkeleton extends Base 
public class Base extends Object implements java.io.Serializable
{
 //the usual Bean no arg constructor
 public Base() { ; }

 protected String BaseString="BaseString";
 public String getBaseString() { return BaseString; }
 public void setBaseString(String new_base)
 {
  BaseString = new_base;
    }
}
and then deriving my existing Class from Base called Base
package samples.quickstart.service.adb;
//import samples.quickstart.service.adb.xsd.GetPriceResponse;
//import samples.quickstart.service.adb.xsd.Update;
//import samples.quickstart.service.adb.xsd.GetPrice;
import java.util.HashMap;
import samples.quickstart.service.adb.Base;

public class StockQuoteServiceSkeleton extends Base { //implements StockQuoteServiceSkeletonInterface {
    private HashMap map = new HashMap();

//    public void update(Update param0) {
 public void update(String param0) {
        //map.put(param0.getSymbol(), new Double(param0.getPrice()));
        map.put("IBM", 42.0);
    }

//    public GetPriceResponse getPrice(GetPrice param1) {
   public String getPrice(String param1) {
        Double price = 42.0; //(Double) map.get(param1.getSymbol());
        double ret = 42;
        if(price != null){
//            ret = price.doubleValue();
        }
//        GetPriceResponse res =
//                new GetPriceResponse();
//        res.set_return(ret);
//        return res;
        return "IBM";
    }
}

I  think Ken is entitiled to the next version for free!
Please post the bug here
POST JIRA here
http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=10611&sorter/order=DESC&sorter/field=priority&resolution=-1&component=12310180

Thx,
Martin--
--------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
--------------------------------------------------------------------------- 
Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.

  ----- Original Message ----- 
  From: ken.ricci@ubs.com 
  To: axis-user@ws.apache.org 
  Cc: Ken.Ricci@ubs.com 
  Sent: Thursday, March 29, 2007 10:50 AM
  Subject: [Axis2] Missing ancestor properties in SOAP response




  Taking the bottom up approach, exposing WS via POJOs and letting Axis2 generate WSDL on the fly.   The base properties of the POJO are not returned in SOAP response, the WSDL is exposed however.

  Any help is appreciated.  

  As you can see below, the elements in base class, are not in the response: 

        <xs:element name="basePriceDate" type="xs:dateTime" /> 
        <xs:element name="changeOneDay" type="xs:float" /> 
        <xs:element name="changeOneMonth" type="xs:float" /> 
        <xs:element name="changeOneWeek" type="xs:float" /> 
        <xs:element name="changeThreeMonths" type="xs:float" /> 
        <xs:element name="currentPrice" type="xs:float" /> 

                 <xs:element name="intrinsicPrice" type="xs:float" /> 



  Attached WSDL (snippet of complex type generated): 

  <wsdl:types> 

    <xs:schema xmlns:ax21="http://types.ws.gcs.ubs.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://types.ws.gcs.ubs.com/xsd">

    <xs:element name="CDSIndiceReturns" type="ax21:CDSIndiceReturns" /> 

      <xs:complexType name="CDSIndiceReturns"> 

        <xs:sequence> 
        <xs:element name="basePriceDate" type="xs:dateTime" /> 
        <xs:element name="changeOneDay" type="xs:float" /> 
        <xs:element name="changeOneMonth" type="xs:float" /> 
        <xs:element name="changeOneWeek" type="xs:float" /> 
        <xs:element name="changeThreeMonths" type="xs:float" /> 
        <xs:element name="currentPrice" type="xs:float" /> 
        <xs:element name="intrinsicPrice" type="xs:float" /> 
        <xs:element name="indiceSeries" nillable="true" type="xs:string" /> 
        <xs:element name="indiceVersion" nillable="true" type="xs:string" /> 
        <xs:element name="maturityDate" type="xs:dateTime" /> 
        <xs:element name="name" nillable="true" type="xs:string" /> 
        <xs:element name="onTheRun" nillable="true" type="xs:string" /> 
        <xs:element name="redcode" nillable="true" type="xs:string" /> 
        <xs:element name="redcodeIdx" nillable="true" type="xs:string" /> 
        <xs:element name="symbol" nillable="true" type="xs:string" /> 
        <xs:element name="term" nillable="true" type="xs:string" /> 
        </xs:sequence> 

      </xs:complexType> 

    .. 
    </xs:element> 
    ... 
    <xs:element name="getCDSIndiceReturnsResponse"> 

      <xs:complexType> 

        <xs:sequence> 

          <xs:element maxOccurs="unbounded" name="return" nillable="true" type="ns0:CDSIndiceReturns" /> 

        </xs:sequence> 

      </xs:complexType> 

    </xs:element> 
    ... 
    </xs:schema> 

  </wsdl:types> 

  SOAP response: 
  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
     <soapenv:Header/> 
     <soapenv:Body> 
        <ns:getCDSIndiceReturnsResponse xmlns:ns="http://ubs.gcs/xsd"> 
           <ns:return> 
              <indiceSeries xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <indiceVersion xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <maturityDate xmlns="http://types.ws.gcs.ubs.com/xsd">0001-01-01T00:00:00.202Z</maturityDate> 
              <name xmlns="http://types.ws.gcs.ubs.com/xsd">DJ CDX NA - IG</name> 
              <onTheRun xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <redcode xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <redcodeIdx xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <symbol xmlns="http://types.ws.gcs.ubs.com/xsd">CDXNAIG</symbol> 
              <term xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
           </ns:return> 
           <ns:return> 
              <indiceSeries xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <indiceVersion xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <maturityDate xmlns="http://types.ws.gcs.ubs.com/xsd">0001-01-01T00:00:00.202Z</maturityDate> 
              <name xmlns="http://types.ws.gcs.ubs.com/xsd">DJ CDX NA - XO</name> 
              <onTheRun xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <redcode xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <redcodeIdx xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
              <symbol xmlns="http://types.ws.gcs.ubs.com/xsd">CDXNAXO</symbol> 
              <term xmlns="http://types.ws.gcs.ubs.com/xsd"/> 
           </ns:return> 
        </ns:getCDSIndiceReturnsResponse> 
     </soapenv:Body> 
  </soapenv:Envelope> 

  Java Code (snippet): 

  public class BaseReturn implements Serializable { 

          /* Price/Returns data */ 
          protected Calendar basePriceDate = null; 
          protected float currentPrice = 0; 
          protected float intrinsicPrice = 0; 
          protected float changeOneDay = 0; 
          protected float changeOneWeek = 0; 
          protected float changeOneMonth = 0; 
          protected float changeThreeMonths = 0; 
  . 

  public class CDSIndiceReturns extends BaseReturn implements Serializable { 
          
          private String   symbol = ""; 
          private String   name   = "";  
          private String   term   = ""; 
          private String   indiceSeries  = "";    
          private String   indiceVersion = ""; 
          private Calendar maturityDate = null; 
          private String   onTheRun = ""; 
          private String   redcode = ""; 
          private String   redcodeIdx = ""; 




  ______________________________________________ 
  From:   Ricci, Ken  
  Sent:   Wednesday, March 28, 2007 12:55 PM 
  To:     axis-user@ws.apache.org 
  Cc:     Ricci, Ken 
  Subject:        [Axis2] Bean generated WSDL missing ancestor properties in SOAP response 

  I have a base bean, ClassA with a few properties.   The ClassA is extended by ClassB for some additional properties.   The generated WSDL for ClassB is correct.  However, the SOAP response omits all the elements/values from the ancestor (ClassA)

  Is this allowed in Axis2?   I tried to create additional getters methods in ClassB for the ClassA attributes.   That will give me the correct SOAP response, but double the generate WSDL elements for the ClassA attributes.   That confuses the WS client.

  Help is appreciated. 

  Thx, Ken 



------------------------------------------------------------------------------



  Visit our website at http://www.ubs.com

  This message contains confidential information and is intended only 
  for the individual named.  If you are not the named addressee you 
  should not disseminate, distribute or copy this e-mail.  Please 
  notify the sender immediately by e-mail if you have received this 
  e-mail by mistake and delete this e-mail from your system.

  E-mail transmission cannot be guaranteed to be secure or error-free 
  as information could be intercepted, corrupted, lost, destroyed, 
  arrive late or incomplete, or contain viruses.  The sender therefore 
  does not accept liability for any errors or omissions in the contents 
  of this message which arise as a result of e-mail transmission.  If 
  verification is required please request a hard-copy version.  This 
  message is provided for informational purposes and should not be 
  construed as a solicitation or offer to buy or sell any securities or 
  related financial instruments.




------------------------------------------------------------------------------


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