国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman里寫SoapServer沒有執(zhí)行handle方法

venchi

問題描述

類似案例 http://www.wtbis.cn/q/9010

程序代碼或配置

代碼

    public function serv(Request $request)
    {
        $wsdl_path = public_path().DIRECTORY_SEPARATOR.'webman.wsdl';
        try{
            $options = array(
                'uri' => 'urn:mywebservice',
                'location' => 'http://127.0.0.1:8787/soap/serv'
            );
            $serv = new SoapServer($wsdl_path);
            $serv->setObject(new \app\SoapServ());
            var_dump($wsdl_path, file_get_contents($wsdl_path));
            // readfile($wsdl_path);
            $serv->handle();
        }catch(\Throwable $th) {
            var_dump($th->getMessage());
        }
        return ;
    }

網(wǎng)頁源代碼
截圖
控制臺打印

string(49) "D:\repo\php\interfacems\webman\public\webman.wsdl"
string(2446) "<?xml version="1.0"?>
<definitions name="MyWebService"
    targetNamespace="urn:mywebservice"
    xmlns:tns="urn:mywebservice"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns="http://schemas.xmlsoap.org/wsdl/">

    <types>
        <xsd:schema targetNamespace="urn:mywebservice">
            <xsd:element name="sayHello">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="name" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="sayHelloResponse">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="return" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </types>

    <message name="sayHelloRequest">
        <part name="parameters" element="tns:sayHello"/>
    </message>
    <message name="sayHelloResponse">
        <part name="parameters" element="tns:sayHelloResponse"/>
    </message>

    <portType name="MyWebServicePortType">
        <operation name="sayHello">
            <input message="tns:sayHelloRequest"/>
            <output message="tns:sayHelloResponse"/>
        </operation>
    </portType>

    <binding name="MyWebServiceBinding" type="tns:MyWebServicePortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="sayHello">
            <soap:operation soapAction="urn:mywebservice:sayHello"/>
            <input>
                <soap:body use="encoded" namespace="urn:mywebservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </input>
            <output>
                <soap:body use="encoded" namespace="urn:mywebservice" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
            </output>
        </operation>
    </binding>

    <service name="MyWebServiceService">
        <port name="MyWebServicePort" binding="tns:MyWebServiceBinding">
            <soap:address location="http://127.0.0.1:8787/soap/serv"/>
        </port>
    </service>
</definitions>
"

重現(xiàn)問題的步驟

頁面訪問添加?wsdl參數(shù),正常會返回webman.wsdl的內(nèi)容。但是webman這里沒有返回,使用ob_start ob_get_clean 方法也捕獲不到數(shù)據(jù)。

操作系統(tǒng)環(huán)境及workerman/webman等具體版本

windows環(huán)境
webman版本:"workerman/webman-framework": "^1.5.0"
php版本、擴展:

PS D:\repo\php\interfacems> php -v
PHP 8.3.0 (cli) (built: Nov 21 2023 17:48:00) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.0, Copyright (c) Zend Technologies
PS D:\repo\php\interfacems> php --ri soap

soap

Soap Client => enabled
Soap Server => enabled

Directive => Local Value => Master Value
soap.wsdl_cache_enabled => On => On
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_ttl => 86400 => 86400
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_limit => 5 => 5
1599 2 0
2個回答

SillyDog

看下 webman 文檔的響應(yīng)部份
http://www.wtbis.cn/doc/webman/response.html

  • venchi 2024-02-19

    嘗試過ob_start + ob_get_clean 還是獲取不到,respons + header也不行

  • 27025011 2024-02-20

    handle()方法代碼提供一下

  • venchi 2024-02-21

    這個是php的擴展,soap??梢栽趐hp.ini里開啟

SillyDog

請看vcr

// 控制器方法內(nèi)
$result = $request->rawBody();
if (is_array($result)) {
$result = implode(" ", $result);
}
Log::info($result);
$ss = new \SoapServer(null, array('uri' => 'sampleA'));
$ss->setObject(new testA());
ob_start();
$ss->handle($result);
$result = ob_get_clean();
return response($result);

// 客戶端 
$client = new \SoapClient(null, array(
    'location' => 'http://127.0.0.1:8787',
    'uri' => 'sampleA'
));

echo json_encode($client->sayHi('Taylor,Swift'), JSON_UNESCAPED_UNICODE) . "\n";
echo "<br/>" . "\n";
echo json_encode($client->add(1, 2), JSON_UNESCAPED_UNICODE) . "\n";
  • venchi 2024-02-21
    public function serv(Request $request)
        {
            $wsdl_path = public_path().DIRECTORY_SEPARATOR.'webman.wsdl';
            try{
                $options = array(
                    'uri' => 'urn:mywebservice',
                    'location' => 'http://127.0.0.1:8086/soap/serv'
                );
                $serv = new \SoapServer($wsdl_path);
                ob_start();
                $serv->setObject(new \app\SoapServ());
                // var_dump($wsdl_path, file_get_contents($wsdl_path));
                // readfile($wsdl_path);
                $serv->handle();
                $ret = ob_get_clean();
                return response($ret);
    
            }catch(\Throwable $th) {
                var_dump($th->getMessage());
            }
            return ;
        }

    還是沒有返回,有試過ob_get_content+ob_end_clean也是一樣

  • SillyDog 2024-02-21

    嘗試把我那段處理 請求參數(shù)的代碼加一下試試
    $result = $request->rawBody();
    if (is_array($result)) {
    $result = implode(" ", $result);
    }
    $ss->handle($result);

  • venchi 2024-02-23

    控制臺輸出

    Worker[288] process terminated
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Bad Request</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

    網(wǎng)頁顯示 ERR_EMPTY_RESPONSE

    server方法:

    public function serv(Request $request)
        {
            $wsdl_path = public_path().DIRECTORY_SEPARATOR.'webman.wsdl';
            try{
                $result = $request->rawBody();
                if (is_array($result)) {
                    $result = implode(" ", $result);
                }
                $options = array(
                    'uri' => 'urn:mywebservice',
                    'location' => 'http://127.0.0.1:8086/soap/serv'
                );
                $serv = new \SoapServer($wsdl_path);
                ob_start();
                $serv->setObject(new \app\SoapServ());
                // var_dump($wsdl_path, file_get_contents($wsdl_path));
                // readfile($wsdl_path);
                $serv->handle($result);
                $ret = ob_get_clean();
                return response($ret);
    
            }catch(\Throwable $th) {
                var_dump($th->getMessage());
            }
            return ;
        }
年代過于久遠,無法發(fā)表回答
??