dsfdsfdsfdsf1223 2012-04-04 20:49
浏览 48
已采纳

如何调用.NET Web服务调用没有“无法反序列化请求”错误的.NET Web服务?

I am trying to make a web service call from PHP to a SOAP web service with a sample request which looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.somedomain.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:SearchMarketplaceSku>
         <ws:Request>
             <ws:Security>
               <ws:PartnerKey>[suppressed]</ws:PartnerKey>
               <ws:Password>[suppressed]</ws:Password>
            </ws:Security>
            <ws:AvailableOnDate>2012-04-03T00:00:00</ws:AvailableOnDate>
            <ws:IncludeStateDetails>true</ws:IncludeStateDetails>
            <ws:State>CA</ws:State>
         </ws:Request>
      </ws:SearchMarketplaceSku>
   </soapenv:Body>
</soapenv:Envelope>

The PHP code being used is:

$soapClient = new SoapClient($wsdlUrl);   
$ap_param = array('PartnerKey'    =>    $PartnerKey, 'Password'    =>    $metapackPassword, 'AvailableOnDate' => '2012-04-03T00:00:00','IncludeStateDetails'=>true, 'State'=>'CA');
$info = $soapClient->__call("SearchMarketplaceSku", $ap_param);

The web service call results in an "Request was not specified properly; server unable to deserialize request" error? What is the problem? Does the $ap_param array need to include all the nested nodes coressponding with the XML? Is there an easier way to make this call using "WSDL" mode?

Thanks for your help

  • 写回答

1条回答 默认 最新

  • doucuan5365 2012-04-04 20:52
    关注

    PartnerKey and Password has to be in an Array under the key Security:

    $ap_param = array(
    'Security' => array(
        'PartnerKey'    =>    $PartnerKey,
        'Password'    =>    $metapackPassword
    ),
    'AvailableOnDate' => '2012-04-03T00:00:00',
    'IncludeStateDetails'=>true, 'State'=>'CA'
    );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站