Skip to content Skip to sidebar Skip to footer

How To Post Complex Type To Wcf Using Python's Requests?

I am trying to query a WCF web service using Python's request package. I created a very simple web service in WCF, following the default VS template: [ServiceContract] public inter

Solution 1:

You need to send JSON in the POST body, but you are attaching it to the query parameters instead.

Use data instead, and only encode the outer structure:

result=req.post(wsAddr+methodPath,
                data=json.dumps({'composite': cType}),
                headers=headers)

If you encoded cType, you'd send a JSON-encoded string containing another JSON-encoded string, which in turn contains your cType dictionary.

Post a Comment for "How To Post Complex Type To Wcf Using Python's Requests?"