problem with Strings Array as input. I get the value "[u'string']"

Asked by Mr T

Having this simple web service code:

 @ladonize([PORTABLE_STRING], rtype=str)
 def simplest(self, p1, **exports):
  print "Received:"+str(p1)
  return str(p1)

will return and print "[u'string']", instead of what it is suposed to return & print.
I'm using taverna workbench as WS client, serving the WS with SOAP11

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

In case it is useful, I've captured the soap message. It is (more or less) sth like this:
<soapenv:Envelope.xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
 <ns1:simplest.soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:BubuService">
  <p2.soapenc:arrayType="xsd:string[2]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:Array">
   <string>1</string>
   <string>2</string>
  </p2>
 </ns1:simplest>
</soapenv:Body>
</soapenv:Envelope>

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

I found a solution for this,
modifying the soap11.py file.
to pre-edit the soap message received in order to be compliant with the parser:
Something like (new lines with "+"):

class SOAP11RequestHandler(BaseRequestHandler):

 def parse_request(self,soap_body,sinfo,encoding):
+ # This lines are for fixing bug when parsing Tavernas SOAP messages:
+ soap_body=soap_body.replace('<string>','<item xsi:type="ns3:string">')
+ soap_body=soap_body.replace('</string>','</item>')

  parser = make_parser()
  ch = SOAP11ContentHandler(parser)
  parser.setContentHandler(ch)
  inpsrc = InputSource()
  inpsrc.setByteStream(BytesIO(soap_body))
  parser.parse(inpsrc)
  return ch.req_dict

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.