users@jaxb.java.net

Exception to Soap faults

From: raags <apparna_at_gmail.com>
Date: Mon, 7 Apr 2008 12:54:41 -0700 (PDT)

I have a custom exception that extends Exception class and it has a member
that's list of pojos. When I deploy the webservice that contains a webmethod
that throws my custom exception, instead of list of pojos, I see a list of
"objects".

Here is the webservice code
<code>
@WebMethod
        public String sayMyName1(String aName) throws ValidationException
        {
                
                        if (aName.length()== 0)
                        {
                                ValidationException faultinfo = new ValidationException("Please make
sure name is not empty");
                                
                                throw faultinfo;
                        }
                
                return super.sayMyName(aName);
                
        }

public class ValidationException extends Exception
{
        String detailedInfo;
        
        String moreInformation;
        
        ArrayList<MyErrorObject> ErrorObj;
        public ValidationException(String message)
        {
                super(message);
        }
        public String getDetailedInfo()
        {
                return detailedInfo;
        }
        public void setDetailedInfo(String detailedInfo)
        {
                this.detailedInfo = detailedInfo;
        }
        public String getMoreInformation()
        {
                return moreInformation;
        }
        public void setMoreInformation(String moreInformation)
        {
                this.moreInformation = moreInformation;
        }
        public ArrayList<MyErrorObject> getMErrorObj()
        {
                return ErrorObj;
        }
        public void setMErrorObj(ArrayList<MyErrorObject> errorObj)
        {
                ErrorObj = errorObj;
        }
        
}
public class MyErrorObject
{
        
        String myErrorId;
        String myErrorMessage;
        
        public MyErrorObject()
        {
        
        }

        public String getMyErrorId() {
                return myErrorId;
        }

        public void setMyErrorId(String myErrorId) {
                this.myErrorId = myErrorId;
        }

        public String getMyErrorMessage() {
                return myErrorMessage;
        }

        public void setMyErrorMessage(String myErrorMessage) {
                this.myErrorMessage = myErrorMessage;
        }
        
        

}

When its deployed the wsdl that gets generated(part of the wsdl):
  <xs:complexType name="ValidationException">
    <xs:sequence>
     <xs:element maxOccurs="unbounded" minOccurs="0" name="ErrorObj"
type="xs:anyType"/>
     :
    </xs:sequence>

</code>
Why does it get converted to "anyType" instead of "ErrorObject" when JAXB
converts the java to wsdl?

Any ideas?

Thanks
-- 
View this message in context: http://www.nabble.com/Exception-to-Soap-faults-tp16539213p16539213.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.