简体   繁体   English

带参数的asmx HTTP发布请求

[英]asmx HTTP Post request with parameters

our company has a .net base website 我们公司有一个.net基本网站
a few days ago we request a webservice from our website programmer and yesterday he sent me a URL 几天前,我们要求网站程序员提供Web服务,昨天他给我发送了一个URL
when i open the URL from localhost its shown a page that i can choose one of my four method (function) that we request to programming. 当我从本地主机打开URL时,显示了一个页面,我可以选择我们要求编程的四种方法(函数)之一。
by choosing one of them a new page has boon shown as follow: 通过选择其中之一,新页面显示如下所示:

SOAP 1.1 SOAP 1.1
The following is a sample SOAP 1.1 request and response. 以下是示例SOAP 1.1请求和响应。 The placeholders shown need to be replaced with actual values. 显示的占位符需要替换为实际值。

POST /webservices/findstatus.asmx HTTP/1.1 Host: localhost POST /webservices/findstatus.asmx HTTP / 1.1主机:localhost
Content-Type: text/xml; 内容类型:text / xml; charset=utf-8 Content-Length: length charset = utf-8内容长度:长度
SOAPAction: " http://tempuri.org/FindWith_CodeR_Serail " SOAPAction:“ http://tempuri.org/FindWith_CodeR_Serail

<?xml version="1.0" encoding="utf-8"?>  
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  
  <soap:Body>  
    <FindWith_CodeR_Serail xmlns="http://tempuri.org/">  
      <CodeReception>int</CodeReception>  
      <Serial>string</Serial>  
    </FindWith_CodeR_Serail>  
  </soap:Body>  
</soap:Envelope>  

HTTP/1.1 200 OK Content-Type: text/xml; HTTP / 1.1 200 OK内容类型:text / xml; charset=utf-8 字符集= utf-8
Content-Length: length 内容长度:长度

<?xml version="1.0" encoding="utf-8"?>  
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  
  <soap:Body>  
    <FindWith_CodeR_SerailResponse xmlns="http://tempuri.org/">  
      <FindWith_CodeR_SerailResult>string</FindWith_CodeR_SerailResult>  
    </FindWith_CodeR_SerailResponse>  
  </soap:Body>  
</soap:Envelope> 

SOAP 1.2 SOAP 1.2
The following is a sample SOAP 1.2 request and response. 以下是SOAP 1.2请求和响应的示例。 The placeholders shown need to be replaced with actual values. 显示的占位符需要替换为实际值。

POST /webservices/findstatus.asmx HTTP/1.1 Host: localhost POST /webservices/findstatus.asmx HTTP / 1.1主机:localhost
Content-Type: application/soap+xml; 内容类型:application / soap + xml; charset=utf-8 Content-Length: length charset = utf-8内容长度:长度

<?xml version="1.0" encoding="utf-8"?>  
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">  
  <soap12:Body>  
    <FindWith_CodeR_Serail xmlns="http://tempuri.org/">  
      <CodeReception>int</CodeReception>  
      <Serial>string</Serial>  
    </FindWith_CodeR_Serail>  
  </soap12:Body>  
</soap12:Envelope>  

HTTP/1.1 200 OK Content-Type: application/soap+xml; HTTP / 1.1 200 OK内容类型:application / soap + xml; charset=utf-8 字符集= utf-8
Content-Length: length 内容长度:长度

<?xml version="1.0" encoding="utf-8"?>  
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">  
  <soap12:Body>  
    <FindWith_CodeR_SerailResponse xmlns="http://tempuri.org/">  
      <FindWith_CodeR_SerailResult>string</FindWith_CodeR_SerailResult>  
    </FindWith_CodeR_SerailResponse>  
  </soap12:Body>  
</soap12:Envelope> 

HTTP POST HTTP POST
The following is a sample HTTP POST request and response. 以下是示例HTTP POST请求和响应。 The placeholders shown need to be replaced with actual values. 显示的占位符需要替换为实际值。

POST /webservices/findstatus.asmx/FindWith_CodeR_Serail HTTP/1.1 POST /webservices/findstatus.asmx/FindWith_CodeR_Serail HTTP / 1.1
Host: localhost Content-Type: application/x-www-form-urlencoded 主机:localhost内容类型:application / x-www-form-urlencoded
Content-Length: length CodeReception=string&Serial=string 内容长度:长度CodeReception = string&Serial = string
HTTP/1.1 200 OK Content-Type: text/xml; HTTP / 1.1 200 OK内容类型:text / xml; charset=utf-8 字符集= utf-8
Content-Length: length 内容长度:长度

<?xml version="1.0" encoding="utf-8"?>  
<string xmlns="http://tempuri.org/">string</string>  

Now i'm stock on php codes that call this web service with 2 parameter 现在,我有使用2参数调用此Web服务的php代码的库存
please send me full code that i can paste it in a php file for test. 请寄给我完整的代码,我可以将其粘贴到php文件中进行测试。 no matter what kind of method is used : SOAP or HTTP POST 无论使用哪种方法:SOAP或HTTP POST

please help me. 请帮我。

i used this php code and every thing is OK: 我用这个PHP代码,一切都OK:

<?php

$client = new SoapClient("http://www.MyWebSite.com/webservices/findstatus.asmx?WSDL");
$params=new stdClass();
$params->CodeReception = '11111';
$params->Serial = '22222222';    
$result = $client->FindWith_CodeR_Serail($params)->FindWith_CodeR_SerailResult;
echo  $result;
?>
<?php

$client = new SoapClient("http://www.MyWebSite.com/webservices/findstatus.asmx?WSDL");
$params=new stdClass();
$params->CodeReception = '11111';
$params->Serial = '22222222';    
$result = $client->FindWith_CodeR_Serail($params)->FindWith_CodeR_SerailResult;
echo  $result;
?>

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

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