NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Sorry, webservice newbie issue


Joined: 05 Mar 2004
Posts: 3
Location: Vancouver BC
Reply with quote
Smile Hello, I am trying to get a handle on nusoap, so far so good except I have a little error issue. I am trying to run an example and get the following error.

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource 'https://myserver/soap/client_example.php'. Line 1, Position 1

Error = Response not of type text/xml<xmp>POST /echoStringServer.php HTTP/1.0
^

is anyone familiar/know why I might be getting this error. I am running apache, and am running nusoap. the code is as follows.

//client_example.php
<?php

require('nusoap.php');

$myString = "hello my name is adam";

$paramters = array($myString);

$s = new soapclient('https://myserver/soap/echoStringServer.php');

$result = $s->call('echoString',$parameters);

if(!$err = $s->getError()){
echo 'Result = '.$result;
}else{
echo 'Error = '.$err;
}

echo '<xmp>'.$s->request.'</xmp>';
echo '<xmp>'.$s->response.'</xmp>';
?>

//server_example.php
<?php

require('nusoap.php');

$s->register('echoString');

function echoString($inputString);{
if(is_string($inputString)){
return $inputString;
}else{
return new soap_fault('Client','','The parameter to this service must be a string.');
}
}

$s->service($HTTP_RAW_POST_DATA);

?>

any help would be much apreciated Smile

Thankyou so much!

_________________
Adam Smile
View user's profileFind all posts by adam_easonSend private messageMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
Quote:
$s = new soapclient('https://myserver/soap/echoStringServer.php');

should be corrected to
Code:
$s = new soapclient('https://myserver/soap/echoStringServer.php?wsdl', 'wsdl');
View user's profileFind all posts by dmitriSend private messageVisit poster's website
hmmmm I didnt use wsdl in my example though


Joined: 05 Mar 2004
Posts: 3
Location: Vancouver BC
Reply with quote
thankyou so much for looking at my problem! Smile unfortunatly I didnt use wsdl in my example, that was what I was going to try as my next attempt at making this work. I tried your solution just for the heck of it though and got this error "operation echoString not present", which I sorta expected. I also corrected some syntactic errors in my code, first I forgot to declare an instance of the server object, which I did. and I removed a silly semicolon that creaped in to one of my if conditions. but the original error still persists "Response not of type text/xml". the link to it is
https://myserver/soap/client_example.php
thankyou so much for your help:-) I aprecciate it!!

_________________
Adam Smile
View user's profileFind all posts by adam_easonSend private messageMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
Adam,
if you use nusoap, with https://myserver/soap/client_example.php you get a user-friendly _DESCIPTION_ on the service, which certainly is not an XML.
Use https://myserver/soap/client_example.php?wsdl instead.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 05 Mar 2004
Posts: 3
Location: Vancouver BC
Reply with quote
Hi thankyou for helping, I have solved the issue. It turns out that I was pointing th soapclient to the wrong file, (in fact I was pointing it to the function sort of, so what I should have is
$s = new soapclient('https://myserver/soap/server_examle.php');

This solved it, the problem was that it was pointing to a file that didnt exist (hence the 404 lol).

As for the wsdl, I have done that as well today and that works fine to, the original example here would never work that way since I am using the other of the two service methods that does not use a wsdl. As you can see I dont register any complex types in my original example. but now I have both methods working just fine, once again thankyou so much for your help! Next time your in Vancouver, BC the beers are on me Smile

adam@webmedtechnology.com

_________________
Adam Smile
View user's profileFind all posts by adam_easonSend private messageMSN Messenger
Sorry, webservice newbie issue
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic