I have a WSDL from a vendor which includes a method that expects one of the params ('Xmldoc') to be embedded XML. The WSDL for the method:

<s:element name="ImportGuest">
      <s:element minOccurs="0" maxOccurs="1" name="DbUserName" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DbPassword" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="DbName" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Server" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Platform" type="s:string" />
      <s:element minOccurs="0" maxOccurs="1" name="Xmldoc">
        <s:complexType mixed="true">
            <s:any />

And the documentation of ImportGuests is:

The ImportGuest message request requires the following six parameters:
DbUserName - User Name - String
DbPassword - Password - String
DbName - Database Name - String
Server - Server Name - String
Platform - SQL Server - String
XmlDoc - XML document containing prospect information. See “XML Document Specification” on page 3.

The XML Doc specification is basically an object with a couple dozen fields, serialized as an XML element with each field as a child element.

So it is expecting the soap request body to include an element called Xmldoc which includes basically more XML. Sample from the docs:

  <ImportGuest xmlns="Vendor.Portal.Product.WebServices">
    <Platform>SQL Server</Platform> 
          <SourceName>Community Website</SourceName>
          <!-- snip -->

I can generate the XML doc content directly, but how can I insert that into the body? The method generated by WSDL2APEX looks like:

public SoapWrapper.ImportGuestResult_element ImportGuest(
  String DbUserName,
  String DbPassword,
  String DbName,
  String Server,String Platform,
  SoapWrapper.Xmldoc_element Xmldoc

And 'Xmldoc_element' has no public members:

public class Xmldoc_element {
    private String[] apex_schema_type_info = new String[]{'Vendor.Portal.Product.WebServices','true','false'};
    private String[] field_order_type_info = new String[]{};

So how do I specify Xmldoc as the embedded content? Is my only choice to modify the WSDL to model the entire Xmldoc as an object? If I do that, will blank fields be passed, and can I suppress? It isn't clear from the spec if blank fields (as opposed to missing fields) are allowed, although I plan to check with the vendor.

  • Are you able to share the WSDL? Feel free to change the endpoint and find/replace any sensitive namespaces etc... – Daniel Ballinger Aug 8 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.