帮助SOAP [英] Help with SOAP

查看:94
本文介绍了帮助SOAP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



希望在这里得到一些帮助我遇到了一个问题。

我正在尝试使用Python中的Bing Ads Web服务(SUDS),也只是使用curl。



我能够读入WSDL文件并生成XML / SOAP输出。 

我觉得有一些小错误,只是不太确定或不熟悉什么它可能是。 

尝试调用以下操作:  DownloadCampaignsByAccountIds



我试图尽可能多地模仿文档:http://msdn.microsoft.com/en-US/library/jj885755.aspx#request_soap

甚至从上面的链接复制和粘贴XML并在之后添加我自己的值以确保。$


我在SUDS中生成了XML,但我一直收到400错误:HTTP失败 - 400 - 错误请求





如果我使用curl并使用示例提供作为模板我得到一个稍微不同的错误:

Hi there,


Hoping to get some help here with an issue I'm stuck on.
I'm trying to use the Bing Ads Web service in Python (SUDS) and also just using curl.

I'm able to read in the WSDL file and generate the XML/SOAP output. 
I feel like there is something minor wrong, just not too sure or familiar with what it might be. 
Trying to call the following action:  DownloadCampaignsByAccountIds

I tried to mimic the documentation as much as possible: http://msdn.microsoft.com/en-US/library/jj885755.aspx#request_soap
Even copying and pasting the XML from the link above and adding my own values in after to make sure.

I have the XML generated in SUDS but I keep getting a 400 Error: HTTP failed - 400 - Bad Request


If I use curl and use the example provide as a template I get a slightly different error:

------------------------- --------------------------------

---------------------------------------------------------

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

< s:Body>< s:Fault>

< faultcode xmlns:a =" http://schemas.microsoft.com/ws/2005/05/addressing/none"> a:ActionNotSupported< / faultcode>

< faultstring xml :lang =" en-US">由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理带有Action''的消息。 

这可能是因为合同不匹配(发件人和收件人之间的不匹配行为)或发件人与收件人之间的b
绑定/安全性不匹配。  

检查发件人和收件人是否具有相同的合同和相同的绑定 

(包括安全要求,例如邮件,运输,无)。

< / faultstring>< / s:故障>< / s:正文>< / s:信封> 

----------- ----------------------------------------------



$
这是我想要传递给服务的完整XML:



-------------------------------------------------- -------
$


<?xml version =" 1.0" encoding =" UTF-8"?>

< SOAP-ENV:Envelope xmlns:ns0 =" http://schemas.microsoft.com/2003/10/Serialization/Arrays"  

xmlns:ns1 =" http://schemas.xmlsoap.org/soap/envelope/" 

xmlns:ns2 =" https://bingads.microsoft.com/CampaignManagement/v9" 

xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance" 

xmlns:SOAP-ENV =" http://schemas.xmlsoap.org/soap/envelope/">

   < SOAP-ENV:标题>

  &NBSP; &NBSP; < Action mustUnderstand =" 1"> DownloadCampaignsByAccountIds< / Action>

  &NBSP; &NBSP; < ApplicationToken i:nil =" false">< / ApplicationToken>

  &NBSP; &NBSP; < AuthenticationToken i:nil =" false">< / AuthenticationToken>

  &NBSP; &NBSP; < CustomerAccountId i:nil =" false"> xxxx< / CustomerAccountId>

  &NBSP; &NBSP; < CustomerId i:nil =" false"> xxxxx< / CustomerId>

  &NBSP; &NBSP; < DeveloperToken i:nil =" false"> xxxxxxxx< / DeveloperToken>

  &NBSP; &NBSP; <密码i:nil =" false"> xxxx< /密码>

  &NBSP; &NBSP; < UserName i:nil =" false"> xxxxxxx< / UserName>

   < / SOAP-ENV:标题>

   < ns1:正文>



$
  &NBSP; &NBSP; < ns2:DownloadCampaignsByAccountIdsRequest>

  &NBSP; &NBSP; &NBSP;  < ns2:AccountIds>

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; < ns0:long> xxxxxxx< / ns0:long>

  &NBSP; &NBSP; &NBSP;  < / ns2:AccountIds>

  &NBSP; &NBSP; &NBSP;  < ns2:DataScope> EntityData< / ns2:DataScope>

  &NBSP; &NBSP; &NBSP;  < ns2:DataScope> EntityPerformanceData< / ns2:DataScope>

  &NBSP; &NBSP; &NBSP;  < ns2:DataScope> QualityScoreData< / ns2:DataScope>

  &NBSP; &NBSP; &NBSP;  < ns2:DownloadFileType> Csv< / ns2:DownloadFileType>

  &NBSP; &NBSP; &NBSP;  < ns2:实体>广告< / ns2:实体>

  &NBSP; &NBSP; &NBSP;  < ns2:实体> SiteLinksAdExtensions< / ns2:实体>

  &NBSP; &NBSP; &NBSP;  < ns2:实体>关键字< / ns2:实体>

  &NBSP; &NBSP; &NBSP;  < ns2:实体>广告组< / ns2:实体>

  &NBSP; &NBSP; &NBSP;  < ns2:实体>广告系列< / ns2:实体>

  &NBSP; &NBSP; &NBSP;  < ns2:FormatVersion> 2.0< / ns2:FormatVersion>

  &NBSP; &NBSP; &NBSP;  < ns2:LastSyncTimeInUTC>< / ns2:LastSyncTimeInUTC>

  &NBSP; &NBSP; &NBSP;  < ns2:LocationTargetVersion>< / ns2:LocationTargetVersion>

  &NBSP; &NBSP; &NBSP;  < ns2:PerformanceStatsDateRange>

