简体   繁体   English

带有XML的HTTP发布请求

[英]HTTP Post request with XML

I am trying to impliment a web service called Navlost.eu and I am not sure how to execute. 我试图隐含一个名为Navlost.eu的Web服务,但我不确定如何执行。 I am knowledgeable on XML, PHP and JS apart from HTML and CSS. 除了HTML和CSS外,我对XML,PHP和JS也很了解。

What the website recommends is the following: 该网站的建议如下:

This web service can be accessed via HTTP by sending an appropriately formatted POST request to the address http://navlost.eu/aero/nwx . 通过将适当格式的POST请求发送到地址http://navlost.eu/aero/nwx,可以通过HTTP访问此Web服务。 The body of the request should be an XML document containing a valid NWX request, as described below in the Specification section. 请求的主体应该是包含有效NWX请求的XML文档,如下面“规范”部分所述。

How does one come about this? 怎么会这样呢? In terms of files that need to be created? 就需要创建的文件而言? The RAW examples that were provided reminded me of SOAP... 提供的RAW示例让我想起了SOAP ...

Any insight is appreciated - thank you. 感谢您提供任何见解-谢谢。

I am not an expert in PHP, but it looks like the basic idea for making an HTTP request would be something like this. 我不是PHP方面的专家,但是看起来发出HTTP请求的基本思路是这样的。

$requestXml = new DOMDocument()
    ... Create Xml Request Document ...
$rawXml = $requestXml.saveXML();
$request = new HttpRequest("http://www.navlost.eu/aero/nwx",HTTP_METH_POST);
$request.setContentType('application/xml');
$request.setBody($rawXml);
$response = $request.send();
$responseXml = new DOMDocument();
$responseXml.loadXML($response.getBody());
    ... Process XML Response ...

It's going to be up to you to figure out the navlost.eu API so that you send the right requst and get the right responses back based on what actions you want to take. 您将需要弄清楚navlost.eu API,以便您根据需要采取的措施发送正确的请求并获得正确的响应。

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

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