<?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);
?>
这是我调用.net暴露给我的接口代码
/*******************************************************/
下面是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>[email protected]</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.   

    xml传不过去 看这里 http://www.phpwell.com/?p=393
      

  2.   

    很遗憾,你给出的地址有问题
    Server Error in '/' Application.
    --------------------------------------------------------------------------------Request format is unrecognized. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Request format is unrecognized.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: 
    [InvalidOperationException: Request format is unrecognized.]
       System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +406022
       System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212
       System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
       System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +193
       System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618 
      

  3.   

    所有webservice都是表单提交一样.你提交的数据格式附合他要求(标准)就行, 一般是xmlcurl / socket / file_get_contents / ajax 都行 一句话就是模拟表单提交