< CustomDateRangeEnd i:nil =" false">

 < Day>< / day>

 < Month>< / Month>

 < Year>< / Year>

< / CustomDateRangeEnd>

< CustomDateRangeStart i:nil =" false">

 < Day>< / Day> ;

 < Month>< / Month>

 < Year>< / Year>

< / CustomDateRangeStart>

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; < ns2:PredefinedTime>昨天< / ns2:PredefinedTime>

  &NBSP; &NBSP; &NBSP;  < / ns2:PerformanceStatsDateRange>

  &NBSP; &NBSP; < / ns2:DownloadCampaignsByAccountIdsRequest>



$
   < / ns1:Body>

< / SOAP-ENV:Envelope>



-------- -------------------------------------------------



这里有什么想法或想法吗?我觉得我很亲近...

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body><s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode>
<faultstring xml:lang="en-US">The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. 
This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a 
binding/security mismatch between the sender and the receiver.  
Check that sender and receiver have the same contract and the same binding 
(including security requirements, e.g. Message, Transport, None).
</faultstring></s:Fault></s:Body></s:Envelope> 
---------------------------------------------------------


Here is my full XML I am trying to pass to the service:

---------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.microsoft.com/2003/10/Serialization/Arrays" 
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns2="https://bingads.microsoft.com/CampaignManagement/v9" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
      <Action mustUnderstand="1">DownloadCampaignsByAccountIds</Action>
      <ApplicationToken i:nil="false"></ApplicationToken>
      <AuthenticationToken i:nil="false"></AuthenticationToken>
      <CustomerAccountId i:nil="false">xxxx</CustomerAccountId>
      <CustomerId i:nil="false">xxxxx</CustomerId>
      <DeveloperToken i:nil="false">xxxxxxxx</DeveloperToken>
      <Password i:nil="false">xxxx</Password>
      <UserName i:nil="false">xxxxxxx</UserName>
   </SOAP-ENV:Header>
   <ns1:Body>


      <ns2:DownloadCampaignsByAccountIdsRequest>
         <ns2:AccountIds>
            <ns0:long>xxxxxxx</ns0:long>
         </ns2:AccountIds>
         <ns2:DataScope>EntityData</ns2:DataScope>
         <ns2:DataScope>EntityPerformanceData</ns2:DataScope>
         <ns2:DataScope>QualityScoreData</ns2:DataScope>
         <ns2:DownloadFileType>Csv</ns2:DownloadFileType>
         <ns2:Entities>Ads</ns2:Entities>
         <ns2:Entities>SiteLinksAdExtensions</ns2:Entities>
         <ns2:Entities>Keywords</ns2:Entities>
         <ns2:Entities>AdGroups</ns2:Entities>
         <ns2:Entities>Campaigns</ns2:Entities>
         <ns2:FormatVersion>2.0</ns2:FormatVersion>
         <ns2:LastSyncTimeInUTC></ns2:LastSyncTimeInUTC>
         <ns2:LocationTargetVersion></ns2:LocationTargetVersion>
         <ns2:PerformanceStatsDateRange>
<CustomDateRangeEnd i:nil="false">
 <Day></Day>
 <Month></Month>
 <Year></Year>
</CustomDateRangeEnd>
<CustomDateRangeStart i:nil="false">
 <Day></Day>
 <Month></Month>
 <Year></Year>
</CustomDateRangeStart>
            <ns2:PredefinedTime>Yesterday</ns2:PredefinedTime>
         </ns2:PerformanceStatsDateRange>
      </ns2:DownloadCampaignsByAccountIdsRequest>


   </ns1:Body>
</SOAP-ENV:Envelope>

---------------------------------------------------------

Any thoughts or ideas here? I feel like I am close...




推荐答案

Hello。

Hello.

我对您的SOAP请求进行了以下更改以使其正常工作。最终的工作请求粘贴在下面。

I made the following changes to your SOAP request to get it working. The final working request is pasted below.

1。将i:nil更改为xsi:nil

1. Change i:nil to xsi:nil

2。对标题元素使用'ns2'或等效项,例如ns2:用户名。

2. Use 'ns2' or equivalent for the header elements e.g. ns2:UserName.

3。将DataScope指定为空格分隔列表

3. Specifiy DataScope as a space delimited list

4。将实体指定为以空格分隔的列表

