Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 从PHP调用WS时丢失参数_.net_Php_Web Services - Fatal编程技术网

.net 从PHP调用WS时丢失参数

.net 从PHP调用WS时丢失参数,.net,php,web-services,.net,Php,Web Services,我试图从PHP调用此WS: namespace WsInteropTest { /// <summary> /// Summary description for Service1 /// </summary> [WebService(Namespace = "http://advantage-security.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProf

我试图从PHP调用此WS:

namespace WsInteropTest
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://advantage-security.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class TestWs : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld(int entero)
        {
            return "Hello World " + entero.ToString();
        }
    }
}
命名空间WsInteropTest
{
/// 
///服务1的摘要说明
/// 
[WebService(命名空间=”http://advantage-security.com/")]
[WebServiceBinding(ConformsTo=WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
//要允许使用ASP.NET AJAX从脚本调用此Web服务,请取消注释以下行。
//[System.Web.Script.Services.ScriptService]
公共类TestWs:System.Web.Services.WebService
{
[网络方法]
公共字符串HelloWorld(int)
{
返回“Hello World”+entro.ToString();
}
}
}
我用来调用WS的代码如下:

<?php
        require_once('nusoap\nusoap.php');
  $client = new nusoap_client('http://localhost/testws/TestWS.asmx?WSDL');

  $params = array(
   'entero' => 100
  );

  $result = $client->call('HelloWorld', array($params), 
      'http://advantage-security.com/HelloWorld',
      'http://advantage-security.com/HelloWorld');
  print_r($result);
  ?>

结果就是这样

你好,世界0

你认为可能有什么问题

根据我所读到的,在.NET(转换为标准soap类型)和PHP之间的简单类型没有问题

如果它有用,这里就是WSDL

提前谢谢

  <?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://advantage-security.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://advantage-security.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://advantage-security.com/">
- <s:element name="HelloWorld">
- <s:complexType>
- <s:sequence>
  <s:element minOccurs="1" maxOccurs="1" name="entero" type="s:int" /> 
  </s:sequence>
  </s:complexType>
  </s:element>
- <s:element name="HelloWorldResponse">
- <s:complexType>
- <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" /> 
  </s:sequence>
  </s:complexType>
  </s:element>
  </s:schema>
  </wsdl:types>
- <wsdl:message name="HelloWorldSoapIn">
  <wsdl:part name="parameters" element="tns:HelloWorld" /> 
  </wsdl:message>
- <wsdl:message name="HelloWorldSoapOut">
  <wsdl:part name="parameters" element="tns:HelloWorldResponse" /> 
  </wsdl:message>
- <wsdl:portType name="TestWsSoap">
- <wsdl:operation name="HelloWorld">
  <wsdl:input message="tns:HelloWorldSoapIn" /> 
  <wsdl:output message="tns:HelloWorldSoapOut" /> 
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="TestWsSoap" type="tns:TestWsSoap">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="HelloWorld">
  <soap:operation soapAction="http://advantage-security.com/HelloWorld" style="document" /> 
- <wsdl:input>
  <soap:body use="literal" /> 
  </wsdl:input>
- <wsdl:output>
  <soap:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:binding name="TestWsSoap12" type="tns:TestWsSoap">
  <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="HelloWorld">
  <soap12:operation soapAction="http://advantage-security.com/HelloWorld" style="document" /> 
- <wsdl:input>
  <soap12:body use="literal" /> 
  </wsdl:input>
- <wsdl:output>
  <soap12:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="TestWs">
- <wsdl:port name="TestWsSoap" binding="tns:TestWsSoap">
  <soap:address location="http://localhost/testws/TestWS.asmx" /> 
  </wsdl:port>
- <wsdl:port name="TestWsSoap12" binding="tns:TestWsSoap12">
  <soap12:address location="http://localhost/testws/TestWS.asmx" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>

- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
不应该是吗(因为$params已经是一个数组)


我无法发现这里发生了什么,所以我决定使用PHP5.2中内置的Soap库

解决办法是:

$client = new SoapClient("http://localhost/testws/TestWS.asmx?WSDL");
        $params = array(
            'entero' => 77
        );
        $result = $client->HelloWorld($params);
        print_r($result->HelloWorldResult);

我最初也这么想。我做了修改,但仍然得到0。。。有什么想法吗?
$client = new SoapClient("http://localhost/testws/TestWS.asmx?WSDL");
        $params = array(
            'entero' => 77
        );
        $result = $client->HelloWorld($params);
        print_r($result->HelloWorldResult);