2

我将尝试发出 SOAP 请求。我发现了很多主题,但一直收到错误请求。

起初我这样做:

$client = new SoapClient('h**p://....CategoryService.Soap.svc?singleWsdl', array('trace' => 1, 'exceptions' => 1, 'soap_version' => SOAP_1_2));
$functions = $client->__getFunctions();
$types = $client->__getTypes();

结果: 功能:

[8] => GetMainCategoriesResponse GetMainCategories(GetMainCategories $parameters)

类型:

[22] => struct GetMainCategories {
 GetMainCategoriesParameter getMainCategoriesParameter;
}
[23] => struct GetMainCategoriesParameter {
 MainCategoryFilter MainCategoryFilter;
 boolean OnlyActive;
}
[24] => string MainCategoryFilter
    [25] => struct GetMainCategoriesResponse {
 GetMainCategoriesResult GetMainCategoriesResult;
}
    [26] => struct GetMainCategoriesResult {
 ArrayOfMainCategoryResult MainCategories;
}

现在我试试这个:

$client = new SoapClient('h**p://....CategoryService.Soap.svc?singleWsdl', array('trace' => 1, 'exceptions' => 1, 'soap_version' => SOAP_1_2));
$request = array('getMainCategoriesParameter' => array(
    'MainCategoryFilter' => 'AllMainCategories',
    'OnlyActive' => 'true'
    ),
);
$response = $client->__soapCall("GetMainCategories", $request);</code>

但是 20 秒后我收到了这个错误:

Fatal error: Uncaught SoapFault exception: [HTTP] Bad Request in ....php:15 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'h**ps://...', 'h**p://....', 2, 0) #1 ....php(15): SoapClient->__soapCall('GetMainCategories', Array) #2 {main} thrown in ...
4

0 回答 0