English 中文(简体)
PHP中的Sap 要求
原标题:Constructing Soap Request in PHP
  • 时间:2011-05-12 23:51:59
  •  标签:
  • php
  • soap

New to soap, I ve used soapUI ( http://www.soapui.org) to test the service I need to access anddetermination that I need the soap request to look as this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:_5=mynamespace>
  <soapenv:Header/>
  <soapenv:Body>
    <_5:GetStaff>
      <_5:Request>
        <_5:SourceCredentials>
          <_5:SourceName>name</_5:SourceName>
          <_5:Password>pword</_5:Password>
          <_5:SiteIDs>
            <_5:int>num</_5:int>
          </_5:SiteIDs>
        </_5:SourceCredentials>
      </_5:Request>
    </_5:GetStaff>
  </soapenv:Body>
</soapenv:Envelope>

我的名词、名称、密码和南都属于谁。 我只是需要用购买力平价来提出这一要求。 这是我最新的尝试:

<html>
<body>

<?php
require_once( nusoap.php );

$wsdl = ...;
$client = new SoapClient($wsdl);

/*
echo("
Dumping client object:
");
var_dump($client);

echo("
Dumping client object functions:
");
var_dump($client->__getFunctions());
*/

try {
  $credentials = new SoapVar(array(
                                    SourceName =>name,
                                    Password =>pword,
                                    SiteIDs =>num
                                  ),
                             SOAP_ENC_OBJECT,
                             type1,
                             mynamespace
                         );
  $request = new SoapVar(array( SourceCredentials =>$credentials),
                         SOAP_ENC_OBJECT,
                         type2,
                         mynamespace
                        );
  $result = $client->GetStaff(new SoapParam($request, "Request"));
  echo $result;
}
catch (SoapFault $fault) {
  trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}

print "<pre>
";
print "Request :
".htmlspecialchars($client->__getLastRequest()) ."
";
print "Response:
".htmlspecialchars($client->__getLastResponse())."
";
print "</pre>";

?>

</body>
</html>

用我的话来说,1类是源码标签的适当类型,2类是请求标的适当的类型。

当我在浏览器上打开这一档案时,绝对没有任何迹象显示。 当评论的界线未形成时,我可以看到物体的倾销(尽管我不知道如何解释倾销),但物体功能是显示的NOT。

是否如<代码>。 SoapClient 本身是适当设置的吨数,还是用于 so的参数建筑中的错误?

* 扩大: I ve name this file “index.php,” and in a browser I m navigating to the summary in which this file is found (it is a sub-directory of my public_html.

缩略语

最佳回答

这最终是一个配置问题;I台服务器上的实验室配置未能实现。 此外,我没有在服务器上获得行政许可,因此难以确定这是原因,因此无法加以固定。

我不得不建立自己的机器,作为服务器,现在我能够成功建立SapClient。

如果其他人通过类似的东西,并且需要做同样的事情,我就在以下网址找到了一条很好的指导:

问题回答

指导你的工作 类似:

$client = new SoapClient($wsdl, array( trace  => 1,
     exceptions  => true,
     cache_wsdl  => WSDL_CACHE_NONE));

您需要微量选择,才能看到<代码>__getLastRequest(>的产出。





相关问题
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 ...

热门标签