Unfortunately I don't think you are going to be able to use wsdl2apex and the corresponding WebServiceCallout.invoke()
to call these multipart methods.
As you have observed, the init
message is comprised of 4 parts:
- sessionId
- taskId
- initContext
- callbackContext
But WebServiceCallout.invoke()
will only accept a single request parameter as the second argument.
You might be able to promote all but one of the parts into headers as per Importing UPS Street Address WSDL into Apex, but that would depend on what the target web service is expecting.
There are a couple of challenges with this WSDL:
- The
schema
defines a targetNamespace
, but omits the xmlns
attribute.
- There are several elements in the schema that are defined as complex types that have a nested element also defined by a complex type. E.g.
AsyncActivateResult > activateResult
.
(1) was easily resolved by adding an xmlns
attribute on the schema to match the targetNamespace.
<xs:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://webservice.embedded.server.qa.backend.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://webservice.embedded.server.qa.backend.com/"
xmlns="http://webservice.embedded.server.qa.backend.com/"
version="1.0">
(2) was resolved by extracting the nested complexType elements are promoting them to direct descendants of the schema. Then the elements use the resulting type as a reference rather than trying to nest the complexType.
<!-- Created this complex type from the content of activateResult -->
<xs:complexType name="activateResultType">
<xs:complexContent>
<xs:extension base="tns:SaveResultType">
<xs:sequence>
<xs:element minOccurs="0" name="printedDocument" type="tns:ActivationAttachment"/>
<xs:element minOccurs="0" name="exportFormat" type="tns:ActivationAttachment"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="AsyncActivateResult">
<xs:complexType>
<xs:sequence>
<xs:element name="phase" type="xs:int"/>
<xs:element minOccurs="0" name="activateResult" type="activateResultType">
<!--<xs:complexType> has been un-nested -->
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
The resulting Apex class - webserviceEmbeddedServerQaBackendCo.cls