我需要使用 Soap 和 php 发送一个 xml 请求。我想要的xml请求是这样的
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header/>
<soapenv:Body>
<air:AirFareRulesReq AuthorizedBy="TESTANTON" TargetBranch="P7001111" FareRuleType="long" xmlns:air="http://www.travelport.com/schema/
air_v20_0" xmlns:com="http://www.travelport.com/schema/common_v17_0">
<com:BillingPointOfSaleInfo OriginApplication="UAPI" />
<air:FareRuleKey FareInfoRef="14T" ProviderCode="1G">
</air:FareRuleKey>
</air:AirFareRulesReq>
</soapenv:Body>
</soapenv:Envelope>
我为此编写的 php cod 是
创建属性数组
$fareopta = array();
$fareopta["BillingPointOfSaleInfo"]= array();
$fareopta["BillingPointOfSaleInfo"]["OriginApplication"]= "UAPI";
$fareopta["AirReservationSelector"] = array();
$fareopta["FareRuleLookup"]=array();
$fareopta["FareRuleKey"] = array();
$fareopta["AirPricingSolution"] = array();
$fareopta["FareRuleKey"]["FareInfoRef"] = $_GET['pricingKey'];
$fareopta["FareRuleKey"]["ProviderCode"] = "1G";
调用函数的代码
$client = new FareruleSoapClient(
MY_ABSOLUTE_DIRECTORY .
"/uAPI_WSDLschema_Release-11.2.02-v11.2/air_v16_0/Air.wsdl"
);
$fareresult = $client->service($fareopta);
// code for FareruleSoapClient class
class FarerulesSoapClient extends SoapClient
{
function __construct($wsdlLocation)
{
$trac["trace"]=1;
$trac["use"]=SOAP_LITERAL;
$trac["style"]=SOAP_DOCUMENT;
$trac["compression"]=SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5;
//$trac["compression"]=SOAP_COMPRESSION_ACCEPT ;
$trac["type_ns"]="";
$trac["login"]=SOAP_CLIENT_USERNAME;
$trac["password"]=SOAP_CLIENT_PASSWORD;
$trac["location"]="https://emea.copy-webservices.travelport.com/B2BGateway/connect/uAPI/AirFareRulesService";
$trac["action"]="http://localhost:8080/kestrel/AirFareRulesService";
$trac["version"]="SOAP_1_1";
parent::__construct($wsdlLocation, $trac);
}
function __doRequest($request, $location, $action, $version)
{
$namespace1='"http://www.travelport.com/schema/air_v15_0"';
$namespace2='"http://www.travelport.com/schema/common_v12_0"';
$namespace3='"http://www.travelport.com/schema/common_v13_0"';
$request=str_replace("<ns2:AirFareRulesReq","<ns2:AirFareRulesReq"." ".'TargetBranch="P107616"'." "."xmlns:ns2=".$namespace1,$request);
return parent::__doRequest($request, $location, $action, $version);
echo parent::__getLastRequest();
echo parent::__getLastResponse();
}
function __getLastRequest()
{
return parent::__getLastRequest();
}
}
但是每当我运行代码时,xml 请求都会作为另一个名为 AirRepriceReq 请求的请求进行。我认为这是因为 AirRepriceReq 和 AirFareRuleReq 都使用相同的服务。代码中提到($fareresult = $client->service($fareopta);)。
我应该怎么做才能避免这种压倒一切?