简体   繁体   English

PHP SOAP SoapClient参数

[英]PHP SOAP SoapClient parameters

I am brand new to SOAP with PHP (and SOAP in general). 我是刚接触PHP的SOAP(通常是SOAP)的。 I am having trouble with the SoapClient class. 我在SoapClient类上遇到麻烦。 It takes four parameters (request, location, action, version), but I really don't know what those should be as they pertain to the web service I'm trying to use. 它带有四个参数(请求,位置,操作,版本),但是我真的不知道这些参数应该是什么,因为它们与我要使用的Web服务有关。

See 看到

http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Sync and http://www.agemni.com/_anet/ADBAccess.asmx?op=getCMSTables http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Synchttp://www.agemni.com/_anet/ADBAccess.asmx?op=getCMSTables

Here is my best guess: 这是我最好的猜测:

$wsdl = 'http://www.agemni.com/_anet/ADBAccess.asmx?WSDL';

$action = 'http://webservice.agemni.com/getCMSTables';
$request = 'POST /_anet/ADBAccess.asmx HTTP/1.1
Host: www.agemni.com
Content-Type: text/xml; charset=utf-8
Content-Length: 10000
SOAPAction: "http://webservice.agemni.com/getCMSTables"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getCMSTables xmlns="http://webservice.agemni.com/getCMSTables" />
  </soap:Body>
</soap:Envelope>"
';
$location = 'http://www.agemni.com/_anet/ADBAccess.asmx';
$version ='1';


$client = new SoapClient($wsdl);
$response = $client->__doRequest($request, $location, $action, $version);

I'm not asking for anyone to do this for me, but if you could help clarify what $action, $request, and $location should be (pretty sure $version is just an int 1 or 2) I would be very grateful. 我并不是要有人为我做这件事,但是如果您能帮助阐明$ action,$ request和$ location应该是什么(非常确定$ version只是int 1或2),我将不胜感激。

Well, if you don't want to deal with the details of the request and you have the WSDL file, you don't need to set those parameters. 好吧,如果您不想处理请求的详细信息并且拥有WSDL文件,则无需设置这些参数。 Just instantiate with the path of the WSDL file and it suppose to contain everything else. 只需实例化WSDL文件的路径,它就应该包含其他所有内容。 The you just call 你刚刚打电话

$response = $client->getCMSTables();

See: http://php.net/manual/en/soapclient.soapclient.php 请参阅: http//php.net/manual/en/soapclient.soapclient.php

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

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