php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2006

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 23.06.2006, 17:07  
Neuer Benutzer
 
Registriert seit: 03.05.2006
Beiträge: 19
vegeta
Standard nuSoap mit document/literal verwenden

Hallo Leute,

ich beschäftige mich gerade mit Soap, speziel mit PEAR:SOAP und jetzt auch mit NuSoap. Mitlerweile arbeite ich nur noch mit NuSoap weil ich damit die besseren erfolge erziehlen konnte. Zu Beginn hatte ich probleme mit komplexen datentypen, aber mit NuSoap konnte ich schnell einen soap server schreiben der auch damit zurecht kommt.
Zur Zeit versuche ich anstatt rpc, document/literal zu verwenden.
Zwar kommt was vom server zurück aber nicht der Rückgabewert.
Habt ihr schon mit NuSoap eure erfahrungen gemacht?


Hier der Server:
Code:
<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$NAMESPACE = 'urn:myfirstexample';
$server->configureWSDL('hellowsdl2', $NAMESPACE);

$server->wsdl->schemaTargetNamespace = $NAMESPACE;
// Register the data structures used by the service
$server->wsdl->addComplexType(
	'Person',
	'complexType',
	'struct',
	'sequence',
	'',
	array(
		'firstname' => array('name' => 'firstname', 'type' => 'xsd:string', 'minOccurs' => '0', 'maxOccurs' => 'unbounded'),
		'age' => array('name' => 'age', 'type' => 'xsd:int', 'minOccurs' => '0', 'maxOccurs' => 'unbounded'),
	)
);


// Register the method to expose
$server->register('hello',					// method name
	array('person' => 'tns:Person'),	          	// input parameters
	array('return' => 'xsd:string'),	               // output parameters
	$NAMESPACE,						// namespace
	'urn:myfirstexample:hello',					// soapaction
	'document',									// style
	'literal',								// use
	'Greet a person entering the sweepstakes'		// documentation
);

// Define the method as a PHP function
function hello($person) {
    return "nice to meet you" . $person['firstname'];
}

// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>
und hier der Client

Code:
<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the client instance
$client = new soapclient('http://localhost/myfirstexampleDocument.php?wsdl',true);
//create body message
$body = "<hello xmlns=\"urn:myfirstexample:\"><person><firstname>said</firstname><age>25</age></person></hello>";
$message = $client->serializeEnvelope($body);
$client->send($message,"urn:myfirstexample:hello") ;
echo "---------------------------------"  ;
echo $client->document;
echo "---------------------------------";
//echo $result;
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

?>
danke für die Hilfe,
ok bis dann
vegeta ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 26.06.2006, 11:04  
Neuer Benutzer
 
Registriert seit: 03.05.2006
Beiträge: 19
vegeta
Standard

Hallo,

bin leider nicht wirklich weiter gekommen.
Ich warte auf hilfe aber die lässt auf sich warten

Hier die WSDL datei die nusoap für mich erstellt.

Code:
  <?xml version="1.0" encoding="ISO-8859-1" ?> 
- <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:myfirstexample" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:myfirstexample">
- <types>
- <xsd:schema targetNamespace="urn:myfirstexample">
  <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
  <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> 
- <xsd:complexType name="Person">
- <xsd:sequence>
  <xsd:element name="firstname" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element name="age" type="xsd:int" minOccurs="0" maxOccurs="unbounded" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType name="helloRequestType">
- <xsd:all>
  <xsd:element name="person" type="tns:Person" /> 
  </xsd:all>
  </xsd:complexType>
- <xsd:complexType name="helloResponseType">
- <xsd:all>
  <xsd:element name="return" type="xsd:string" /> 
  </xsd:all>
  </xsd:complexType>
  <xsd:element name="hello" type="tns:helloRequestType" /> 
  <xsd:element name="helloResponse" type="tns:helloResponseType" /> 
  </xsd:schema>
  </types>
- <message name="helloRequest">
  <part name="parameters" element="tns:hello" /> 
  </message>
- <message name="helloResponse">
  <part name="parameters" element="tns:helloResponse" /> 
  </message>
