PHP - erstellen und Aufruf von SOAP-web-service - Fehler
Jedes mal, wenn ich versuche, einen Anruf zu meinem webservice, durch die wsdl, bekomme ich die Fehlermeldung, die hier gezeigt werden. Ich denke, es ist wahrscheinlich ein Problem innerhalb der WSDL-defintion, da ich nicht sicher bin, was ich mache, innerhalb der WSDL-definition zu beginnen:
[22-Sep-2011 18:54:46] PHP Fatal error: Uncaught SoapFault exception:
[HTTP] Not Found in /www/zendserver/htdocs/dev/csc/request.php:4
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...',
'http://192.168....', 'http://www.exam...', 1, 0)
#1 [internal function]: SoapClient->__call('EchoText', Array)
#2 /www/zendserver/htdocs/dev/csc/request.php(4):
SoapClient->EchoText('test')
#3 {main} thrown in /www/zendserver/htdocs/dev/csc/request.php on
line 4
Habe ich eine sehr einfache web-service, befindet sich am:
http://192.168.1.2:10088/csc/csc.php
<?php
function EchoText($text){
return "ECHO: ".$text;
}
$server = new SoapServer(null,
array('uri' => "http://192.168.1.2:10088/csc/csc.php"));
$server->addFunction('EchoText');
$server->handle();
?>
Habe ich eine Anbindung Seite, die ist, was ich auf und bekomme dann die Fehlermeldung oben gezeigt, befindet sich am:
http://192.168.1.2:10088/csc/request.php
<?php
$client = new SoapClient("http://192.168.1.2:10088/csc/NewWSDLFile.wsdl");
$result = $client->EchoText("test");
echo $result;
>?
Habe ich meine WSDL befindet sich unter:
http://192.168.1.2:10088/csc/NewWSDLFile.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://192.168.1.2:10088/csc/NewWSDLFile.wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="NewWSDLFile" targetNamespace="http://192.168.1.2:10088/csc/NewWSDLFile.wsdl">
<wsdl:types>
<xsd:schema targetNamespace="http://192.168.1.2:10088/csc/NewWSDLFile.wsdl">
<xsd:element name="EchoText">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="in" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="EchoTextResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="out" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="EchoTextRequest">
<wsdl:part element="tns:EchoText" name="parameters"/>
</wsdl:message>
<wsdl:message name="EchoTextResponse">
<wsdl:part element="tns:EchoText" name="parameters"/>
</wsdl:message>
<wsdl:portType name="NewWSDLFile">
<wsdl:operation name="EchoText">
<wsdl:input message="tns:EchoTextRequest"/>
<wsdl:output message="tns:EchoTextResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NewWSDLFileSOAP" type="tns:NewWSDLFile">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="EchoText">
<soap:operation soapAction="http://192.168.1.2:10088/csc/NewWSDLFile/EchoText"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="NewWSDLFile">
<wsdl:port binding="tns:NewWSDLFileSOAP" name="NewWSDLFileSOAP">
<soap:address location="http://192.168.1.2:10088/csc/csc.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
UPDATE..
War ich in der Lage, um weitere detaillierte Informationen über die Fehlermeldung, indem Sie einen try catch und print_r($e);... hier ist die detaillierte Fehlermeldung:
SoapFault Object (
[message:protected] => Not Found
[string:private] =>
[code:protected] => 0
[file:protected] => /www/zendserver/htdocs/dev/csc/request.php
[line:protected] => 7
[trace:private] => Array (
[0] => Array (
[function] => __doRequest
[class] => SoapClient
[type] => ->
[args] => Array (
[0] =>
[1] => http://192.168.1.2:10088/csc/csc.wsdl
[2] => http://www.example.org/NewWSDLFile/EchoText
[3] => 1
[4] => 0
)
)
[1] => Array (
[function] => __call
[class] => SoapClient
[type] => ->
[args] => Array (
[0] => EchoText
[1] => Array (
[0] => test
)
)
)
[2] => Array (
[file] => /www/zendserver/htdocs/dev/csc/request.php
[line] => 7
[function] => EchoText
[class] => SoapClient
[type] => ->
[args] => Array (
[0] => test
)
)
)
[faultstring] => Not Found
[faultcode] => HTTP
)
InformationsquelleAutor Adam | 2011-09-22
Du musst angemeldet sein, um einen Kommentar abzugeben.
SoapFault => Nicht Gefunden haben, ist, dass der SoapClient nicht erreichen können, der server.
192.168.1.2 ist eine lokale IP-Adresse ist der Webserver auch im lokalen Netzwerk? Ansonsten, dass ist der Grund, warum Ihr client nicht funktioniert.
In welcher Sprache schreibst du die web-services?
PHP 5.2.13, apache-server.
ich bin die Fortsetzung dieser post in einer anderen Frage. als die Fehlermeldung und die Ausgabe hat sich verändert... obwohl die URL ' s verwendet werden, sind immer noch die gleichen. stackoverflow.com/questions/7561604/...
InformationsquelleAutor Robin Andersson