Search code examples
phpweb-servicessoapwsdl

PHP SOAP client fatal error


I am having trouble run my PHP SOAP client on my machine at work. This is my PHP SOAP client:

    <?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>";
  ?>

this is WSDL file:

<?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>

Output is:

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

I can easily access xmldsig-core-schema.xsd file via web browser and my administrator told me that port 80 and 443 are not blocked.


Solution

  • This issue is related with the outbound port 8585. If the port blocked in the server, the server can't be able to access the public internet through the port. So, allow the port to access the public internet by unblocking it. It is only the solution and it works.