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
Cory CowgillCory Cowgill 

Failed to Import WSDL - Anyone see whats wrong with this XML for WSDL2Apex ?

Does anyone see the reason why this service can't be consumed by WSDL2Apex for generating my callout classes in Apex?

 

I am trying to make some SOAP WS calls to Sharepoint Server from Salesforce.

 


<wsdl:definitions xmlns:s0="urn:Microsoft.Search" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://microsoft.com/webservices/SharePoint/QueryService" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://microsoft.com/webservices/SharePoint/QueryService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Microsoft Windows SharePoint Server 3.0 Search Query Web Service</wsdl:documentation>
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="urn:Microsoft.Search">
      <s:element name="Query">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="queryXml" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="QueryResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="QueryResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="Registration">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="registrationXml" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="RegistrationResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="RegistrationResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="Status">
        <s:complexType />
      </s:element>
      <s:element name="StatusResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="StatusResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
    <s:schema elementFormDefault="qualified" targetNamespace="http://microsoft.com/webservices/SharePoint/QueryService">
      <s:element name="QueryEx">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="queryXml" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="QueryExResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="QueryExResult">
              <s:complexType>
                <s:sequence>
                  <s:element ref="s:schema" />
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="QuerySoapIn">
    <wsdl:part name="parameters" element="s0:Query" />
  </wsdl:message>
  <wsdl:message name="QuerySoapOut">
    <wsdl:part name="parameters" element="s0:QueryResponse" />
  </wsdl:message>
  <wsdl:message name="QueryExSoapIn">
    <wsdl:part name="parameters" element="tns:QueryEx" />
  </wsdl:message>
  <wsdl:message name="QueryExSoapOut">
    <wsdl:part name="parameters" element="tns:QueryExResponse" />
  </wsdl:message>
  <wsdl:message name="RegistrationSoapIn">
    <wsdl:part name="parameters" element="s0:Registration" />
  </wsdl:message>
  <wsdl:message name="RegistrationSoapOut">
    <wsdl:part name="parameters" element="s0:RegistrationResponse" />
  </wsdl:message>
  <wsdl:message name="StatusSoapIn">
    <wsdl:part name="parameters" element="s0:Status" />
  </wsdl:message>
  <wsdl:message name="StatusSoapOut">
    <wsdl:part name="parameters" element="s0:StatusResponse" />
  </wsdl:message>
  <wsdl:portType name="QueryServiceSoap">
    <wsdl:operation name="Query">
      <wsdl:input message="tns:QuerySoapIn" />
      <wsdl:output message="tns:QuerySoapOut" />
    </wsdl:operation>
    <wsdl:operation name="QueryEx">
      <wsdl:input message="tns:QueryExSoapIn" />
      <wsdl:output message="tns:QueryExSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="Registration">
      <wsdl:input message="tns:RegistrationSoapIn" />
      <wsdl:output message="tns:RegistrationSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="Status">
      <wsdl:input message="tns:StatusSoapIn" />
      <wsdl:output message="tns:StatusSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="QueryServiceSoap" type="tns:QueryServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="Query">
      <soap:operation soapAction="urn:Microsoft.Search/Query" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="QueryEx">
      <soap:operation soapAction="http://microsoft.com/webservices/SharePoint/QueryService/QueryEx" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Registration">
      <soap:operation soapAction="urn:Microsoft.Search/Registration" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Status">
      <soap:operation soapAction="urn:Microsoft.Search/Status" 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="QueryService">
    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Microsoft Windows SharePoint Server 3.0 Search Query Web Service</wsdl:documentation>
    <wsdl:port name="QueryServiceSoap" binding="tns:QueryServiceSoap">
      <soap:address location="https://XXXX.YYYYYYYYYYYY.com/_vti_bin/spsearch.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Shoby Abdi.ax910Shoby Abdi.ax910

I would take a look at some of the reserved keywords that exist within Apex

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_reserved_words.htm

 

"Any" is being used by your WSDL document and it is a reserved keyword in Apex. 

 

Also make sure your complexTypes and elementTypes are one level deep. 

Cory CowgillCory Cowgill

Thanks for the reply and advice.

 

Yeah, I already cut out some of the non compliant WSDL2Apex things like additonal bindings and stuff.

 

My understanding was any reserved words get modified like so (per documentation):

"If a WSDL document contains an Apex reserved word, the word is appended with _x when the Apex class is generated."

 

Its probably just Microsoft and some weird non compliant stuff they are doing..... at least thats what I'm going with for the moment. LOL.

forecast_is_cloudyforecast_is_cloudy

The issue isn't as much that 'any' is a reserved word in Apex (which it is). It's that the 'any' XSD schema construct is not currently supported by WSDL2Apex. 

Hari GopalHari Gopal

I had similar problem and resolved it by removing "soap12 bindings and port" 

 

<wsdl:binding name="ListsSoap12" type="tns:ListsSoap">

................

...................

..................

 </wsdl:binding>

 

<wsdl:service name="Lists">

  <wsdl:port name="ListsSoap" binding="tns:ListsSoap">
      <soap:address..............

    </wsdl:port>
    <wsdl:port name="ListsSoap12" binding="tns:ListsSoap12">
      <soap12:address...................

    </wsdl:port>

 </wsdl:service>