English 中文(简体)
我如何通过php Zend_Soap_Client采用肥皂方法?
原标题:How do I pass parameters to a soap method via php Zend_Soap_Client?

我正试图利用冻结的1.1.7号网络服务来提供网络服务。

文件指出,我需要用以下格式发出呼吁:

RequestCustomReport(CustomReportDef, SecurityCredential)

结构如下:

<securityCredentials> 
  <Key>string</Key> 
  <UserName>string</UserN
  <Password>string</Passw
</securityCredentials> 

<reportDefinition> 
    <CustomTemplateId>int</CustomTemplateId> 
    <StartDate>dateTime</StartDate> 
    <EndDate>dateTime</EndDate> 
    <PeriodId>int</PeriodId> 
    <SiteId>int</SiteId> 
    <ReportGUID>string</ReportGUID> 
    <ReportData>base64Binary</ReportData> 
    <ReportDataType>xml or csv or tsv or txt</ReportDataType> 
    <CompressReportData>boolean</CompressReportData> 
    <ReportStatus>Pending or Ready or Error or Deleted</ReportStatus> 
    <ErrorMessage>string</ErrorMessage> 
  </reportDefinition>

我的自愿守则是:

$client = new Zend_Soap_Client($ws_url);

$reqFilter = array();
$reqFilter[ CustomTemplateId ] = 33117; //33117 = report id
//$reqFilter[ StartDate ] = 
//$reqFilter[  ] =  ;
$reqFilter[ PeriodId ] = 4; //4 = last 7 days
$reqFilter[ SiteId ] =3672;
$reqFilter[ ReportDataType ] = xml ;
$reqFilter[ CompressReportData ] =0;

$reptXml=new XMLWriter();
$reptXml->openMemory();
$reptXml->startDocument( 1.0 , UTF-8 );
$reptXml->startElement("reportDefinition");
  $reptXml->startElement("CustomTemplateId");
    $reptXml->text($reqFilter[ CustomTemplateId ]);
  $reptXml->endElement();//CustomTemplateId

  $reptXml->startElement("PeriodId");
    $reptXml->text($reqFilter[ PeriodId ]);
  $reptXml->endElement();//PeriodId

  $reptXml->startElement("SiteId");
    $reptXml->text((int)$reqFilter[ SiteId ]);
  $reptXml->endElement();//SiteId

  $reptXml->startElement("ReportDataType");
    $reptXml->text($reqFilter[ ReportDataType ]);
  $reptXml->endElement();//ReportDataType

  $reptXml->startElement("CompressReportData");
    $reptXml->text(0);
  $reptXml->endElement();//  CompressReportData
$reptXml->endElement();//reportDefinition

/*
 * securityCredentials xml
 */
$secXml=new XMLWriter();
$secXml->openMemory();
$secXml->startDocument( 1.0 , UTF-8 );
$secXml->startElement("securityCredentials");
  $secXml->startElement("Key");
    $secXml->text( ---- );
  $secXml->endElement();
  $secXml->startElement("UserName");
    $secXml->text( --.-- );
  $secXml->endElement();  
  $secXml->startElement("Password");
    $secXml->text( ---- );
  $secXml->endElement();    
$secXml->endElement();

$result = $client->RequestCustomReport($reptXml,$secXml);

但是,我正在犯以下错误:

致命错误: Unvista SoapFault exception: [收益:数额] 报告的定义是一个必要的参数,但没有在C:wampwwwlibsend-1.11.10endSoapClient.php中提供:1121 痕迹: #0 C:wampwwwlibsend-1.11.10endSoapClient.php(1121): SoapClient->_soapCall(请求CustomRe...、Array、NULLL、NULL、Array) #1 [内部职能]: Zend_Soap_Client->__questCustomRe..., Array #2 C:wampwwwProfound_testwsdl.php(109): Zend_Soap_Client->RequestCustomReport(Object(XMLWriter), Object(XMLWriter) #3{main} 扔进 C:wampwwwlibsend-1.11.10endSoapClient.php on line 1121

似乎并不承认我已经通过报告定义参数,将其作为正确的名称。

谁能帮助?

最佳回答

我与SOAP有着同样的问题。 显然,<代码>Zend_Soap_Client的功能呼吁不接受变量作为功能参数,但含有参数功能的关键和价值阵列。

因此:

$result = $client->RequestCustomReport($reptXml,$secXml);

实际应当是:

$result = $client->RequestCustomReport(array( xml  => $reptXml,  key2  => $secXml));

我也不清楚你是否需要建立XML档案。 可能只通过<代码>reqFilter。 页: 1 Zend_Soap_Client 将为您转换。

$client->setSoapVersion(SOAP_1_1);
$result = $client->RequestCustomReport(array( startDate  => $startDate,  endDate  => $endDate));

(说明它包含职能呼吁中的阵列)

也可检查SOAP的使用情况。

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签