Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.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
PHP5和SOAP/WSDL?_Php_Web Services_Soap_Wsdl_Nusoap - Fatal编程技术网

PHP5和SOAP/WSDL?

PHP5和SOAP/WSDL?,php,web-services,soap,wsdl,nusoap,Php,Web Services,Soap,Wsdl,Nusoap,我现在有一个大问题,我需要创建自己的Web服务,但我真的不知道怎么做,sombody能帮我吗 也许链接到制作WSDL/SOAP代码的简单方法?我已经尝试过NuSoap,但我无法获得此代码的最终版本,请帮助我。:) SOAP Web服务的一个非常基本的示例: 服务器部分(server.php): 本例假设您将这三个文件放在一个可从访问的目录中,如果您使用其他位置,请查找并替换为正确的URL 它还需要安装soapphp扩展。祝你好运 <?php function getRot13($pIn

我现在有一个大问题,我需要创建自己的Web服务,但我真的不知道怎么做,sombody能帮我吗


也许链接到制作WSDL/SOAP代码的简单方法?我已经尝试过NuSoap,但我无法获得此代码的最终版本,请帮助我。:)

SOAP Web服务的一个非常基本的示例:

服务器部分(server.php):


本例假设您将这三个文件放在一个可从访问的目录中,如果您使用其他位置,请查找并替换为正确的URL

它还需要安装soapphp扩展。祝你好运

<?php
function getRot13($pInput) {
    $rot = str_rot13($pInput);
    return($rot);
}

function getMirror($pInput) {
    $mirror = strrev($pInput);
    return $mirror;
}

ini_set("soap.wsdl_cache_enabled", "0");

$server = new SoapServer('scramble.wsdl');

$server->addFunction("getRot13");
$server->addFunction("getMirror");

$server->handle();
<?php
// turn off the WSDL cache
ini_set("soap.wsdl_cache_enabled", "0");

$client = new SoapClient("http://localhost/test/scramble.wsdl");

$origtext = "mississipi";

print("The original text : $origtext\n");

$mirror = $client->getMirror($origtext);
print("The mirrored text : $mirror\n");

$scramble = $client->getRot13($mirror);
print("The scrambled text : $scramble\n");
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='Scramble' 
  targetNamespace='http://localhost/test/scramble.wdsl' 
  xmlns:tns='http://localhost/test/scramble.wdsl' 
  xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
  xmlns='http://schemas.xmlsoap.org/wsdl/'> 

<message name='getRot13Request'> 
  <part name='symbol' type='xsd:string'/> 
</message> 
<message name='getRot13Response'> 
  <part name='Result' type='xsd:string'/> 
</message> 
<message name='getMirrorRequest'> 
  <part name='symbol' type='xsd:string'/> 
</message> 
<message name='getMirrorResponse'> 
  <part name='Result' type='xsd:string'/> 
</message> 

<portType name='ScramblePortType'> 
  <operation name='getRot13'>
    <input message='tns:getRot13Request'/> 
    <output message='tns:getRot13Response'/>   
  </operation>
  <operation name='getMirror'>
    <input message='tns:getMirrorRequest'/> 
    <output message='tns:getMirrorResponse'/>   
  </operation>    
</portType> 

<binding name='ScrambleBinding' type='tns:ScramblePortType'> 
  <soap:binding style='rpc' 
    transport='http://schemas.xmlsoap.org/soap/http'/> 
  <operation name='getRot13'> 
    <soap:operation soapAction='urn:localhost-scramble#getRot13'/> 
    <input> 
      <soap:body use='encoded' namespace='urn:localhost-scramble' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </input> 
    <output> 
      <soap:body use='encoded' namespace='urn:localhost-scramble' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </output> 
  </operation>
  <operation name='getMirror'> 
    <soap:operation soapAction='urn:localhost-scramble#getMirror'/> 
    <input> 
      <soap:body use='encoded' namespace='urn:localhost-scramble' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </input> 
    <output> 
      <soap:body use='encoded' namespace='urn:localhost-scramble' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </output> 
  </operation>       
</binding> 

<service name='ScrambleService'> 
  <port name='ScramblePort' binding='ScrambleBinding'> 
    <soap:address location='http://localhost/test/server.php'/> 
  </port> 
</service>
</definitions>