From: Albert <al...@fu...> - 2005-07-27 16:00:20
|
What a weird thing, i get the same error with two diff versions. I=92ve download the last one from sf and it works now (although I had = already tried with it) Sorry for the posts -----Mensaje original----- De: nus...@li... [mailto:nus...@li...] En nombre de Albert Enviado el: mi=E9rcoles, 27 de julio de 2005 14:04 Para: nus...@li... Asunto: [Nusoap-general] [newb] sure it's a dumb thing Hi, this is my first post to this list. I'm trying the simplest example of a php soap server & client, and i = can't get it to work. Here is the servidor.php code: <?php=20 ob_start(); // Pull in the NuSOAP code require_once("inc/nusoap/nusoap.php"); // Create the server instance $server =3D new soap_server; // Register the method to expose $server->register('hello'); // Define the method as a PHP function function hello($name) { return 'Hello, ' . $name; } // Use the request to (try to) invoke the service $HTTP_RAW_POST_DATA =3D isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA = : ''; $server->service($HTTP_RAW_POST_DATA); ?> And here the client code: // Create the client instance $client =3D new = soapclient('http://localhost/dev/fwremotoweb/servidor.php'); // Check for an error $err =3D $client->getError(); if ($err) { // Display the error echo '<p><b>Constructor error: ' . $err . '</b></p>'; // At this point, you know the call that follows will fail } // Call the SOAP method $result =3D $client->call('hello', array('name' =3D> 'Scott')); // Check for a fault if ($client->fault) { echo '<p><b>Fault: '; print_r($result); echo '</b></p>'; } else { // Check for errors $err =3D $client->getError(); if ($err) { // Display the error echo '<p><b>Error: ' . $err . '</b></p>'; } else { // Display the result print_r($result); } } /***** DEBUG*/ echo 'Request: <xmp>'.$client->request.'</xmp>'; echo 'Response: <xmp>'.$client->response.'</xmp>'; echo 'Debug log: <pre>'.$client->debug_str.'</pre>'; /********/ Finally, here is the client's output (with all the debug information). = Note that first of all it shows an error (from $client->getError();) but on = the last line there is the correct answer!!! (it's on the debug string). I'm totally lost, it's so frustrating... this is a really simple = example!! ---- output ------ 8< ----- Error: XML error parsing SOAP payload on line 2: xml declaration not at start of external entity Request:=20 POST /dev/fwremotoweb/servidor.php HTTP/1.0 Host: localhost User-Agent: NuSOAP/0.7.1 (1.92) Content-Type: text/xml; charset=3DISO-8859-1 SOAPAction: "" Content-Length: 538 <?xml version=3D"1.0" encoding=3D"ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:si=3D"http://soapinterop.org/xsd"><SOAP-ENV:Body><ns7634:hello xmlns:ns7634=3D"http://tempuri.org"><name xsi:type=3D"xsd:string">Scott</name></ns7634:hello></SOAP-ENV:Body></SOAP= -ENV: Envelope> Response:=20 HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Wed, 27 Jul 2005 11:59:27 GMT X-Powered-By: ASP.NET X-Powered-By: PHP/4.3.4 Server: NuSOAP Server v0.7.1 X-SOAP-Server: NuSOAP/0.7.1 (1.92) Content-Type: text/xml; charset=3DISO-8859-1 Content-Length: 556 <?xml version=3D"1.0" encoding=3D"ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:si=3D"http://soapinterop.org/xsd"><SOAP-ENV:Body><ns1:helloResponse= xmlns:ns1=3D"http://tempuri.org"><return xsi:type=3D"xsd:string">Hello, Scott</return></ns1:helloResponse></SOAP-ENV:Body></SOAP-ENV:Envelop Debug log:=20 2005-07-27 13:59:27.660753 soapclient: instantiate SOAP with endpoint at http://localhost/dev/fwremotoweb/servidor.php 2005-07-27 13:59:27.660881 soapclient: call: operation=3Dhello, namespace=3Dhttp://tempuri.org, soapAction=3D, rpcParams=3D, = style=3Drpc, use=3Dencoded, endpointType=3Dsoap params=3Darray(1) { ["name"]=3D> string(5) "Scott" } headers=3Dbool(false) 2005-07-27 13:59:27.661031 soapclient: serializing param array for = operation hello 2005-07-27 13:59:27.661139 soapclient: in serialize_val: name=3Dname, = type=3D, name_ns=3D, type_ns=3D, use=3Dencoded value=3Dstring(5) "Scott" attributes=3Dbool(false) 2005-07-27 13:59:27.661293 soapclient: wrapping RPC request with encoded method element 2005-07-27 13:59:27.661367 soapclient: In serializeEnvelope length=3D103 = body (max 1000 characters)=3DScott style=3Drpc use=3Dencoded encodingStyle=3Dhttp://schemas.xmlsoap.org/soap/encoding/ 2005-07-27 13:59:27.661475 soapclient: headers: bool(false) 2005-07-27 13:59:27.661540 soapclient: namespaces: array(0) { } 2005-07-27 13:59:27.661661 soapclient: endpoint=3Dhttp://localhost/dev/fwremotoweb/servidor.php, soapAction=3D, namespace=3Dhttp://tempuri.org, style=3Drpc, use=3Dencoded, encodingStyle=3Dhttp://schemas.xmlsoap.org/soap/encoding/ 2005-07-27 13:59:27.661709 soapclient: SOAP message length=3D538 = contents (max 1000 bytes)=3DScott 2005-07-27 13:59:27.661794 soapclient: transporting via HTTP 2005-07-27 13:59:27.662288 soapclient: sending message, length=3D538 2005-07-27 13:59:27.661918 soap_transport_http: scheme =3D http 2005-07-27 13:59:27.661978 soap_transport_http: host =3D localhost 2005-07-27 13:59:27.662021 soap_transport_http: path =3D /dev/fwremotoweb/servidor.php 2005-07-27 13:59:27.662074 soap_transport_http: set Host: localhost 2005-07-27 13:59:27.662150 soap_transport_http: set User-Agent: = NuSOAP/0.7.1 (1.92) 2005-07-27 13:59:27.662201 soap_transport_http: set Content-Type: = text/xml; charset=3DISO-8859-1 2005-07-27 13:59:27.662244 soap_transport_http: set SOAPAction: "" 2005-07-27 13:59:27.662347 soap_transport_http: entered send() with data = of length: 538 2005-07-27 13:59:27.662462 soap_transport_http: connect = connection_timeout 0, response_timeout 30, scheme http, host localhost, port 80 2005-07-27 13:59:27.662515 soap_transport_http: calling fsockopen with = host localhost connection_timeout 0 2005-07-27 13:59:27.672413 soap_transport_http: set response timeout to = 30 2005-07-27 13:59:27.672506 soap_transport_http: socket connected 2005-07-27 13:59:27.672582 soap_transport_http: set Content-Length: 538 2005-07-27 13:59:27.672632 soap_transport_http: HTTP request: POST /dev/fwremotoweb/servidor.php HTTP/1.0 2005-07-27 13:59:27.672680 soap_transport_http: HTTP header: Host: = localhost 2005-07-27 13:59:27.672730 soap_transport_http: HTTP header: User-Agent: NuSOAP/0.7.1 (1.92) 2005-07-27 13:59:27.672775 soap_transport_http: HTTP header: = Content-Type: text/xml; charset=3DISO-8859-1 2005-07-27 13:59:27.672818 soap_transport_http: HTTP header: SOAPAction: = "" 2005-07-27 13:59:27.672862 soap_transport_http: HTTP header: = Content-Length: 538 2005-07-27 13:59:27.673910 soap_transport_http: wrote data to socket, = length =3D 716 2005-07-27 13:59:27.758537 soap_transport_http: read line of 17 bytes: HTTP/1.1 200 OK 2005-07-27 13:59:27.758642 soap_transport_http: read line of 27 bytes: Server: Microsoft-IIS/5.0 2005-07-27 13:59:27.758697 soap_transport_http: read line of 37 bytes: = Date: Wed, 27 Jul 2005 11:59:27 GMT 2005-07-27 13:59:27.758752 soap_transport_http: read line of 23 bytes: X-Powered-By: ASP.NET 2005-07-27 13:59:27.758809 soap_transport_http: read line of 25 bytes: X-Powered-By: PHP/4.3.4 2005-07-27 13:59:27.758864 soap_transport_http: read line of 30 bytes: Server: NuSOAP Server v0.7.1 2005-07-27 13:59:27.758918 soap_transport_http: read line of 36 bytes: X-SOAP-Server: NuSOAP/0.7.1 (1.92) 2005-07-27 13:59:27.758976 soap_transport_http: read line of 44 bytes: Content-Type: text/xml; charset=3DISO-8859-1 2005-07-27 13:59:27.759033 soap_transport_http: read line of 21 bytes: Content-Length: 556 2005-07-27 13:59:27.759124 soap_transport_http: read line of 2 bytes:=20 2005-07-27 13:59:27.759238 soap_transport_http: found end of headers = after length 262 2005-07-27 13:59:27.759427 soap_transport_http: want to read content of length 556 2005-07-27 13:59:27.759578 soap_transport_http: read buffer of 556 bytes 2005-07-27 13:59:27.759718 soap_transport_http: read body of length 556 2005-07-27 13:59:27.759809 soap_transport_http: received a total of 818 bytes of data from server 2005-07-27 13:59:27.759946 soap_transport_http: closed socket 2005-07-27 13:59:27.760033 soap_transport_http: No Content-Encoding = header 2005-07-27 13:59:27.760098 soap_transport_http: end of send() 2005-07-27 13:59:27.760183 soapclient: got response, length=3D556 type=3Dtext/xml; charset=3DISO-8859-1 2005-07-27 13:59:27.760234 soapclient: Entering parseResponse() for data = of length 556 and type text/xml; charset=3DISO-8859-1 2005-07-27 13:59:27.760285 soapclient: Got response encoding: ISO-8859-1 2005-07-27 13:59:27.760413 soapclient: Use encoding: ISO-8859-1 when creating soap_parser 2005-07-27 13:59:27.760818 soap_parser: Charset from HTTP Content-Type matches encoding from XML declaration 2005-07-27 13:59:27.760890 soap_parser: Entering soap_parser(), = length=3D556, encoding=3DISO-8859-1 2005-07-27 13:59:27.761058 soap_parser: XML error parsing SOAP payload = on line 2: xml declaration not at start of external entity 2005-07-27 13:59:27.761106 soap_parser: XML payload: Hello, Scott --- >8 ----- end output --------------- Any help would be really appreciate Thanks, Albert ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. = http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclick _______________________________________________ Nusoap-general mailing list Nus...@li... https://lists.sourceforge.net/lists/listinfo/nusoap-general |