簡體   English   中英

PHP SOAP客戶端致命錯誤

[英]PHP SOAP client fatal error

我在工作的機器上運行PHP SOAP客戶端時遇到麻煩。 這是我的PHP SOAP客戶端:

    <?php

$params=array("SendMessageRequest" => 
    array( "GsbEnvelope" =>  
        array( "MessageHeader" => 
            array("SenderId" => "000000001",
                "ServiceId" => "000000002",
                "MessageId" => "833362f-063f-11e2-892e-0802200c9a62",
                "SenderTimeStamp" => "2013-12-03T14:39"),
                "Content" => array("MimeType" =>"application/xml","Data" =>"Nesto"))));

$client = new SoapClient("GSBService.wsdl", array(
                            "trace"=>1,
                            "exceptions"=>0,
                            "cache_wsdl" => 0));

print_r( $client->sendMessage($params));

echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>";
echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>";
echo "<p>Debug:".soapDebug($client)."</p>";
  ?>

這是WSDL文件:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="GSBService"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.apis-it.hr/umu/2013/services/GSBService"
    xmlns:umu="http://www.apis-it.hr/umu/2013/services/GSBService"
    xmlns:gsb="http://apis-it.hr/umu/2013/types/gsb">

  <wsdl:types>
    <xsd:schema targetNamespace="http://www.apis-it.hr/umu/2013/services/GSBService">
        <xsd:import namespace="http://apis-it.hr/umu/2013/types/gsb" schemaLocation="../schema/GSBSchema.xsd"/>
    </xsd:schema>
  </wsdl:types>

  <wsdl:message name="SendMessageRequest">
    <wsdl:part element="gsb:SendMessageRequest" name="request"/>
  </wsdl:message>
  <wsdl:message name="SendMessageResponse">
    <wsdl:part element="gsb:SendMessageResponse" name="response"/>
  </wsdl:message>

  <wsdl:message name="EchoRequest">
    <wsdl:part element="gsb:EchoRequest" name="request" />
  </wsdl:message>
  <wsdl:message name="EchoResponse">
    <wsdl:part element="gsb:EchoResponse" name="response" />
  </wsdl:message>

  <wsdl:portType name="GSBServicePortType">
    <wsdl:operation name="sendMessage">
      <wsdl:input message="umu:SendMessageRequest"/>
      <wsdl:output message="umu:SendMessageResponse"/>
    </wsdl:operation>
    <wsdl:operation name="echo">
        <wsdl:input message="umu:EchoRequest"/>
        <wsdl:output message="umu:EchoResponse"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="GSBService" type="umu:GSBServicePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="sendMessage">
      <soap:operation soapAction="http://www.apis-it.hr/umu/2013/services/GSBService/sendMessage"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="echo">
        <soap:operation soapAction="http://www.apis-it.hr/umu/2013/services/GSBService/echo"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="GSBService">
    <wsdl:port binding="umu:GSBService" name="GSBServicePortType">
      <soap:address location="http://www.apis-it.hr:8849/GsbService"/>
    </wsdl:port>
  </wsdl:service>

</wsdl:definitions>

輸出為:

Warning: SoapClient::SoapClient(http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd): failed to open stream: HTTP request failed! HTTP/1.1 500 Server Error in C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php on line 15

Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd" in C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php on line 15

Fatal error: SOAP-ERROR: Parsing Schema: can't import schema from 'http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd' in C:\xampp\htdocs\NIAS\HZZO-OKP-SOAP.php on line 15

我可以通過Web瀏覽器輕松訪問xmldsig-core-schema.xsd文件,我的管理員告訴我端口80和443沒有被阻止。

我通過在php.ini中啟用功能“ libxml_disable_entity_loader”解決了此問題

注意:您還必須在應用程序的啟動腳本中的某處調用libxml_disable_entity_loader(false),以啟用外部XML實體的加載。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM