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
philbophilbo 

Empty sub-classes in output of wsdl2apex??

Hey,

I am finding, when running certain WSDL files thru 'wsdl2apex', that there are empty sub-classes in the resulting Apex code, and I'm not sure what do do with them. 

I have included a stripped-down WSDL sample, and the resulting Apex, below.  Note in particular the element 'SendingCompanyID', embedded in the 'CustomerTransfer' element, which encapsulates a SimpleType.  Pretty basic stuff, I think.  The resulting 'SendingCompanyID_element' class in the Apex code is empty.  Is this correct?  I have to pass an instance of that class into the 'BasicHttpBinding_ITwoWayAsyncVoid.rcv_operation_Intake()' method, and I cannot see how to to actually insert any information into it.

Can someone out there help me understand how to use this Apex class - or, if there's something wrong with it, what to do about it?

Also - I have heard references to wsdl2apex documentation - but it's not apparent where it is - if there's a link to some good technical docs, can someone point me at it?

Thanks

-philbo

WSDL:
<—xml version="1.0" encoding="utf-8"–>
<wsdl:definitions name="BizTalkServiceInstance"
  targetNamespace="http://xyz/2008/05/partnerintake" 
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" . . . xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="CustomerTransfer">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="SequenceID" type="xs:int"/>
        <xs:element name="SendingCompanyID">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:maxLength value="25" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="CustomerTransferResponse">
    <xs:complexType>
      <xs:element name="success" type="xs:boolean" minOccurs="0"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="InputMessage">
    <wsdl:part name="part" element="tns:CustomerTransfer"/>
  </wsdl:message>
  <wsdl:message name="OutputMessage">
    <wsdl:part name="part" element="tns:CustomerTransferResponse"/>
  </wsdl:message>
  <wsdl:portType name="Intake">
    <wsdl:documentation>service "Intake_Orchestration.Intake" port "Intake_Request"</wsdl:documentation>
    <wsdl:operation name="rcv_operation_Intake">
      <wsdl:documentation>operation "rcv_operation_Intake"</wsdl:documentation>
      <wsdl:input message="tns:InputMessage"/>
      <wsdl:output message="tns:OutputMessage"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="BasicHttpBinding_ITwoWayAsyncVoid" type="tns:Intake">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="rcv_operation_Intake">
      <wsdl:documentation>operation "rcv_operation_Intake"</wsdl:documentation>
      <soap:operation soapAction="rcv_operation_Intake" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="Intake">
    <wsdl:port name="BasicHttpBinding_ITwoWayAsyncVoid" binding="tns:BasicHttpBinding_ITwoWayAsyncVoid">
      <soap:address location="http://dev/xyzServer/xyz.svc"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

 

 
APEX code:
//Generated by wsdl2apex

public class aon_Philbo {
    public class CustomerTransferResponse_element {
        private String[] apex_schema_type_info = new String[]{'http://xyz/2008/05/partnerintake','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class SendingCompanyID_element {
    }
    public class CustomerTransfer_element {
        public Integer SequenceID;
        public aon_Philbo.SendingCompanyID_element SendingCompanyID;
        private String[] SequenceID_type_info = new String[]{'SequenceID','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] SendingCompanyID_type_info = new String[]{'SendingCompanyID','http://xyz/2008/05/partnerintake','SendingCompanyID_element','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://xyz/2008/05/partnerintake','false'};
        private String[] field_order_type_info = new String[]{'SequenceID','SendingCompanyID'};
    }
    public class BasicHttpBinding_ITwoWayAsyncVoid {
        public String endpoint_x = 'http://dev/xyzServer/xyz.svc';
        private String[] ns_map_type_info = new String[]{'http://xyz/2008/05/partnerintake', 'aon_Philbo'};
        public void rcv_operation_Intake(Integer SequenceID,aon_Philbo.SendingCompanyID_element SendingCompanyID) {
            aon_Philbo.CustomerTransfer_element request_x = new aon_Philbo.CustomerTransfer_element();
            aon_Philbo.CustomerTransferResponse_element response_x;
            request_x.SequenceID = SequenceID;
            request_x.SendingCompanyID = SendingCompanyID;
            Map<String, aon_Philbo.CustomerTransferResponse_element> response_map_x = new Map<String, aon_Philbo.CustomerTransferResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'rcv_operation_Intake',
              'http://xyz/2008/05/partnerintake',
              'CustomerTransfer',
              'http://xyz/2008/05/partnerintake',
              'CustomerTransferResponse',
              'aon_Philbo.CustomerTransferResponse_element'}
            );
            response_x = response_map_x.get('response_x');
        }
    }
}

 

cheenathcheenath
This is due to a bug in handling simpleType restriction in 
your WSDL:

<xs:element name="SendingCompanyID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="25" />
</xs:restriction>
</xs:simpleType>
</xs:element>


You can replace this with xs:string.

<xs:element name="SendingCompanyID" type="xs:string"></xs:element>
HTHs,


philbophilbo
Hey,

Thanks, I think this'll work fine.  I take it then that there's no way to preserve the value-add in those <xs:simpleType> blocks in the resulting Apex code - e.g....

maximum length of strings
enumerations
minimum and maximum values of integers

Is there anything on the roadmap to add in support for this stuff?

Thanks!

-philbo
aksmaksm
I have the same problem. I am getting an empty class in wsdl2apex output for the following element.
 
<xs:simpleType name="NotificationSeverityType">
    <xs:annotation>
     <xs:documentation>Identifies the set of severity values for a Notification.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
     <xs:enumeration value="ERROR"/>
     <xs:enumeration value="FAILURE"/>
     <xs:enumeration value="NOTE"/>
     <xs:enumeration value="SUCCESS"/>
     <xs:enumeration value="WARNING"/>
    </xs:restriction>
   </xs:simpleType>
 
wsdl2apex output is,
 
public class NotificationSeverityType {
}
 
How do I manage to create the class for simpleType with enumeration list?
 
thanks
Sk