function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
surbhi narulasurbhi narula 

My class is throwing error "Invalid type: cc_b_UPSResponseWrapper.UPSSecurity"

Below is the code :-
public class UPSRequestDataSet {
        
    public static cc_b_UPSResponseWrapper UPSWrapperData() {
        
        cc_b_UPSResponseWrapper UPSWrapObj = new cc_b_UPSResponseWrapper();
        
        cc_b_UPSResponseWrapper.UPSSecurity usertoken = new cc_b_UPSResponseWrapper.UPSSecurity();
        usertoken.Username = CC_Bee_Services__c.get('cc_b_UPS').Username__c ;
        cc_b_UPSResponseWrapper.UPSSecurity upsSec = new cc_b_UPSResponseWrapper.UPSSecurity();
        upsSec.UsernameToken = usertoken ;
        UPSWrapObj.UPSSecurity = upsSec ;
        //String str = Json.serialize(UPSWrapObj);
        return UPSWrapObj;
    }
}

Here cc_b_UPSResponseWrapper is my wrapper class having inner classes UPSSecurity ..
Please help to resolve the error..!!
BALAJI CHBALAJI CH
Hi Surbhi,
Can you please let us know at which line this error is coming ?
 
And also at line 7 
upsSec.UsernameToken = usertoken ;
upsSec and usertoken are both instances of the inner class i.e, instance of cc_b_UPSResponseWrapper.UPSSecurity. Whereas, UsernameToken mightbe a variable in that inner class if I'm not wrong. Not sure how you are assigning inner class instance to a variable...

Best Regards,
BALAJI