BloggingAbout.NET
Thoughts of developers
Calling SharePoint Lists.asmx via BizTalk

Just some notes on connecting BizTalk to SharePoint’s /_vti_bin/lists.asmx">http://<site>/_vti_bin/lists.asmx webservice.  After using Add Generated Items –> Consume WCF Service to create the proxy and binding you might find that when calling the service a transport level error is returned.

The following illustrates a sample call to a list called Behaviour List for all items:

<MessageLogTraceRecord>

<Addressing xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">

<Action>http://schemas.microsoft.com/sharepoint/soap/GetListItems</Action>

<To>http://<list>/_vti_bin/lists.asmx</To>

</Addressing>

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

<s:Header>

<ActivityId CorrelationId="169ba7fc-dd92-4ba7-9659-b128b63f0e4d" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">2798162c-3223-4ff1-ab14-360c8fa538ab</ActivityId>

</s:Header>

<s:Body>

<soap1:GetListItems xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">

<soap1:listName>Behaviour List</soap1:listName>

</soap1:GetListItems>

</s:Body>

</s:Envelope>

</MessageLogTraceRecord>

With the generated binding, the following is returned indicating the client bindings are not correct in regards to the security settings:

<MessageLogTraceRecord>

<HttpResponse xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace">

<StatusCode>InternalServerError</StatusCode>

<StatusDescription>Internal Server Error</StatusDescription>

<WebHeaders>

<MicrosoftSharePointTeamServices>12.0.0.6318</MicrosoftSharePointTeamServices>

<Content-Length>740</Content-Length>

<Cache-Control>private</Cache-Control>

<Content-Type>text/xml; charset=utf-8</Content-Type>

<Date>Mon, 20 Sep 2010 20:57:03 GMT</Date>

<Server>Microsoft-IIS/6.0</Server>

<X-AspNet-Version>2.0.50727</X-AspNet-Version>

<X-Powered-By>ASP.NET</X-Powered-By>

</WebHeaders>

</HttpResponse>

<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">

<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"></s:Header>

<soap:Body>

<soap:Fault>

<faultcode xmlns="">soap:Server</faultcode>

<faultstring xmlns="">Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>

<detail xmlns="">

<errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - Either a required impersonation level was not provided, or the provided impersonation level is invalid.)</errorstring>

</detail>

</soap:Fault>

</soap:Body>

</soap:Envelope>

</MessageLogTraceRecord>

BizTalk logs the following error to the Application eventlog:

The adapter failed to transmit message going to send port "WcfSendPort_Lists_ListsSoap_Custom" with URL "http://<list>/_vti_bin/lists.asmx". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
The adapter failed to transmit message going to send port "WcfSendPort_Lists_ListsSoap_Custom" with URL "http://secure.gen-i.co.nzpublishing/_vti_bin/lists.asmx". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.InvalidOperationException: An action mapping was defined but BTS.Operation was not found in the message context.
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.LookupAction(IBaseMessageContext messageContext)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendRequestMessage(IBaseMessage bizTalkMessage, IRequestChannel channel)
   at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.SendMessage(IBaseMessage bizTalkMessage)".

The solution was to simply set the Impersonation correctly to allow the host instance:

wcf1

wcf2

wcf3


Posted Wed, Oct 13 2010 11:01 AM by chilberto
Filed under: , , ,

Comments

Steve wrote re: Calling SharePoint Lists.asmx via BizTalk
on Wed, Oct 13 2010 3:03 PM

When I consume the Lists.asmx service through the Add Generated Items - Consume WCF Service wizard I get the following error.  How did you generate your schemas/orchestration etc for this service?

Thanks

Error 1 Node "<Schema>" - Schema reference "" is not a valid reference or does not exist in the current project \Lists_schemas_microsoft_com_sharepoint_soap_1.xsd 1 1

chilberto wrote re: Calling SharePoint Lists.asmx via BizTalk
on Thu, Oct 14 2010 2:58 AM

I have not had time to look into the reason why; but to get around this, Open the Lists_schemas_microsoft_com_sharepoint_soap_1.xsd with the XML Editor.  Then remove the import element with a "" schema location.

Steve wrote re: Calling SharePoint Lists.asmx via BizTalk
on Thu, Oct 14 2010 7:03 AM

got it working..thanks

Paolo wrote re: Calling SharePoint Lists.asmx via BizTalk
on Mon, Jan 31 2011 9:42 PM

YOU ARE A GENIUS !!!

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

Please add 4 and 6 and type the answer here:
Copyright © 2003-2010 BloggingAbout.NET