Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wsdl-soap

Empfohlene Antworten

Veröffentlicht

Hallo,

ich beschäftige mich gerade mit SOAP unter PHP5. Hierzu versuche ich gerade das Beispiel von folgender Seite nachzuvollziehen:

http://www.professionelle-softwareentwicklung-mit-php5.de/erste_auflage/programming-php.soap.html

Das Beispiel läuft auch soweit, allerdings enden meine Versuche, eine weiter Funktion (nennen wir sie mal zum Test halloHoelle()) immer in Fehlermeldungen...

Also bisher habe ich einfach in das gegebene Beispiel folgendes Eingefügt:

Datei Bulletin2_server.php

<?php
class Webdienst {
public function halloWelt() {
return 'Hallo Welt';
}

public function halloHoelle() {
return 'Hallo Hölle';
}
}

try {
$server = new SOAPServer('Bulletin2.wsdl');
$server->setClass('Webdienst');
$server->handle();
}

catch (SOAPFault $f) {
print $f->faultstring;
}
?>[/PHP]

Datei client.php

[PHP]<?php
try {

$client = new SOAPClient('http://localhost/Bulletin2_server.php?wsdl');

print $client->halloWelt();
print $client->halloHoelle();

}

catch (SOAPFault $f) {
print $f->faultstring;
}
?>

und zu guter letzt, meiner Meinung nach der Grund für meine Problemchen:

Die WSDL-Datei:

<?xml version ="1.0" encoding ="UTF-8" ?>


<definitions name="Bulletin2_server"

 targetNamespace="http://localhost/Bulletin2_server"

 xmlns:tns=" http://localhost/Bulletin2_server"

 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/">


 <message name="halloWeltResponse">

  <part name="Result" type="xsd:string"/>

 </message>


 <portType name="HalloWeltPortType">

  <operation name="halloWelt">

   <output message="tns:halloWeltResponse"/>

  </operation>

    <operation name="halloHoelle">

   <output message="tns:halloHoelleResponse"/>

  </operation>

 </portType>


 <binding name="HalloWeltBinding" type="tns:HalloWeltPortType">

  <soap:binding

   style="rpc"

   transport="http://schemas.xmlsoap.org/soap/http"/>


  <operation name="halloWelt">

   <soap:operation soapAction="urn:hallowelt#halloWelt"/>

   <output>

    <soap:body

     use="encoded"

     namespace="urn:hallowelt"

     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

   </output>

  </operation>

 </binding>



 <message name="halloHoelleResponse">

  <part name="Result" type="xsd:string"/>

 </message>


 <binding name="HalloHoelleBinding" type="tns:HalloHoellePortType">

  <soap:binding

   style="rpc"

   transport="http://schemas.xmlsoap.org/soap/http"/>


  <operation name="halloHoelle">

   <soap:operation soapAction="urn:hallohoelle#halloHoelle"/>

   <output>

    <soap:body

     use="encoded"

     namespace="urn:hallohoelle"

     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

   </output>

  </operation>

 </binding>



 <service name="HalloWeltService">

  <port name="HalloWeltPort" binding="HalloWeltBinding">

   <soap:address location="http://localhost/Bulletin2_server.php"/>

  </port>

 </service>

</definitions>

Also ich wäre für jede Hilfe dankbar!!

Gruß,

Michael

mach mal

return 'Hallo Hoelle';

und nicht

return 'Hallo Hölle';

Meinst Du das 'Hallo Hölle' aus Bulletin2_server.php? Das ist nur ein String, der ausgegeben werden soll, wenn die Funktion HalloHoelle aufgerufen wird.

Lieder ist das nicht des Rätsels Lösung...

Ich habe so das Gefühl, dass die WSDL-Datei irgendwie nicht korrekt ist, aber ich weiß nicht, was da anders gemacht werde kann...

Oh,

stimmt...

Wenn ich jetzt dies hier noch einfüge (ich denke das ist das Service für HalloHoelle), dann geht es allerdings leider immer noch nicht...

<service name="HalloHoelleService">

  <port name="HalloWeltPort" binding="HalloHoelleBinding">

   <soap:address location="http://localhost/Bulletin2_server.php"/>

  </port>

 </service>
So sieht dann der gesamte Code der WSDL-Datei aus:
<?xml version ="1.0" encoding ="UTF-8" ?>


<definitions name="Bulletin2_server"

 targetNamespace="http://localhost/Bulletin2_server"

 xmlns:tns=" http://localhost/Bulletin2_server"

 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/">


 <message name="halloWeltResponse">

  <part name="Result" type="xsd:string"/>

 </message>


 <portType name="HalloWeltPortType">

  <operation name="halloWelt">

   <output message="tns:halloWeltResponse"/>

  </operation>

    <operation name="halloHoelle">

   <output message="tns:halloHoelleResponse"/>

  </operation>

 </portType>


 <binding name="HalloWeltBinding" type="tns:HalloWeltPortType">

  <soap:binding

   style="rpc"

   transport="http://schemas.xmlsoap.org/soap/http"/>


  <operation name="halloWelt">

   <soap:operation soapAction="urn:hallowelt#halloWelt"/>

   <output>

    <soap:body

     use="encoded"

     namespace="urn:hallowelt"

     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

   </output>

  </operation>

 </binding>



 <message name="halloHoelleResponse">

  <part name="Result" type="xsd:string"/>

 </message>


 <binding name="HalloHoelleBinding" type="tns:HalloHoellePortType">

  <soap:binding

   style="rpc"

   transport="http://schemas.xmlsoap.org/soap/http"/>


  <operation name="halloHoelle">

   <soap:operation soapAction="urn:hallohoelle#halloHoelle"/>

   <output>

    <soap:body

     use="encoded"

     namespace="urn:hallohoelle"

     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

   </output>

  </operation>

 </binding>



 <service name="HalloWeltService">

  <port name="HalloWeltPort" binding="HalloWeltBinding">

   <soap:address location="http://localhost/Bulletin2_server.php"/>

  </port>

 </service>


  <service name="HalloHoelleService">

  <port name="HalloWeltPort" binding="HalloHoelleBinding">

   <soap:address location="http://localhost/Bulletin2_server.php"/>

  </port>

 </service>


</definitions>

Also im Browser erscheint folgendes:

Hallo WeltFunction ("halloHoelle") is not a valid method for this service

Das erste ist ja der normale Hallo Welt aufruf, und dann kommt die Fehlermeldung...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.