"The specified type was not recognized" exception when trying to invoke a webservice call

Posted by fretje on Stack Overflow See other posts from Stack Overflow or by fretje
Published on 2010-06-08T12:40:53Z Indexed on 2010/06/08 12:42 UTC
Read the original article Hit count: 1471

I'm trying to call a third party webservice using WSE 3.0 as a client in Visual Studio 2005.

The call works fine and I can see that I get a good response (I have tracing enabled), but apparently the xml parser chokes over it. I always get an InvalidOperationException:

There is en error in the XML document.

with an InnerException:

The specified type was not recognized: name='Map', namespace='http://xml.apache.org/xml-soap', at <bevoegdheid xmlns=''>.

This is the relevant part of the response:

 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="https://acceptatie.cartalk.nl/Soap/Apk" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
      <SOAP-ENV:opvragenKeurmeesterGegevensResponse>
        <opvragenKeurmeesterGegevensReturn xsi:type="ns2:Backend_Apk_Result_OpvragenKeurmeesterGegevens">
          <naam xsi:type="xsd:string">A name</naam>
          ...
          <bevoegdheid SOAP-ENC:arrayType="ns1:Map[2]" xsi:type="SOAP-ENC:Array">
            <item xsi:type="ns1:Map">
              <item>
                <key xsi:type="xsd:string">soortBevoegdheid</key>
                <value xsi:type="xsd:string">AL</value>
              </item>
          ...
            </item>
            <item>
          ...
            </item>
          </bevoegdheid>
          <meldingSoort xsi:nil="true" />
          <meldingNummer xsi:nil="true" />
          <melding xsi:nil="true" />
        </opvragenKeurmeesterGegevensReturn>
      </SOAP-ENV:opvragenKeurmeesterGegevensResponse>
    </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

And this is how that "bevoegdheid" is defined in the wsdl:

  <xsd:element name="bevoegdheid" type="soap-enc:Array" /> 

There is no mention of a "Map" type anywhere in the wsdl.

I have been googling around for this, but the only kind of answer I've found is something along the lines of

The service uses rpc/encoded format which is harder to get interoperability with. If you can change the server to document/literal it is better.

But as this is a third party service (which is already used by other clients), this is no option for us.

Any other suggestions? How can I get the xml parser to recognize that "Map" type?

© Stack Overflow or respective owner

Related posts about xml-serialization

Related posts about wsdl