- <portType name="hellowsdl2PortType">
- <operation name="hello">
  <documentation>Greet a person entering the sweepstakes</documentation> 
  <input message="tns:helloRequest" /> 
  <output message="tns:helloResponse" /> 
  </operation>
  </portType>
- <binding name="hellowsdl2Binding" type="tns:hellowsdl2PortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <operation name="hello">
  <soap:operation soapAction="urn:myfirstexample:hello" style="document" /> 
- <input>
  <soap:body use="literal" namespace="urn:myfirstexample" /> 
  </input>
- <output>
  <soap:body use="literal" namespace="urn:myfirstexample" /> 
  </output>
  </operation>
  </binding>
- <service name="hellowsdl2">
- <port name="hellowsdl2Port" binding="tns:hellowsdl2Binding">
  <soap:address location="http://localhost/phphack/myfirstexampleDocument.php" /> 
  </port>
  </service>
  </definitions>
wahrscheinlich liegt das problem daran das nusoap im binding tag das style attribut weiterhin auf rpc lässt.
Hoffe die wsdl trägt bei der problem lösung bei

Gruss
vegeta ist offline  
Alt 29.06.2006, 12:49  
Neuer Benutzer
 
Registriert seit: 03.05.2006
Beiträge: 19
vegeta
Standard

Hallo,

ich bin es noch mal. Wie ich sehe hat sich leider keiner zu meinem Thema geäußert und wollt nach fragen woran das liegt?

Ist meine problem zu schwierig oder unverständlich oder liegt es an etwas anderem.

was kann ich beim nächsten post besser machen

gruss
vj
vegeta ist offline  
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Variable aus Subselect in JOIN verwenden GSJLink Datenbanken 5 25.05.2008 11:36
nusoap Probleme mit großen Datenmengen? Anotherone PHP-Fortgeschrittene 1 07.11.2006 18:18
Variablen in einer Funktion verwenden Smily0412 PHP Tipps 2006 3 24.09.2006 16:42
Ausm Refer rausziehen und verwenden *denkfehler* Kori PHP Tipps 2006 1 08.08.2006 17:14
NuSOAP + PHP SOAP kombinieren Transmitter PHP-Fortgeschrittene 2 17.07.2006 09:39
nusoap ergebnisse unkompliziert parsen PHP Tipps 2005-2 3 12.09.2005 09:12
Instanz über mehrere Seiten verwenden? becks123 PHP Tipps 2005-2 3 22.08.2005 10:10
SOAP in PHP5 für NuSoap deaktivieren PHP-Fortgeschrittene 2 03.08.2005 18:23
COM-Object unter UNIX verwenden? PHP-Fortgeschrittene 1 25.05.2005 12:02
[Erledigt] $$var / ${$var} in preg_replace_callback() verwenden PHP Tipps 2005 8 20.04.2005 18:02
In CSS Datei php verwenden Niedi HTML, Usability und Barrierefreiheit 6 30.03.2005 23:20
GET und POST gleichzeitig verwenden ? PHP Tipps 2005 6 17.03.2005 03:20
Grafiken als Rahmen verwenden?! CSS HTML, Usability und Barrierefreiheit 8 03.03.2005 20:49
blob verwenden (xtreme noob) Malfunction Datenbanken 9 03.02.2005 13:51
direkt xml-datei an via nusoap verschicken? robo47 PHP Tipps 2004-2 1 16.11.2004 12:24

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
nusoap documentation, nusoap document literal, nusoap document/literal, php soap document literal, nusoap complextype sequence, nusoap addcomplextype, document literal, document/literal nusoap, nusoap literal, nusoap komplexe datentypen, nusoap sequence, nusoap soapvar \treturns null\, nusoap dokumentation, http://www.php.de/php-tipps-2006/40869-nusoap-mit-document-literal-verwenden.html, nusoap wsdl document literal, nusoap blob, nusoap document literal-, nusoap addcomplextype tutorial, service documentation nusoap, php wsdl document literal

Alle Zeitangaben in WEZ +1. Es ist jetzt 14:11 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.