Salesforce WSDL import simpleContent with extension

I am trying to import WSDL into Salesforce, where one of the XML elements contains both the element and the string value, for example.

 <foo bar="bob">baz</foo>

When I import it using the WSDL tool for Apex, the string value is not available in the generated class - just an attribute.

Here is a WSDL snippet:

 <xs:complexType name="password">
   <xs:simpleContent>
     <xs:extension base="xs:string">
       <xs:attribute name="Type" type="xs:string"/>
     </xs:extension>
   </xs:simpleContent>
 </xs:complexType>

Generated Class:

public class password {
  public String Type_x;
  private String[] Type_x_att_info = new String[]{'Type'};
  private String[] apex_schema_type_info = new String[]{'http://schema.test.org/1_0','false','false'};
  private String[] field_order_type_info = new String[]{};
}

Is there a way to change this class manually to provide a value without an internal element?

+3
source share
2 answers

, WSDL2Apex xs: extension ( WSDL . 201 http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf).

, :

public class password {
  public String input;
  public String Type_x;
  private String[] input_type_info = new String[]{'input','http://www.w3.org/2001/XMLSchema','string','1','1','false'}; // change 'input' to be the desired name of your element
  private String[] Type_x_att_info = new String[]{'Type'};
  private String[] apex_schema_type_info = new String[]{'http://schema.test.org/1_0','false','false'};
  private String[] field_order_type_info = new String[]{};
}

, SOAP, - , WSDL.

+2

WebServiceCallout.invoke , . , .

FuseIT SFDC Explorer, Wsdl2Apex. HttpRequest XML- SOAP Apex. -.

0

Source: https://habr.com/ru/post/1779677/


All Articles