【发布时间】:2017-01-15 01:13:42
【问题描述】:
我正在开发一个项目,我正在使用内部托管的 3rd 方应用程序的 SOAP API(BMC FootPrints Service Core)。我可以使用 PHP 调用 API,我的凭据很好,并且在一个特定的 API 方法中,我正在对 API 函数进行看起来像是有效的调用,但得到以下异常/错误:
SoapFault exception: [soap:Client] Unmarshalling Error: cvc-complex-type.2.4.b: The content of element 'ns1:runSearch' is not complete. One of '{runSearchRequest}' is expected
“需要 '{runSearchRequest}' 之一”部分的确切含义是什么?我不明白在向 API 发出的请求中还需要包含什么。
API 文档可在此处找到,具体而言,第 31 页指的是我尝试使用的 API 方法,在此屏幕截图中记录:image from PDF。
我不会发布所有代码,只发布我尝试 API 方法的部分:
// array that will be used in the method call...
$searchFor = array(
"_searchId"=>"11",
);
try {
$response = $soapClient->__soapCall("runSearch", $searchFor);
print_r($response);
} catch (SoapFault $exception) {
echo $exception;
}
我使用 SOAPUI 应用程序测试了方法调用,我能够看到结果/响应正常。
更新:添加 WSDL xml (sn-ps)...
我正在使用 WSDL,但它托管在我们的内部/本地网络上并且没有暴露在外部,这是 XML 的开头和来自该 WSDL 的 runSearch 类型:
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://externalapi.business.footprints.numarasoftware.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ExternalApiService" targetNamespace="http://externalapi.business.footprints.numarasoftware.com/">
<wsdl:types>
<schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xxxxxxxxxxxxxxxxxxxx.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="xxxxxxxxxxxxxxxxxxxxxxxx" schemaLocation="http://xxxxxxxxxxxxxxxxxxxxxxxx:PORT/footprints/servicedesk/externalapisoap/ExternalApiServicePort?xsd=externalapiservices_schema.xsd"/>
</schema>
</wsdl:types>
...
<wsdl:message name="runSearch">
<wsdl:part element="tns:runSearch" name="parameters">
</wsdl:part>
</wsdl:message>
【问题讨论】:
标签: php api soap soap-client