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
opiedogopiedog 

Web service callout failed: Unable to parse callout response for w3 xml schema

I'm new to Apex development and ran into the following issue I can't decipher when making a simple web service call from the Force IDE.

 

I generated the Apex class from the WSDL for my client's service and used that to make the web service call. The call succeeds in getting a response from the web service; I can see the expected data in the Execute Anonymous results window. But it eventually throws the following exception:

 

09:06:22.193|FATAL_ERROR|System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://www.w3.org/2001/XMLSchema=schema

 

Any help would be greatly appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
dkadordkador

 

      <s:element name="getSearchResultsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="getSearchResultsResult">
              <s:complexType>
                <s:sequence>
                  <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
                  <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

 Here's the snippet for your result element from the WSDL.  Notice the <s:any> elements.  We don't support that schema type.  For a full list of what we support, see http://wiki.developerforce.com/index.php/Apex_Web_Services_and_Callouts#WSDL2Apex (look for the section called "Supported WSDL Features").

 

 

All Answers

dkadordkador

Is that the whole error message you're receiving?

opiedogopiedog

Here is what I believe is the relevant output from the Execute Anonymous results window:

 

12:00:28.051|METHOD_ENTRY|[118]|WebServiceCallout.invoke(APEX_OBJECT, APEX_OBJECT, MAP, LIST)

 

12:00:28.055|CALLOUT_REQUEST|[118]|<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header /><env:Body><getSearchResults xmlns="MyWS"><churchID>TEST</churchID><searchStr>Animals</searchStr></getSearchResults></env:Body></env:Envelope>

 

12:00:28.055|CALLOUT_REQUEST|[118]|MyWS.getSearchResults_element request_x::SFDC_STACK_DEPTH=1 SOAPAction="MyWS/getSearchResults" User-Agent=SFDC-Callout/21.0 Accept=text/xml Content-Type=text/xml; charset=UTF-8 

 

12:00:28.239|CALLOUT_RESPONSE|[118]|<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getSearchResultsResponse xmlns="MyWS"><getSearchResultsResult><xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="view_DSMyWSActiveAdSearchWebService" msdata:UseCurrentLocale="true"><xs:complexType><xs:choice minOccurs="0" maxOccurs="unbounded"><xs:element name="view_DSMyWSActiveAdSearchWebService"><xs:complexType><xs:sequence><xs:element name="churchID"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="directoryID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" type="xs:int" /><xs:element name="adID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" type="xs:int" /><xs:element name="adType" type="xs:int" minOccurs="0" /><xs:element name="fullSizeAdURL" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="256" /></xs:restriction></xs:simpleType></xs:element><xs:element name="thumbSizeAdURL" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="256" /></xs:restriction></xs:simpleType></xs:element><xs:element name="salutation" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="firstName" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="lastName" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="company" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="150" /></xs:restriction></xs:simpleType></xs:element><xs:element name="address1" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="150" /></xs:restriction></xs:simpleType></xs:element><xs:element name="address2" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="150" /></xs:restriction></xs:simpleType></xs:element><xs:element name="city" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="state" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="zip" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="phone" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="email" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="150" /></xs:restriction></xs:simpleType></xs:element><xs:element name="web" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="150" /></xs:restriction></xs:simpleType></xs:element><xs:element name="companyDescription" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="300" /></xs:restriction></xs:simpleType></xs:element><xs:element name="mainCategory" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="subCategory" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="50" /></xs:restriction></xs:simpleType></xs:element><xs:element name="fullSizeAd" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="256" /></xs:restriction></xs:simpleType></xs:element><xs:element name="thumbSizeAd" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="256" /></xs:restriction></xs:simpleType></xs:element><xs:element name="churchWebSiteURL" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="128" /></xs:restriction></xs:simpleType></xs:element><xs:element name="businessLogoFileName" minOccurs="0"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="256" /></xs:restriction></xs:simpleType></xs:element><xs:element name="submittedDate" type="xs:dateTime" minOccurs="0" /><xs:element name="MyWSApprovalDate" type="xs:dateTime" minOccurs="0" /><xs:element name="adSubType" type="xs:string" minOccurs="0" /><xs:element name="otherDirectoryID" type="xs:int" minOccurs="0" /><xs:element name="categoryRecId" type="xs:int" minOccurs="0" /></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><DocumentElement xmlns=""><view_DSMyWSActiveAdSearchWebService diffgr:id="view_DSMyWSActiveAdSearchWebService1" msdata:rowOrder="0"><churchID>TEST</churchID><directoryID>23</directoryID><adID>1963</adID><adType>8</adType><salutation /><firstName>July16</firstName><lastName>Testing</lastName><company>July16 Test Company</company><address1 /><address2 /><city /><state>CA</state><zip /><phone>(916) 555-1212</phone><email>July16@example.com</email><web /><companyDescription /><mainCategory>Animals</mainCategory><subCategory>Breeders</subCategory><fullSizeAd>myws_12554_21273_copy.jpg</fullSizeAd><thumbSizeAd /><churchWebSiteURL>www.test.com</churchWebSiteURL><businessLogoFileName /><submittedDate>2010-08-27T06:44:40.827-07:00</submittedDate><MyWSApprovalDate>1900-01-01T00:00:00-07:00</MyWSApprovalDate><adSubType /><otherDirectoryID>0</otherDirectoryID><categoryRecId>564</categoryRecId></view_DSMyWSActiveAdSearchWebService><view_DSMyWSActiveAdSearchWebService diffgr:id="view_DSMyWSActiveAdSearchWebService2" msdata:rowOrder="1"><churchID>TEST</churchID><directoryID>23</directoryID><adID>1939</adID><adType>8</adType><salutation /><firstName>July16</firstName><lastName>Testing</lastName><company>July16 Test Company</company><address1 /><address2 /><city /><state>CA</state><zip /><phone>(916) 555-1212</phone><email>July16@example.com</email><web /><companyDescription /><mainCategory>Animals</mainCategory><subCategory>Breeders</subCategory><fullSizeAd>myws_12554_21273_copy.jpg</fullSizeAd><thumbSizeAd /><churchWebSiteURL>www.test.com</churchWebSiteURL><businessLogoFileName /><submittedDate>2010-08-20T19:07:15.413-07:00</submittedDate><MyWSApprovalDate>1900-01-01T00:00:00-07:00</MyWSApprovalDate><adSubType /><otherDirectoryID>0</otherDirectoryID><categoryRecId>564</categoryRecId></view_DSMyWSActiveAdSearchWebService></DocumentElement></diffgr:diffgram></getSearchResultsResult></getSearchResultsResponse></soap:Body></soap:Envelope>

 

