3

When generating apex code through a WSDL, several classes and member variables are generated. Each data type has its own class and the class has at least two private member variables associated with it. An example of a data type is below:

public class GaId {
    public String id;
    public String instance;
    private String[] id_att_info = new String[]{'id'};
    private String[] instance_att_info = new String[]{'instance'};
    private String[] apex_schema_type_info = new String[]{'http://www.namespace.com/dir1/dir2/yadda/yadda','false','false'};
    private String[] field_order_type_info = new String[]{};
}

Note the private String [] member variables. Now, intuitively I look at this code and think the String arrays are useless, since they are private and have no methods in the class accessing them. However, if you change one or more of them, then the callouts are impacted or downright don't work.

So the question is, how are these private String [] variables called or referenced by the WebService callout?

3

They aren't. They're for generating the SOAP messages associated with the calls. You don't need to worry about them, as the APEX runtime simply uses them to create the SOAP envelope and add the proper schema to the XML in the SOAP message in each call.

3
  • This doesn't answer my question. How do they get referenced in the SOAP calls? Is there some hidden reflection or inheritence in the background that allows the soap call to look up the hidden variables? – James Loghry Aug 23 '12 at 16:40
  • 1
    I believe so. The WSDL2APEX generator leaves a lot of the implementation out of the picture. You just call your WS method and it takes care of the rest. – jordan.baucke Aug 23 '12 at 16:45
  • 1
    There's an apex method the generated code uses, something like Webservice.callout (I can't remember and don't have any simple WSDL handy), which seems to have some undocumented reflection capabilities and uses these. I don't think it's yet been reverse engineered to a point where it could be used independently of the wsdl2apex autogenerated classes. – ca_peterson Aug 27 '12 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.