Today we were experimenting with SharePoint 2010 CSOM (Client Side Object Model) and we noticed strange errors such as HTTP ERROR 417 were returned. When browsing to Lists.asmx and Sites.asmx we got the following error:
The top XML element 'string' from namespace 'http://schemas.microsoft.com/sharepoint/soap/' references distinct types System.String and Microsoft.SharePoint.SoapServer.SoapXml.SoapXmlElement. Use XML attributes to specify another XML name or namespace for the element or types.
One of the MSDN Forums’ answers stated that you could use direct WSDL link (http://url/_vti_bin/sites.asmx?wsdl) and that would work, which it does in the browser but not for CSOM. And besides, I don’t like these kind of errors on one of my environments while other environments work fine.
Turned out someone had disabled HttpGet, HttpPost and HttpPostLocalhost protocols in the web.config of the ISAPI folder (maps to _vti_bin).
Uncomment those lines and your Web Services should be fine again.
Setup
On of my current projects is a custom solution for Microsoft Dynamics NAV to communicate with SharePoint using a Web Service. In order to do this you need to install the SOAP Toolkit (on the server and any clients running the code) to build a SOAP Message in C/AL code.
C/AL
// Create SOAP message
CREATE(AutSoapHttpConnector);
CREATE(AutSoapSerializer);
CREATE(AutXMLDocument);
AutSoapHttpConnector.Property('EndPointURL', 'http://moss.litwareinc.com/_ws/customservice.asmx');
AutSoapHttpConnector.Property('Timeout', '9000');
AutSoapHttpConnector.Connect;
AutSoapHttpConnector.Property('SoapAction', 'http://vandest/webservices/HelloWorld');
AutSoapHttpConnector.BeginMessage;
AutSoapSerializer.Init(AutSoapHttpConnector.InputStream);
AutSoapSerializer.StartEnvelope('SOAP', 'NONE');
AutSoapSerializer.StartBody;
AutSoapSerializer.SoapDefaultNamespace('http://vandest/webservices');
AutSoapSerializer.StartElement('CreateHelloWorld');
...
Problem
Maximum retry on the connection exceeded. HRESULT=0x80004005: Unspecified error - Connector: Unspecified HTTP error. HRESULT=0x800A1518
Solution
Don't use the Fully Qualified Domain Name (FQDN) of the computer running the Web Service, instead use the NETBIOS Name:
AutSoapHttpConnector.Property('EndPointURL', 'http://moss/_ws/customservice.asmx');
http://support.microsoft.com/kb/892964