I've read several posts on this but have yet to find the correct solution. Basically, using the FuseIT wsdl2APex utility I'm having issues with wsdl definitions like this:

<s:complexType name="Organization">
        <s:element minOccurs="0" maxOccurs="unbounded" name="Unit" type="s1:Unit"/>
        <s:element minOccurs="0" maxOccurs="1" name="Employment" type="s1:Employment"/>
        <s:element minOccurs="0" maxOccurs="1" name="Approver" type="s:string"/>
        <s:element minOccurs="0" maxOccurs="1" name="Manager" type="s:string"/>
    <s:attribute name="Approvals" type="s:int"/>
<s:complexType name="Unit">
        <s:extension base="s:string">
            <s:attribute name="Type" type="s:string"/>

The data class generated results in this:

//Warning: Simple Content Types with Attributes are not supported by WebServiceCallout.invoke
public class Unit {
    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'};
    public String[] Type_x_att_info = new String[]{'Type'};
    private String[] apex_schema_type_info = new String[]{'urn:Cornerstone:ClientData','true','false'};
    private String[] field_order_type_info = new String[]{};

The resulting XML sent to the webservice is formed like this:

     <Unit Type="Division" />
     <Unit Type="Cost Center" />

Which is missing the unit identifier string ("input" in the APEX code). I need to send this:

    <Unit Type="Division">ExternalDiv1</Unit>
    <Unit Type="Cost Center">CostCenter2</Unit>

What do I need to do to the class to pass the value of the "unit identifier" in the "input" field? It is ignoring that value when generating the output.

Many thanks in advance for any help!

  • Are you able to share your WSDL, or send it through to FuseIT support via the tool? Jul 27, 2015 at 22:37
  • Sure, I will send it through FuseIT support. Thank you!!! Jul 28, 2015 at 17:05
  • Any chance you've had to look at this? I'm about at my wits end. About ready to build the XML using the DOM, but that's not going to be pretty. Any help would be greatly appreciated!! Jul 30, 2015 at 21:24
  • Did you see my email that the FuseIT SFDC Explorer tool can be used to generate the XML to send directly via an HttpRequest? I'm reasonably certain that WebServiceCallout. Invoke can't add attributes to base types like strings. Jul 31, 2015 at 8:35

1 Answer 1


The problem is there in the generated warning:

//Warning: Simple Content Types with Attributes are not supported by WebServiceCallout.invoke

The complex type Unit is an extension of the simple type string and it also has the attribute Type. The underlying apex method WebServiceCallout.invoke doesn't support this.

Instead, you can use the FuseIT SFDC Explorer Wsdl2Apex functionality to generate the HttpRequest and required SOAP XML body. When selecting the methods to generate for, use the drop down to the right of the method to select the HttpRequest.

To add the WSSE headers, have a look at Callouts from Salesforce – Adding Soap Headers for WSSE Security. You will need to use the <env:Header> SOAP header to specify the required authentication details.

  • Thanks Daniel, I did do that and I should be able to manipulate the XML with the DOM. Now my issue is the WebService is expecting WSSE, so I need to insert the security into the http header, not sure how I can combine, DOM, Soap and http in the same class. Jul 31, 2015 at 16:30
  • I've added some more details to the answer. Because you are now building the XML directly it shouldn't be too difficult to add the extra details. Aug 1, 2015 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .