NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
soap_parser: XML error parsing SOAP payload on line 1: Empty


Joined: 22 Aug 2006
Posts: 7
Reply with quote
Hello all,

While calling the below web service , the response status is ok. But I am getting the error message soap_parser: XML error parsing SOAP payload on line 1: Empty document
I have enclosed the final part of the response running in debug mode. In debug mode, the response is getting printed. But it is not returned from the web service.

Can anyone help me in this regard?

Thanks in advance
Pushparaj

<?php
require_once('nusoap.php');
$objServer = new soap_server();

// Configuring the wsdl for this service
//$objServer->configureWSDL("OOFS_ADMIN","urn:OOFS_ADMIN");

$objServer->configureWSDL("OOFS_ADMIN","http://soapinterop.org/");
$objServer->wsdl->schemaTargetNamespace = 'http://soapinterop.org/xsd/';
/* ContentType Creation */
$objServer->wsdl->addComplexType('ContentType',
'complexType',
'struct',
'all',
'',
array(
'content_type_code' => array('name'=>'content_type_code','type'=>'xsd:int'),
'content_type_name' => array('name'=>'content_type_name','type'=>'xsd:string'),
'content_type_description' => array('name'=>'content_type_description','type'=>'xsd:string'),
'content_type_status' => array('name'=>'content_type_status','type'=>'xsd:string')
)
);

/* ContentType array creation */

$objServer->wsdl->addComplexType('ContentTypeArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:ContentType[]')
),
'tns:ContentType'
);
$objServer->register('listContentType',
array(),
array('return'=>'tns:ContentTypeArray'),
'http://soapinterop.org/'
);

function listContentType(){
try{
$objContentType = new imp_content_type();
return array($objContentType->listContentType());
}
catch(Exception $e) {
return array();
}
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$objServer->service($HTTP_RAW_POST_DATA);
?>




2006-08-22 20:38:23.949937 soap_transport_http: read line of 17 bytes: HTTP/1.1 200 OK
2006-08-22 20:38:23.950164 soap_transport_http: read line of 37 bytes: Date: Tue, 22 Aug 2006 15:08:23 GMT
2006-08-22 20:38:23.950303 soap_transport_http: read line of 33 bytes: Server: Apache/2.0.52 (Red Hat)
2006-08-22 20:38:23.950443 soap_transport_http: read line of 25 bytes: X-Powered-By: PHP/5.1.1
2006-08-22 20:38:23.950581 soap_transport_http: read line of 36 bytes: X-SOAP-Server: NuSOAP/0.7.2 (1.94)
2006-08-22 20:38:23.950718 soap_transport_http: read line of 22 bytes: Content-Length: 3285
2006-08-22 20:38:23.950862 soap_transport_http: read line of 19 bytes: Connection: close
2006-08-22 20:38:23.951003 soap_transport_http: read line of 44 bytes: Content-Type: text/xml; charset=ISO-8859-1
2006-08-22 20:38:23.951141 soap_transport_http: read line of 2 bytes:
2006-08-22 20:38:23.951344 soap_transport_http: found end of headers after length 235
2006-08-22 20:38:23.951568 soap_transport_http: want to read content of length 3285
2006-08-22 20:38:23.951715 soap_transport_http: read buffer of 3285 bytes
2006-08-22 20:38:23.951859 soap_transport_http: read to EOF
2006-08-22 20:38:23.951986 soap_transport_http: read body of length 3285
2006-08-22 20:38:23.952113 soap_transport_http: received a total of 3520 bytes of data from server
2006-08-22 20:38:23.952298 soap_transport_http: closed socket
2006-08-22 20:38:23.952447 soap_transport_http: No Content-Encoding header
2006-08-22 20:38:23.952574 soap_transport_http: end of send()
2006-08-22 20:38:23.952738 nusoapclient: got response, length=3285 type=text/xml; charset=ISO-8859-1
2006-08-22 20:38:23.952875 nusoapclient: Entering parseResponse() for data of length 3285 and type text/xml; charset=ISO-8859-1
2006-08-22 20:38:23.953008 nusoapclient: Got response encoding: ISO-8859-1
2006-08-22 20:38:23.953152 nusoapclient: Use encoding: ISO-8859-1 when creating soap_parser
2006-08-22 20:38:23.953390 soap_parser: Charset from HTTP Content-Type matches encoding from XML declaration
2006-08-22 20:38:23.953519 soap_parser: Entering soap_parser(), length=3285, encoding=ISO-8859-1
2006-08-22 20:38:23.953699 soap_parser: XML error parsing SOAP payload on line 1: Empty document
2006-08-22 20:38:23.953837 soap_parser: XML payload:
Array
(
[0] => Array
(
[content_type_code] => 1
[content_type_name] => asdasd
[content_type_description] => Portable document format
[content_type_status] => ACTIVE
)

[1] => Array
(
[content_type_code] => 2
[content_type_name] => pdf
[content_type_description] => Portable document format
[content_type_status] => INACTIVE
)

[2] => Array
(
[content_type_code] => 3
[content_type_name] => avi
[content_type_description] => Audio video interface
[content_type_status] => INACTIVE
)

[3] => Array
(
[content_type_code] => 4
[content_type_name] => sdsd
[content_type_description] => Asasas
[content_type_status] => INACTIVE
)

[4] => Array
(
[content_type_code] => 5
[content_type_name] => fsdfsd
[content_type_description] => Asasas
[content_type_status] => INACTIVE
)

[5] => Array
(
[content_type_code] => 6
[content_type_name] => asdsadd
[content_type_description] => Asasas
[content_type_status] => INACTIVE
)

[6] => Array
(
[content_type_code] => 7
[content_type_name] => sadasd
[content_type_description] => Asasas
[content_type_status] => INACTIVE
)

[7] => Array
(
[content_type_code] => 8
[content_type_name] => saddsasd
[content_type_description] => Asasas
[content_type_status] => INACTIVE
)

[8] => Array
(
[content_type_code] => 9
[content_type_name] => sdasff
[content_type_description] => Asasas
[content_type_status] => INACTIVE
)

[9] => Array
(
[content_type_code] => 10
[content_type_name] => sddsff
[content_type_description] => Asasas
[content_type_status] => INACTIVE
)

[10] => Array
(
[content_type_code] => 11
[content_type_name] => mpeg
[content_type_description] => Audio video interface
[content_type_status] => INACTIVE
)

[11] => Array
(
[content_type_code] => 12
[content_type_name] => mpeg1
[content_type_description] => Audio video interface
[content_type_status] => INACTIVE
)

)
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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="http://soapinterop.org/"><SOAP-ENV:Body><ns1:listContentTypeResponse xmlns:ns1="http://tempuri_org"><return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:ContentType[1]"><item xsi:nil="true" xsi:type="tns:ContentType"/></return></ns1:listContentTypeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
2006-08-22 20:38:23.954031 nusoapclient: Error: XML error parsing SOAP payload on line 1: Empty document
View user's profileFind all posts by pushparajSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
sure, what client read from the server is bogus data (looks like var_dump) but not a true XML payload.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 22 Aug 2006
Posts: 7
Reply with quote
Thanks . I got it
Very Happy
View user's profileFind all posts by pushparajSend private message


Joined: 16 Oct 2006
Posts: 1
Reply with quote
I am having the same problem when attempting to return an attachment from the server. However, it appears that the attachment is embedded in the response. Can you please explain to me how you figured out your problem?

Thanks!
View user's profileFind all posts by lrsukupSend private messageYahoo Messenger


Joined: 22 Aug 2006
Posts: 7
Reply with quote
Are you using any print_r, var_dump statements in stead of return statements? If so remove those and check. If not can you place the code here?

Regards
Pushparaj.
View user's profileFind all posts by pushparajSend private message


Joined: 26 Jul 2007
Posts: 14
Reply with quote
lrsukup wrote:
I am having the same problem when attempting to return an attachment from the server. However, it appears that the attachment is embedded in the response. Can you please explain to me how you figured out your problem?

Thanks!


Has anyone an update to this? I am having the same problem. When I didn't have an attachment it worked fine, but once I put in an attachment I received the same error as the one above.

-Addison
View user's profileFind all posts by addisonpSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
did you check the XML payload the server returned when attachment was supplied?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 26 Jul 2007
Posts: 14
Reply with quote
dmitri wrote:
did you check the XML payload the server returned when attachment was supplied?


first off thanks for the quick response, I've checked that the data is returned, here's an excerpt:

Code:
Response
HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Thu, 09 Aug 2007 22:46:33 GMT
Server: Apache/2.2.4 (Fedora)
X-Powered-By: PHP/5.1.6
X-SOAP-Server: NuSOAP/0.7.2 (1.94)
Content-Length: 17603
Connection: close
Content-Type: multipart/related; type=text/xml; boundary="=_2adfedd831a1be83876793005e68bd55"

--=_2adfedd831a1be83876793005e68bd55
Content-Transfer-Encoding: 8bit
Content-Type: text/xml; charset="ISO-8859-1"

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle...


Here's some more background information:

Code:
$server->register('payload',            // method name
   array('TDLRequest'    => 'tns:TDLRequest'),           // input parameters
   array('return'    => 'tns:Sites'),              // output parameters
   'urn:payload',                        // namespace
   'urn:TDLrequest#TDLRequest',             // soapaction
   'rpc',                                     // style
   'encoded',                                 // use
   'Return the sites information per request' // documentation
);


and Sites does not include the attached document type, is that the problem?

Code:
$server->wsdl->addComplexType(
   'Sites',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'Sites'   => array('name' => 'Sites'   , 'type'=> 'tns:Site', 'maxOccurs'=>'unbounded'),
   )
);   

$server->wsdl->addComplexType(
   'SiteObject',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'Locale'         => array('name' => 'Locale'         , 'type'=> 'tns:Locale'),
      'Screen'         => array('name' => 'Screen'         , 'type'=> 'tns:Screen', 'maxOccurs'=>'unbounded'),
      'Trusted_Device'   => array('name' => 'Trusted_Device'   , 'type'=> 'tns:Trusted_Device','maxOccurs'=>'unbounded'),
   )
);



If so how do you write into the $server->register section to take into account you are returning more than just the 'Sites" type?[/code]
View user's profileFind all posts by addisonpSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
I'm not familiar with what you're trying to accomplish. I did never code attachments over nusoap and therefore can hardly suggest what to do in terms of php code. But what may make good sense is to check the returned payload. Payload is whatever starts after the headers or <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope... in your sample. You can save it into a file and use any XML validator available to see where the error is.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
btw, I just noticed that the server responce you listed is multipart. Are you using nusoapmime? As far as I see it is the only file in nusoap package that knows of multipart.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 26 Jul 2007
Posts: 14
Reply with quote
yup here's what I'm using:

$server = new nusoapservermime;


and it works fine if I don't use attachments, it's just when attachments are put in, it goes haywire, I can see the server return the results information and the attachment but it's getting the Error

Code:
XML error parsing SOAP payload on line 1: Empty document


So what i'm trying to accomplish is to return two things, one is the attached document, and the other is the normal soap encoded xml data
View user's profileFind all posts by addisonpSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
looks like it fails to find the xml payload. What's the client code you use?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
soap_parser: XML error parsing SOAP payload on line 1: Empty
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 2  

  
  
 Reply to topic