公司要做一个东西 要用到一个xml web service可以让我们发送xml请求到一个地址 然后他会根据我的请求返回数据
比如下面这样的xml请求
<xmlrequest>
<username>admin </username>
<usertoken>as6798afhu2gjhs78y9asd8 </usertoken>
<requesttype>orders </requesttype>
<requestmethod>GetOrders</requestmethod>
<details>
<start>1</start>
<searchQuery>abc</searchQuery>
</details>
</xmlrequest>
就能返回从1开始的所有order记录中带有abc字符串的记录
发送是按post发送
The request should be submitted as a standard HTTP POST operation, with
the post data containing the request XML他给了一个是php的例子
<?php
$storeURL = 'http://www.store.com/xml.php';
$storeUser = 'admin';
$storeToken = 'e30bfbbf36db9aff34e660a1cb322b23';
$xml = ' <xmlrequest>
<username>'.$storeUser.' </username>
<usertoken>'.$storeToken.' </usertoken>
<requesttype>orders </requesttype>
<requestmethod>GetOrder </requestmethod>
<details>
<orderId>1 </orderId>
</details>
</xmlrequest>';
$ch = curl_init($storeURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
echo ' <pre>';
echo htmlspecialchars(curl_exec($ch));
echo ' </pre>';
curl_close($ch); 但是我们的网站是asp .net的,小弟从没用过asp .net,应该怎么写可以得到他的response然后显示出来?
比如下面这样的xml请求
<xmlrequest>
<username>admin </username>
<usertoken>as6798afhu2gjhs78y9asd8 </usertoken>
<requesttype>orders </requesttype>
<requestmethod>GetOrders</requestmethod>
<details>
<start>1</start>
<searchQuery>abc</searchQuery>
</details>
</xmlrequest>
就能返回从1开始的所有order记录中带有abc字符串的记录
发送是按post发送
The request should be submitted as a standard HTTP POST operation, with
the post data containing the request XML他给了一个是php的例子
<?php
$storeURL = 'http://www.store.com/xml.php';
$storeUser = 'admin';
$storeToken = 'e30bfbbf36db9aff34e660a1cb322b23';
$xml = ' <xmlrequest>
<username>'.$storeUser.' </username>
<usertoken>'.$storeToken.' </usertoken>
<requesttype>orders </requesttype>
<requestmethod>GetOrder </requestmethod>
<details>
<orderId>1 </orderId>
</details>
</xmlrequest>';
$ch = curl_init($storeURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
echo ' <pre>';
echo htmlspecialchars(curl_exec($ch));
echo ' </pre>';
curl_close($ch); 但是我们的网站是asp .net的,小弟从没用过asp .net,应该怎么写可以得到他的response然后显示出来?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货