Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  soap client python -> haskell (PICCA Frederic-Emmanuel)


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

Message: 1
Date: Fri, 23 Feb 2018 15:11:27 +0000
From: PICCA Frederic-Emmanuel
        <frederic-emmanuel.pi...@synchrotron-soleil.fr>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell" <beginners@haskell.org>
Subject: [Haskell-beginners] soap client python -> haskell
Message-ID:
        
<a2a20ec3b8560d408356cac2fc148e530107db0...@sun-dag3.synchrotron-soleil.fr>
        
Content-Type: text/plain; charset="us-ascii"

Hello, I try to reproduce this kind of python code into haskell


--- python -- whcih use the suds module

        cj = CookieJar()
        url_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

        transport = HttpAuthenticated(username=self.getIspybUserName(),
                                      password=self.getIspybPassWord())
        service_name = "ToolsForCollectionWebService"
        url = 
"http://195.221.10.20/ispyb-ws/ispybWS/ToolsForCollectionWebService?wsdl";

        collectionWSClient =  Client(url, transport=transport, timeout=3)
        collect_params = 
collectionWSClient.service.findDataCollection(dataCollectionId)---
---

Has you can see, I create a Transport whcih need an Authentification and also I 
need to use a cookieJar in oder to manage the connection.
The a soap client is instanciated from the url and with this transport.

Then the findDatacollection service is called.

Now I would like to reproduce this with Haskell and the soap package (or not if 
it is easier without)


I started like this

getDataCollection :: Transport -> Int -> IO Response
getDataCollection t i = invokeWS t url () body parser
    where
      url = 
"http://195.221.10.20/ispyb-ws/ispybWS/ToolsForCollectionWebService?wsdl"; -- 
?wsdl/findDatacollection"

      body = elementA "ToolsForCollectionWebService" [("xmlns", 
"findDataCollection")]
             $ element "dataCollectionID" i

      parser = StreamParser
               . flaxTag ""
               $ response

      response = Response
                 <$> flaxContent "filePath"


main :: IO ()
main = do
    -- Initial one-time preparations.
    transport <- initTransportWithM defaultManagerSettings url pure pure

    response <- getDataCollection transport dataCollectionID

    print response


And When I run this I have this message

autoprocessing-exe: HttpExceptionRequest Request {
  host                 = "xxx.xxx.xxx.xxx"
  port                 = 80
  secure               = False
  requestHeaders       = [("Content-Type","text/xml; 
charset=utf-8"),("SOAPAction","http://195.221.10.20/ispyb-ws/ispybWS/ToolsForCollectionWebService?wsdl";)]
  path                 = "/ispyb-ws/ispybWS/ToolsForCollectionWebService"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutMicro 15000000
  requestVersion       = HTTP/1.1
}
 TlsNotSupported

I know that I do not want the https, the url is  http and not https.

now I do not know how to modify this in order to deal with the authentification 
and the cookiesJar.

It seems here that proxy is Nothing so I hope thqht it will use the 
http[s]_proxy environment variable.


thanks for your help.


Frederic

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 116, Issue 3
*****************************************

Reply via email to