can't use inputs with several lines in SOAP services

Asked by Mr T

Let's say I have a WS such as this:

@ladonize(unicode, rtype=unicode)
def upload_file(self, contents):
 print "received: "+contents
 return contents

When I acess the service, passing something that contains some new lines (\n), they disappear.

Example:
Input:
   "This is
   a two lines string"
will result in the WS printing:
    "received: This isa two lines string"

I've also tried with carriage returns instead. And also I've tried to use str instead of unicode and PORTABLE_STRING as well. So far, unsucessfully.

I'm using Taverna as a client( a GUI for managing workflows compatible with WSDL services). I was using spyne previously but we wanted to move to ladon. With spyne, this issue didn't happen. (therefore, I don't think it is a matter of the client)

For the record, I'm serving it with uwsgi server.

Any clues to what is happening?

Question information

Language:
English Edit question
Status:
Expired
For:
ladon Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Mr T (mrjaspe) said :
#1

I've just confirm that it is not an issue with the client. I have tested it with suds and the same thing happens
I've also tried to test it using JSON. It works ok with JSON, but we need SOAP.

Revision history for this message
Mr T (mrjaspe) said :
#2

I've just found a "solution", although I don't know whether it is correct. In soap11.py I've found the function where data is collected (characters(self,content):) . Here, a distinction is made for when the parser is in or out the "CDATA" section. When not in the section, the content is striped. That's what was happening. I just removed the ".strip()" leaving the code like this:

def characters(self,content):
 print "aqui: content="+str(content)
 # Collect data continuosly, reset every time a new element is entered.
 # If it has been detected that the parser is in a CDATA Section all content
 # will be collected as is (raw) otherwise content is stripped.
 if self.state == self.ARGS_IN or self.cur_id_val:
  if self.in_cdata:
   # in CDATA Section
   self.pickup_content += content
  else:
   self.pickup_content += content

Of course, the "if" is now useless.
Btw, I don't know whether this is a bug or an intended feature... and whether my fix will break sth else.

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Mr T (mrjaspe) said :
#4

Did I do right? Is it a bug?

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Mr T (mrjaspe) said :
#6

eo?

Revision history for this message
Launchpad Janitor (janitor) said :
#7

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Mr T (mrjaspe) said :
#8

...

Revision history for this message
Launchpad Janitor (janitor) said :
#9

This question was expired because it remained in the 'Open' state without activity for the last 15 days.