axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Leone" <markleone...@hotmail.com>
Subject RE: RES: Mapping a bean within a bean
Date Mon, 05 Apr 2004 23:20:51 GMT
I was hoping nobody would ask me that. :) It was a silly mistake. I thought 
I had bounced Tomcat after swapping out the class files, but I had not. So 
the changes I made to my Java code were not actually deployed to the web 
container.

Unfortunately, I'm not sure what I changed to make it work. I just spent 
some time trying to make it behave like it did beofre, and I couldn't. I 
think I might have had a typo on my setter or getter methods, resulting in a 
bean that wasn't quite a bean. But I'm not sure.

Here is my java code and WSDD, along with the WSDL that AXIS created. Maybe 
you can find your problem by looking at this. Otherwise, why don't you post 
your java, WSDD, and the resulting WSDL?


***** java beans *****

package TaxServiceW2B;
public class TestBean2{

  public double total = 0;
  public double subtotal = 0;
  public double rate = 0;
  public String text = "";
  public InnerBean anotherBean;

  public TestBean2(InnerBean anotherBean){
     this.anotherBean = anotherBean;
  }

  public void setTotal(double total){
     this.total = total;
  }

  public void setSubtotal(double subtotal){
     this.subtotal = subtotal;
  }

  public void setRate(double rate){
     this.rate = rate;
  }

  public void setText(String text){
     this.text = text;
  }

  public void setAnotherBean(InnerBean anotherBean){
     this.anotherBean = anotherBean;
  }

  public double getTotal(){
     return total;
  }

  public double getSubtotal(){
     return subtotal;
  }

  public double getRate(){
     return rate;
  }

  public String getText(){
     return text;
  }

  public InnerBean getAnotherBean(){
     return anotherBean;
  }

}


  package TaxServiceW2B;

  public class InnerBean{

    int number = 0;
    String color = "none";

    public InnerBean(){}
    public InnerBean(int number, String color){
      this.number = number;
      this.color = color;
    }

    public void setNumber(int number){
      this.number = number;
    }

    public void setColor(String color){
      this.color = color;
    }

    public int getNumber(){
      return number;
    }

    public String getColor(){
      return color;
    }

  }

***** Service Implementation *****

package TaxServiceW2B;

public class TaxServiceW2B
{
    public TestBean2 calcTaxRate(double subtotal, double total)
    {
        double rate =  (total - subtotal) / subtotal;
	  InnerBean anotherBean = new InnerBean(1,"red");
        TestBean2 bean = new TestBean2(anotherBean);
	  bean.setTotal(total);
	  bean.setSubtotal(subtotal);
	  bean.setRate(rate);
	  bean.setText("I am a superbean");
	  return bean;
    }

    public double calcSubtotal(double total, double taxpercent)
    {
        double subtotal = total / (1 + taxpercent);
        return subtotal;
    }

    public double calcTotal(double subtotal, double taxpercent)
    {
        double total = subtotal * (1 + taxpercent);
        return total;
    }
}


***** WSDD *****

<deployment xmlns="http://xml.apache.org/axis/wsdd/"

xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

<service name="TaxServiceW2B" provider="java:RPC">

  <parameter name="className" value="TaxServiceW2B.TaxServiceW2B"/>

  <parameter name="allowedMethods" value="*"/>
  <beanMapping xmlns:ns1="urn:my.namespace" qname="ns1:TestBean2"
      languageSpecificType="java:TaxServiceW2B.TestBean2"/>
  <beanMapping xmlns:ns1="urn:my.namespace" qname="ns1:InnerBean"
      languageSpecificType="java:TaxServiceW2B.InnerBean"/>

</service>

</deployment>


***** AXIS Generated WSDL *****

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions 
targetNamespace="http://localhost:8080/axis/services/TaxServiceW2B" 
xmlns="http://schemas.xmlsoap.org/wsdl/" 
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:impl="http://localhost:8080/axis/services/TaxServiceW2B" 
xmlns:intf="http://localhost:8080/axis/services/TaxServiceW2B" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:tns1="urn:my.namespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="urn:my.namespace" 
xmlns="http://www.w3.org/2001/XMLSchema">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="InnerBean">
- <sequence>
  <element name="color" nillable="true" type="xsd:string" />
  <element name="number" type="xsd:int" />
  </sequence>
  </complexType>
- <complexType name="TestBean2">
- <sequence>
  <element name="anotherBean" nillable="true" type="tns1:InnerBean" />
  <element name="rate" type="xsd:double" />
  <element name="subtotal" type="xsd:double" />
  <element name="text" nillable="true" type="xsd:string" />
  <element name="total" type="xsd:double" />
  </sequence>
  </complexType>
  </schema>
  </wsdl:types>
