SharePoint CopyIntoItems目标C中的SOAP消息 [英] SharePoint CopyIntoItems SOAP message in Objective C

查看:122
本文介绍了SharePoint CopyIntoItems目标C中的SOAP消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过我正在编写的Mac应用程序以编程方式将文件上传到SharePoint。我可以使用GetListItems webservice来检索文件列表,并且所有身份验证等都能正常工作。我自己形成SOAP消息如下:

I'm trying to upload a file to SharePoint programmatically via a Mac Application that I am currently writing. I can use the GetListItems webservice to retrieve a list of files, and all authentication etc works correctly. I form the SOAP message myself as follows:

起初我以为我的Objective C端写得不正确,但我一直在使用Firefox的HTTP请求扩展,'海报',仍然无法让它工作。

At first I thought I just had the Objective C side written incorrectly, but I've been using the HTTP request extension for Firefox, 'Poster', and still can't get it to work.

我构建的海报中的肥皂信息是:

The soap message in Poster that I construct is:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     
xmlns:xsd="http://www.w3.org/2001/XMLSchema"     
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CopyIntoItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <SourceUrl>http://null</SourceUrl>
      <DestinationUrls>
        <string>myurl.com/Shared Documents/Documents/TestingFile.txt</string>
      </DestinationUrls>
      <Stream>VGVzdGluZyB0ZXN0aW5n</Stream>
    </CopyIntoItems>
  </soap:Body>
</soap:Envelope>

流(目前)只是一些数据,看我是否可以让它工作。我读到将SourceUrl设置为 http:// null ,在某些情况下可以提供帮助。我还读到DestinationURL需要是完整路径。这里的问题是:

The stream (at the moment) is just some data, to see if I can get it to work. I read that setting the SourceUrl as http://null, can help in some instances. I also read that the DestinationURL needs to be the full path. The problem here is:

1)如果我把URL放在没有https://的情况下,那么我会收到以下回复:

1) If I put the URL without https:// then I get a response of:

<?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><CopyIntoItemsResponse 
xmlns="http://schemas.microsoft.com/sharepoint/soap/">    
<CopyIntoItemsResult>0</CopyIntoItemsResult><Results><CopyResult ErrorCode="Success" 
DestinationUrl="myurl.com/Shared Documents/Documents/TestingFile.txt" /></Results>
</CopyIntoItemsResponse></soap:Body></soap:Envelope>

2)如果我填写完整路径,例如

2) If I put the full path, e.g.

https://myurl.com/Shared Documents/Documents/TestingFile.txt

然后结果告诉我和以前一样,除了这个位:

then the result tells me the same as before, except for this bit:

<CopyResult ErrorCode="Unknown" ErrorMessage="Object reference not set to an instance of an     
object."     
DestinationUrl="https://dbp.btfinancialgroup.com/Shared%20Documents/Papers/TestingFile.txt" 
/>

3)如果我把完整路径放在引号中,例如

3) If I put the full path, in quotes, e.g.

https://myurl.com/Shared Documents / Documents / TestingFile.txt

"https://myurl.com/Shared Documents/Documents/TestingFile.txt"

然后结果告诉我和第一个相同,例如这是成功的,但有
a目标ARL:

then the results tell me the same as the first, e.g. that it was successful, but with a destinationURL of this:

DestinationUrl="&quot;https://dbp.btfinancialgroup.com/Shared 
Documents/Papers/TestingFile.txt&quot;"

在所有这些情况下,请求结束时目标中不存在该文件。

In ALL of these scenarios, the file does not exist in the destination at the end of the request.

我真的陷入困境,因为大多数在线建议都是为了解决C#问题,这些问题使用.net协议连接到SharePoint。

I'm really stuck, as most online suggestions are for remedying C# problems, which use the .net protocols for connecting to SharePoint.

有什么建议吗?

谢谢

推荐答案

协助可能遇到此问题的其他人。

To assist in anyone else who may come across this problem.

事实证明,我的代码根本不是问题,我建立了一个C#项目来尝试使用它为SharePoint提供的更好的连接,以及还与微软支持人员确认我的代码应该有效。

It turned out not to be an issue with my code at all, which I established by making a C# project to try and use the better connectivity it provides to SharePoint, and also spoke to someone in Microsoft Support who confirmed my code should work.

最后,服务器上的映射是不正确的,这意味着Web服务从未正确链接到网址。这导致对象引用未设置为对象的实例错误。

In the end, it was incorrect mappings on the server, which meant the web service never linked correctly to the URLs. This caused the "Object reference not set to an instance of an object" error.

对于收到此错误消息的任何其他人,它可能不仅仅是因为您传递给Web服务的值 - 还要检查服务器上设置的映射。显然,ULS日志可以帮助解决这个问题,微软支持人员提到了缩小造成这种情况的原因。

To anyone else receiving this error message, it may not lie just in a problem with the values you are passing to the web service - also check the mappings set up on the server. Apparently the ULS logs may help with this, the Microsoft support guy mentioned, in terms of narrowing down what's causing it.

这篇关于SharePoint CopyIntoItems目标C中的SOAP消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