cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasminadesai <jasminade...@yahoo.com>
Subject Re: cxf 2.2.1 schema validation throws error
Date Fri, 10 May 2013 05:06:40 GMT
Thanks Dennis.

Please find below the address class. The web service method actually just
takes address as a parameter and unfortunately that itself is passed as
null. The xsd was auto generated from the java code by the cxf maven plugin.

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


package com.soap.webservice.api;

import javax.xml.bind.annotation.XmlElement;
import java.util.Date;
import java.util.List;


public class Address {

    private String address1;

    private String address2;

    private String fullCode;

    private double latitude;

    private double longitude;

    private String country = "US";

    private List<String> locations;

    private Date resolvedDate;


    public Address() {
        setAddress1("");
        setAddress2("");
    }


    public Address(String address1, String address2) {
        this.address1 = address1 == null ? "" : address1.trim();
        this.address2 = address2 == null ? "" : address2.trim();
    }


    public Address(String address, String city, String state, String zip) {
        if (zip == null)
            zip = "";
        this.address1 = address.trim();
        this.address2 = city.trim() + ", " + state.trim() + " " +
zip.trim();
    }


    @XmlElement(required = false, nillable = true)
    public List<String> getLocations() {
        return locations;
    }


    public void setLocations(List<String> locations) {
        this.locations = locations;
    }


    @XmlElement(required = false, nillable = true)
    public Date getResolvedDate() {
        return resolvedDate;
    }

    public void setResolvedDate(Date resolvedDate) {
        this.resolvedDate = resolvedDate;
    }


    @XmlElement(required = false, nillable = true)
    public String getAddress1() {
        return address1;
    }


    public void setAddress1(String address1) {
        this.address1 = (address1 == null) ? "" : address1;
    }


    @XmlElement(required = true, nillable = false)
    public String getAddress2() {
        return address2;
    }


    public void setAddress2(String address2) {
        this.address2 = (address2 == null) ? "" : address2;
    }


    public void setFullCode(String fullCode) {
        this.fullCode = fullCode;
    }


    @XmlElement(required = false, nillable = true)
    public String getFullCode() {
        return fullCode;
    }


    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }


    @XmlElement(required = false, nillable = true)
    public double getLatitude() {
        return latitude;
    }


    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }


    @XmlElement(required = false, nillable = true)
    public double getLongitude() {
        return longitude;
    }


    public int hashCode() {
        return (address1.hashCode() + address2.hashCode()) / 2;
    }


    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        try {
            Address castObj = (Address) obj;
            if (!castObj.getAddress1().equals(getAddress1()))
                return false;
            if (!castObj.getAddress2().equals(getAddress2()))
                return false;
            return true;
        } catch (ClassCastException e) {
            return false;
        }
    }


    public String toString() {
        return address1 + ", " + address2 + ", " + country;
    }

    public void setCountry(String country) {
        if (country == null || country.length() == 0) {
            this.country = "US";
        } else {
            this.country = country.toUpperCase();
        }
    }

    @XmlElement(required = false, nillable = true)
    public String getCountry() {
        return country;
    }
}




--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-1-schema-validation-throws-error-tp5727471p5727481.html
Sent from the cxf-user mailing list archive at Nabble.com.

Mime
View raw message