- <wsdl:message name="calcTaxRateResponse">
  <wsdl:part name="calcTaxRateReturn" type="tns1:TestBean2" />
  </wsdl:message>
- <wsdl:message name="calcTotalResponse">
  <wsdl:part name="calcTotalReturn" type="xsd:double" />
  </wsdl:message>
- <wsdl:message name="calcSubtotalRequest">
  <wsdl:part name="in0" type="xsd:double" />
  <wsdl:part name="in1" type="xsd:double" />
  </wsdl:message>
- <wsdl:message name="calcTotalRequest">
  <wsdl:part name="in0" type="xsd:double" />
  <wsdl:part name="in1" type="xsd:double" />
  </wsdl:message>
- <wsdl:message name="calcSubtotalResponse">
  <wsdl:part name="calcSubtotalReturn" type="xsd:double" />
  </wsdl:message>
- <wsdl:message name="calcTaxRateRequest">
  <wsdl:part name="in0" type="xsd:double" />
  <wsdl:part name="in1" type="xsd:double" />
  </wsdl:message>
- <wsdl:portType name="TaxServiceW2B">
- <wsdl:operation name="calcTaxRate" parameterOrder="in0 in1">
  <wsdl:input message="impl:calcTaxRateRequest" name="calcTaxRateRequest" />
  <wsdl:output message="impl:calcTaxRateResponse" name="calcTaxRateResponse" 
/>
  </wsdl:operation>
- <wsdl:operation name="calcTotal" parameterOrder="in0 in1">
  <wsdl:input message="impl:calcTotalRequest" name="calcTotalRequest" />
  <wsdl:output message="impl:calcTotalResponse" name="calcTotalResponse" />
  </wsdl:operation>
- <wsdl:operation name="calcSubtotal" parameterOrder="in0 in1">
  <wsdl:input message="impl:calcSubtotalRequest" name="calcSubtotalRequest" 
/>
  <wsdl:output message="impl:calcSubtotalResponse" 
name="calcSubtotalResponse" />
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="TaxServiceW2BSoapBinding" type="impl:TaxServiceW2B">
  <wsdlsoap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="calcTaxRate">
  <wsdlsoap:operation soapAction="" />
- <wsdl:input name="calcTaxRateRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://TaxServiceW2B" use="encoded" />
  </wsdl:input>
- <wsdl:output name="calcTaxRateResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://localhost:8080/axis/services/TaxServiceW2B" use="encoded" 
/>
  </wsdl:output>
  </wsdl:operation>
- <wsdl:operation name="calcTotal">
  <wsdlsoap:operation soapAction="" />
- <wsdl:input name="calcTotalRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://TaxServiceW2B" use="encoded" />
  </wsdl:input>
- <wsdl:output name="calcTotalResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://localhost:8080/axis/services/TaxServiceW2B" use="encoded" 
/>
  </wsdl:output>
  </wsdl:operation>
- <wsdl:operation name="calcSubtotal">
  <wsdlsoap:operation soapAction="" />
- <wsdl:input name="calcSubtotalRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://TaxServiceW2B" use="encoded" />
  </wsdl:input>
- <wsdl:output name="calcSubtotalResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://localhost:8080/axis/services/TaxServiceW2B" use="encoded" 
/>
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="TaxServiceW2BService">
- <wsdl:port binding="impl:TaxServiceW2BSoapBinding" name="TaxServiceW2B">
  <wsdlsoap:address 
location="http://localhost:8080/axis/services/TaxServiceW2B" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>


>From: "Fabricio B. Teixeira" <fabriciobt@yahoo.com.br>
>Reply-To: axis-user@ws.apache.org
>To: <axis-user@ws.apache.org>
>Subject: RES: Mapping a bean within a bean
>Date: Mon, 5 Apr 2004 08:56:09 -0300
>
>Im with a similar problem and Im get crazy.
>Could you tell me how you configured your web container?
>
>-----Mensagem original-----
>De: Mark Leone [mailto:markleone923@hotmail.com]
>Enviada em: segunda-feira, 5 de abril de 2004 01:17
>Para: axis-user@ws.apache.org
>Assunto: RE: Mapping a bean within a bean
>
>
>Problem solved. Found a misconfiguration in my web container, causing an
>older version of the class files to be running. The bean mapping works as
>expected with a wrapped bean.
>
>
>_________________________________________________________________
>Watch LIVE baseball games on your computer with MLB.TV, included with MSN
>Premium!
>http://join.msn.com/?page=features/mlb&pgmarket=en-us/go/onm00200439ave/dire
>ct/01/
>
>

_________________________________________________________________
Free up your inbox with MSN Hotmail Extra Storage! Multiple plans available. 
http://join.msn.com/?pgmarket=en-us&page=hotmail/es2&ST=1/go/onm00200362ave/direct/01/


Mime
View raw message