4. Specify Entities as a space delimited list

5。将上次同步时间设置为null,例如< ns2:LastSyncTimeInUTC xsi:nil =" true" />

5. Set last sync time to null, e.g. <ns2:LastSyncTimeInUTC xsi:nil="true" />

6。删除自定义日期范围,因为您要求的是昨天的预定义时间。

6. Remove custom date range, since you are requesting instead a Predefined time of Yesterday.

顺便提一下,请将LocationTargetVersion设置为Latest,并使用FormatVersion 3.0,这是最新版本。

By the way, please also set LocationTargetVersion to Latest and use FormatVersion 3.0 which is the latest version.

<?xml version =" 1.0" encoding =" utf-8"?>

< SOAP-ENV:Envelope xmlns:ns0 =" http://schemas.microsoft.com/2003/10/Serialization/Arrays " xmlns:ns1 =" http://schemas.xmlsoap.org/soap/envelope/ "
xmlns:ns2 =" https://bingads.microsoft.com/CampaignManagement/v9 " xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance "
xmlns:SOAP-ENV =" http://schemas.xmlsoap.org/soap/envelope/">

  < SOAP-ENV:标题>

    < ns2:Action mustUnderstand =" 1"> DownloadCampaignsByAccountIds< / ns2:Action>

    < ns2:ApplicationToken xsi:nil =" false">< / ns2:ApplicationToken>

    < ns2:AuthenticationToken xsi:nil =" false">< / ns2:AuthenticationToken>

    < ns2:CustomerAccountId xsi:nil =" false"> ***< / ns2:CustomerAccountId>

    < ns2:CustomerId xsi:nil =" false"> ***< / ns2:CustomerId>

    < ns2:DeveloperToken xsi:nil =" false"> ***< / ns2:DeveloperToken>

    < ns2:密码xsi:nil =" false"> ***< / ns2:密码>

    < ns2:UserName xsi:nil =" false"> ***< / ns2:UserName>

  < / SOAP-ENV:标题>

  < ns1:正文>

    < ns2:DownloadCampaignsByAccountIdsRequest>
$
      < ns2:AccountIds>

        < ns0:long> ***< / ns0:long>

      < / ns2:AccountIds>

      < ns2:DataScope> EntityData EntityPerformanceData QualityScoreData< / ns2:DataScope>

      < ns2:DownloadFileType> Csv< / ns2:DownloadFileType>

      < ns2:实体>广告SiteLinksAdExtensions关键字广告组广告系列< / ns2:实体>

      < ns2:FormatVersion> 3.0< / ns2:FormatVersion>

      < ns2:LastSyncTimeInUTC xsi:nil =" true" />
$
      < ns2:LocationTargetVersion> Latest< / ns2:LocationTargetVersion>

      < ns2:PerformanceStatsDateRange>

        < ns2:PredefinedTime>昨天< / ns2:PredefinedTime>

      < / ns2:PerformanceStatsDateRange>

    < / ns2:DownloadCampaignsByAccountIdsRequest>

  < / ns1:Body>

< / SOAP-ENV:Envelope>

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="https://bingads.microsoft.com/CampaignManagement/v9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
    <ns2:Action mustUnderstand="1">DownloadCampaignsByAccountIds</ns2:Action>
    <ns2:ApplicationToken xsi:nil="false"></ns2:ApplicationToken>
    <ns2:AuthenticationToken xsi:nil="false"></ns2:AuthenticationToken>
    <ns2:CustomerAccountId xsi:nil="false">***</ns2:CustomerAccountId>
    <ns2:CustomerId xsi:nil="false">***</ns2:CustomerId>
    <ns2:DeveloperToken xsi:nil="false">***</ns2:DeveloperToken>
    <ns2:Password xsi:nil="false">***</ns2:Password>
    <ns2:UserName xsi:nil="false">***</ns2:UserName>
  </SOAP-ENV:Header>
  <ns1:Body>
    <ns2:DownloadCampaignsByAccountIdsRequest>
      <ns2:AccountIds>
        <ns0:long>***</ns0:long>
      </ns2:AccountIds>
      <ns2:DataScope>EntityData EntityPerformanceData QualityScoreData</ns2:DataScope>
      <ns2:DownloadFileType>Csv</ns2:DownloadFileType>
      <ns2:Entities>Ads SiteLinksAdExtensions Keywords AdGroups Campaigns</ns2:Entities>
      <ns2:FormatVersion>3.0</ns2:FormatVersion>
      <ns2:LastSyncTimeInUTC xsi:nil="true" />
      <ns2:LocationTargetVersion>Latest</ns2:LocationTargetVersion>
      <ns2:PerformanceStatsDateRange>
        <ns2:PredefinedTime>Yesterday</ns2:PredefinedTime>
      </ns2:PerformanceStatsDateRange>
    </ns2:DownloadCampaignsByAccountIdsRequest>
  </ns1:Body>
</SOAP-ENV:Envelope>

我希望这会有所帮助!

Eric

I hope this helps!
Eric


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

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