gpt4 book ai didi

php - 非 WSDL php 调用

转载 作者:搜寻专家 更新时间:2023-10-31 20:39:35 26 4
gpt4 key购买 nike

我是 php 的新手,希望将网站与一些租赁软件集成。他们使用非 WSDL 模式服务并提供了这段代码,但我对“this-is-the-action-uri”有点困惑。我猜这是我需要调用的方法。

    $client = new SoapClient(NULL, array(
'location' => '21.ip2.ip3.ip4/r2ws_v5/servlet/messagerouter',
'uri' => 'urn:this-is-the-action-uri',
'exceptions' => 1,
);

我可以调用它并得到响应。

http://21.ip2.ip3.ip4:8080/r2ws_v5/jsp/UBS_GetAvailability.jsp

响应是这样开始的。

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:getAvailabilityByItemResponse xmlns:ns1="UBS/R2" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<response>
<product>
<productID xsi:type="xsd:string">TESTUB</productID>
<level xsi:type="xsd:int">1</level>
<description xsi:type="xsd:string">
<![CDATA[ testub ]]>
</description>
</level>

你能告诉我在这种情况下“uri”参数应该是什么或者它应该如何格式化吗?

最佳答案

您好,只需创建一个 PHP 文件并将以下代码放入您的 PHP 文件即可。

$xmlRequest = "<SOAP:Envelope xmlns:SOAP=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" .
"<SOAP:Body>" .
"<getAvailabilityByItem xmlns=\"UBS/R2WebServices/AvailabilityService\">" .
"<request>" .
"<detail xsi:type=\"xsd:string\">0</detail>" .
"<products>".
"<product>" .
"<type xsi:type=\"xsd:int\">0</type>" .
"<productID xsi:type=\"xsd:string\"><![CDATA[DE014SML]]></productID>" .
"<startDate xsi:type=\"xsd:date\">12/07/2014</startDate>" .
"<startTime xsi:type=\"xsd:timeInstant\">8:00 AM</startTime>" .
"<endDate xsi:type=\"xsd:date\">12/08/2014</endDate>" .
"<endTime xsi:type=\"xsd:timeInstant\">12:00 PM</endTime>" .
"</product>".
"</products>" .
"</request>" .
"</getAvailabilityByItem>" .
"</SOAP:Body>" .
"</SOAP:Envelope>" ;

$location_URL = 'http://21.ip2.ip3.ip4/r2ws_v5/servlet/messagerouter';

$client = new SoapClient(null, array(
'location' => $location_URL,
'uri' => "",
'trace' => 1,
));
$order_return = $client->__doRequest($xmlRequest, $location_URL, '' , 1);

希望您找到了解决方案;)

关于php - 非 WSDL php 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26173818/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com