12:00:28.240|EXCEPTION_THROWN|[118]|System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://www.w3.org/2001/XMLSchema=schema

dkadordkador

You'd have to post your WSDL for me to be sure, but the fact that there's an <xs:schema> element in your SOAP response is pretty strange.  My best guess is your WSDL uses at least one unsupported feature for WSDL2Apex.  Unfortunately the current implementation does not always error out when generating Apex from an invalid WSDL.

opiedogopiedog

I don't see a way to attach a document so I'll paste it.

NOTE: My client's web service isn't adequately secure so I got rid of any references to the client's site.

Also: One error I did get from WSDL2Apex was about multiple bindings. In my first attempt I stripped out the MyWSWebServiceSoap12 binding since I read somewhere that it's not supported.

Thanks for your help!!!

 

Here's the WSDL (including both bindings, but with some elements removed to get under the 20,000 character message limit):

<?xml version="1.0" encoding="utf-8"?>

<wsdl:definitions 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="MyWSWS" 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="MyWSWS" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:types>

    <s:schema elementFormDefault="qualified" targetNamespace="MyWSWS">

      <s:element name="getCategories">

        <s:complexType>

          <s:sequence>

            <s:element minOccurs="1" maxOccurs="1" name="catType" type="s:int" />

            <s:element minOccurs="1" maxOccurs="1" name="parentID" type="s:int" />

          </s:sequence>

        </s:complexType>

      </s:element>

      <s:element name="getCategoriesResponse">

        <s:complexType>

          <s:sequence>

            <s:element minOccurs="0" maxOccurs="1" name="getCategoriesResult">

              <s:complexType>

                <s:sequence>

                  <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />

                  <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />

                </s:sequence>

              </s:complexType>

            </s:element>

          </s:sequence>

        </s:complexType>

      </s:element>

    </s:schema>

  </wsdl:types>

  <wsdl:message name="getCategoriesSoapIn">

    <wsdl:part name="parameters" element="tns:getCategories" />

  </wsdl:message>

  <wsdl:message name="getCategoriesSoapOut">

    <wsdl:part name="parameters" element="tns:getCategoriesResponse" />

  </wsdl:message>

  <wsdl:portType name="MyWSWebServiceSoap">

    <wsdl:operation name="getCategories">

      <wsdl:input message="tns:getCategoriesSoapIn" />

      <wsdl:output message="tns:getCategoriesSoapOut" />

    </wsdl:operation>

  </wsdl:portType>

  <wsdl:binding name="MyWSWebServiceSoap" type="tns:MyWSWebServiceSoap">

    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:operation name="getCategories">

      <soap:operation soapAction="MyWSWS/getCategories" style="document" />

      <wsdl:input>

        <soap:body use="literal" />

      </wsdl:input>

      <wsdl:output>

        <soap:body use="literal" />

      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:binding name="MyWSWebServiceSoap12" type="tns:MyWSWebServiceSoap">

    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:operation name="getCategories">

      <soap12:operation soapAction="MyWSWS/getCategories" style="document" />

      <wsdl:input>

        <soap12:body use="literal" />

      </wsdl:input>

      <wsdl:output>

        <soap12:body use="literal" />

      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:service name="MyWSWebService">

    <wsdl:port name="MyWSWebServiceSoap" binding="tns:MyWSWebServiceSoap">

      <soap:address location="removed/MyWSWebService.asmx" />

    </wsdl:port>

    <wsdl:port name="MyWSWebServiceSoap12" binding="tns:MyWSWebServiceSoap12">

      <soap12:address location="removed/MyWSWebService.asmx" />

    </wsdl:port>

  </wsdl:service>

</wsdl:definitions>

 

dkadordkador

You should be able to attach a file.  I'll need the full WSDL to do any real debugging.  You can edit out the client info, of course.  Please attach the exact WSDL you used in the WSDL2Apex process.

opiedogopiedog

At the risk of exposing my lack of a clue, I gotta admit that I don't see any way to attach files. What's the secret?

dkadordkador

That's weird.  You don't see the "Attachments" section right under the box where you type your reply?

 

If not, e-mail it to me at dkador AT salesforce DOT com.

opiedogopiedog

Nope - no attachments section. I'll email right now.

opiedogopiedog

Please confirm whether or not you received the email with the WSDL attached. Thanks!

dkadordkador

 

      <s:element name="getSearchResultsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="getSearchResultsResult">
              <s:complexType>
                <s:sequence>
                  <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
                  <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

 Here's the snippet for your result element from the WSDL.  Notice the <s:any> elements.  We don't support that schema type.  For a full list of what we support, see http://wiki.developerforce.com/index.php/Apex_Web_Services_and_Callouts#WSDL2Apex (look for the section called "Supported WSDL Features").

 

 

This was selected as the best answer
opiedogopiedog

I'll dig into this and see if it resolves the issue. Thank you so much for your help!