您提供的XML构成良好或没有验证我们已发布的模式:在从Salesforce致电S3存储桶时

发布于 2025-01-19 18:33:23 字数 779 浏览 2 评论 0原文

各位,

在进行端到端集成方面,我完全是新手。我正在尝试将我的 salesforce 数据“放入”s3 存储桶,但收到:

您提供的 XML 格式不正确或未根据我们发布的架构进行验证

这就是我正在做的事情:

List<Task> tasks = new List<Task>([SELECT ID from TASK WHERE Id =:recordId LIMIT 1]);
    
    for(Task task:tasks)
    {
        try
        {
            //File Content
            String Body = JSON.serialize(task);
            
            HttpRequest req = new HttpRequest();
            req.setMethod('PUT');
            req.setEndpoint('callout:AWS_Credentials');
            req.setHeader('Content-Type', 'application/json;charset=UTF-8');
            req.setBody(Body);
            
            Http http = new Http();
            HTTPResponse res = http.send(req);

我在这里可能做错了什么?太失落了。

提前致谢!

Folks,

A total newbie here when it comes to making end-to-end integrations. I am trying to "put" my salesforce data to the s3 bucket but receiving:

The XML you provided was not well-formed or did not validate against our published schema

Here's what I am doing:

List<Task> tasks = new List<Task>([SELECT ID from TASK WHERE Id =:recordId LIMIT 1]);
    
    for(Task task:tasks)
    {
        try
        {
            //File Content
            String Body = JSON.serialize(task);
            
            HttpRequest req = new HttpRequest();
            req.setMethod('PUT');
            req.setEndpoint('callout:AWS_Credentials');
            req.setHeader('Content-Type', 'application/json;charset=UTF-8');
            req.setBody(Body);
            
            Http http = new Http();
            HTTPResponse res = http.send(req);

What might I be doing wrong here? Too lost to see..

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平定天下 2025-01-26 18:33:23

将内容类型设置为' application/xml '而不是'application/json; charset = utf-8'

req.setHeader('Content-Type', 'application/xml');

Set the content type as 'application/xml' instead of 'application/json;charset=UTF-8'

req.setHeader('Content-Type', 'application/xml');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文