Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 321015 - Last Review: March 4, 2004 - Revision: 1.3
STS: Procedure to Programmatically Connect MSXML 4.0 to SharePoint Portal Server Is Not Successful
This article was previously published under Q321015
If you try to programmatically configure MSXML 4.0 to connect to SharePoint Portal Server, the procedure is unsuccessful.
This behavior occurs because SharePoint Portal Server (SPS) is not compatible with MSXML 4.0. Specifically, the
ServerXMLHTTP object cannot be used to connect to an SPS server.
To work around this issue, use "Msxml2.XMLHTTP.4.0" instead of "Msxml2.ServerXMLHTTP.4.0" in your code (see the "More Information" section of this article). Or, use MSXML 3.0 to connect to SPS.
This issue occurs because SPS is not fully HTTP 1.1-compliant. SPS inserts an extra CRLF character in chunked content encoding, in violation of the RFC. This extra CRLF character confuses Windows HTTP 5.0. The following Microsoft Visual Basic code illustrates this problem:
main
'Reference: Microsoft XML, v4.0
Private Sub Main()
Dim strRequest
Dim m_xh ' As msxml2.ServerXMLHTTP
Dim Server
Dim Name
Dim Password
'TODO: Change these three lines
Server = "MySPSServer"
Folder = "MyWorkspace"
URL = "http:/" & Server & "" & Folder
Name = "Domain\Account"
Password = "password"
strRequest = "<?xml version=""1.0""?>" & vbCrLf & "<a:searchrequest xmlns:a=""DAV:"">" & vbCrLf
strRequest = strRequest & "<a:sql>" & vbCrLf & "select ""DAV:href""" & vbCrLf
strRequest = strRequest & " From Scope(" & "'DEEP TRAVERSAL OF """ & URL & """')"
strRequest = strRequest & vbCrLf & " </a:sql>" & vbCrLf & "</a:searchrequest>"
Set m_xh = CreateObject("Msxml2.ServerXMLHTTP.4.0")
m_xh.Open "SEARCH", URL, False, Name, Password
m_xh.SetRequestHeader "content-Type","Text/xml"
m_xh.send strRequest
MsgBox m_xh.responseText
If Err.Number Then MsgBox ("Error: " & Hex(Err.Number) & ": " & Err.Description)
End Sub
APPLIES TO
- Microsoft SharePoint Team Services
- Microsoft SharePoint Portal Server 2001 Service Pack 1
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate