PHP如何向.NET接口webservice发送xml请求
这是我用PHP写的调用.net暴露给我的接口代码<?php$client=newSoapClient("https://wsite86.viewfinity.net/We...
这是我用PHP写的调用.net暴露给我的接口代码
<?php
$client = new SoapClient("https://wsite86.viewfinity.net/WebServices/KeyLicenseManager.asmx?wsdl");
try {
$parameters = array('KeyLicenseRequest'=>"string");
$username = $client->GetKeyLicense ($parameters);
} catch (SoapFault $fault){
echo "Fault! code:",$fault->faultcode,", string: ",$fault->faultstring;
}
print_r($username);
?>
/*******************************************************/
下面是SOAP上面的内容,他只提供了一个方法给我 只有一个字符串
<?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>
<GetKeyLicense xmlns="http://viewfinity.com/">
<KeyLicenseRequest>string</KeyLicenseRequest>
</GetKeyLicense>
</soap:Body>
</soap:Envelope>
/******************************/
下面是xml文档内容 是需要传过去的
<?xml version="1.0" encoding="utf-8" ?>
- <KeyLicenseRequest>
<LoginId>China Nanosoft</LoginId>
- <!-- the password is encrypted and should not be altered -->
<Password>lf8AGqDlTWKjmmzUbfCB+w==</Password>
- <UserProfile>
<LastName>Huang</LastName>
<FirstName>Howy</FirstName>
<Company>NanoSoft</Company>
<Email>howy.huang@chinananosoft.com</Email>
<Phone>24242425</Phone>
<Country>China</Country>
<Province>Shanghai</Province>
<NumberOfDesktops>1234</NumberOfDesktops>
- <!-- value either true or false -->
<PrivilegeManagement>true</PrivilegeManagement>
- <!-- value either true or false -->
<SystemsManagement>true</SystemsManagement>
</UserProfile>
-</KeyLicenseRequest> 展开
<?php
$client = new SoapClient("https://wsite86.viewfinity.net/WebServices/KeyLicenseManager.asmx?wsdl");
try {
$parameters = array('KeyLicenseRequest'=>"string");
$username = $client->GetKeyLicense ($parameters);
} catch (SoapFault $fault){
echo "Fault! code:",$fault->faultcode,", string: ",$fault->faultstring;
}
print_r($username);
?>
/*******************************************************/
下面是SOAP上面的内容,他只提供了一个方法给我 只有一个字符串
<?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>
<GetKeyLicense xmlns="http://viewfinity.com/">
<KeyLicenseRequest>string</KeyLicenseRequest>
</GetKeyLicense>
</soap:Body>
</soap:Envelope>
/******************************/
下面是xml文档内容 是需要传过去的
<?xml version="1.0" encoding="utf-8" ?>
- <KeyLicenseRequest>
<LoginId>China Nanosoft</LoginId>
- <!-- the password is encrypted and should not be altered -->
<Password>lf8AGqDlTWKjmmzUbfCB+w==</Password>
- <UserProfile>
<LastName>Huang</LastName>
<FirstName>Howy</FirstName>
<Company>NanoSoft</Company>
<Email>howy.huang@chinananosoft.com</Email>
<Phone>24242425</Phone>
<Country>China</Country>
<Province>Shanghai</Province>
<NumberOfDesktops>1234</NumberOfDesktops>
- <!-- value either true or false -->
<PrivilegeManagement>true</PrivilegeManagement>
- <!-- value either true or false -->
<SystemsManagement>true</SystemsManagement>
</UserProfile>
-</KeyLicenseRequest> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询