简体   繁体   English

PHP的肥皂:如何使其生成

[英]php soap: how to get it to generate <soap:Envelope instead of <SOAP-ENV:Envelope?

I'm new at this, and have been poring through forums trying to figure out how to use PHP's soap. 我是新来的,并且一直在论坛中浏览,试图弄清楚如何使用PHP的肥皂。

I'm going to pull my hair out soon! 我马上就要拔头发了!

spend a gazillion years trying to figure out how to generate this header. 花了数百万年的时间试图弄清楚如何生成此标头。

<AutenticationToken>
      <Username>admin</Username>
      <Password>123456</Password>
   </AutenticationToken>

ended up using this: 最终使用了这个:

$sh_param = "<AutenticationToken><Username>admin</Username><Password>123456</Password></AutenticationToken>";
$auth = new SoapVar($sh_param, XSD_ANYXML, null, null, null);
$headers = new SoapHeader($wdsl, 'AuthenticationToken', $auth);

it keeps generating the 'ns' like this -> when i use this method. 当我使用这种方法时,它会不断生成这样的'ns'->。

<ns2:AuthenticationToken>
  <item>
   <key>Username</key>
   <value>admin</value>
  </item>
  <item>
   <key>Password</key>
   <value>123456</value>
  </item>
</ns2:AuthenticationToken>


$sh_param = array( 
                    'Username'    =>    'admin', 
                    'Password'    =>    '123456'); 
 $headers = new SoapHeader($wsdl, 'AuthenticationToken', $sh_param); 

now i need to get it to change from <soap:Envelope to <SOAP-ENV:Envelope . 现在,我需要将其从<soap:Envelope更改为<SOAP-ENV:Envelope Help! 救命!

class SOAPStruct SOAPStruct类

{ {

function __construct($user, $pass) 
{
    $this->Username = $user;
    $this->Password = $pass;
}

} }

//set username and password
$auth = new SOAPStruct("admin","123456");

//soap header object
$header = new SoapHeader("http://gateway.asiagategroup.com/","AutenticationToken",$auth,false); 
$client->__setSoapHeaders($header);

Hope this will resolve your problem 希望这能解决您的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM