• kdolan
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies

I have a very simple XSD that I'm trying to include in my WSDL to alllow the Apex code to be generated.  The XML here is this:

<GetJurisdictions>
    <params>
      <param name="contactNo">11</param>
      <param name="loginGuid">abc123</param>
   </params>
</GetJurisdictions>

 

We could write the inline XSD a number of ways.  Here is one way:

<s:schema xmlns:s="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
<s:element name="GetJurisdictions">
<s:complexType>
<s:sequence>
<s:element ref="params"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="param">
<s:complexType id="val1" mixed="true">
<s:simpleContent>
<s:extension base="s:string">
<s:attribute name="name" type="s:string"/>
</s:extension>
</s:simpleContent>
</s:complexType>
</s:element>
<s:element name="params">
<s:complexType>
<s:sequence>
<s:element ref="param" maxOccurs="unbounded"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>

 

Here is the Apex code generated for the "param" element:


public class param_element {        

public String name;        

private String[] name_att_info = new String[]{'name'};        

private String[] apex_schema_type_info = new String[]{<URL Here>};        

private String[] field_order_type_info = new String[]{};    

}

 

The Apex class allows me to set the public variable "name", so setting the attribute value is no problem.  The problem is when the Apex code is generated, there is no way for me to set the "element" content.  If you look at the XML above, I have both element content (e.g., "abc123") and attribute content.  Since there are no public variables for the element data, I don't know how I would set the element data.  Any suggestions here?  

  • December 12, 2012
  • Like
  • 0

I have a very simple XSD that I'm trying to include in my WSDL to alllow the Apex code to be generated.  The XML here is this:

<GetJurisdictions>
    <params>
      <param name="contactNo">11</param>
      <param name="loginGuid">abc123</param>
   </params>
</GetJurisdictions>

 

We could write the inline XSD a number of ways.  Here is one way:

<s:schema xmlns:s="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
<s:element name="GetJurisdictions">
<s:complexType>
<s:sequence>
<s:element ref="params"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="param">
<s:complexType id="val1" mixed="true">
<s:simpleContent>
<s:extension base="s:string">
<s:attribute name="name" type="s:string"/>
</s:extension>
</s:simpleContent>
</s:complexType>
</s:element>
<s:element name="params">
<s:complexType>
<s:sequence>
<s:element ref="param" maxOccurs="unbounded"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>

 

Here is the Apex code generated for the "param" element:


public class param_element {        

public String name;        

private String[] name_att_info = new String[]{'name'};        

private String[] apex_schema_type_info = new String[]{'http://xxx.com/','true','false'};        

private String[] field_order_type_info = new String[]{};    

}

 

The problem is when the Apex code is generated, there is no way for me to set the param "element" content.  I can set the attribute "name" no problem.  I.e., in the XML example above, how do I set the "11" or "abc123"?  Any suggestiongs greatly appreciated.  

  • December 12, 2012
  • Like
  • 0