Thank you. Very useful. On Wednesday, 19 June 2013 11:27:34 UTC-5, Mariano Reingart wrote: > > This is the original webservice: > > https://wswhomo.afip.gov.ar/wsfev1/service.asmx?WSDL > > And this is the "simulator" made with web2py: > > http://www.sistemasagiles.com.ar/simulador/wsfev1/call/soap > > Attached is the web2py sample controller > > Steps: > > 1. Analyse the original web service description: > client = SoapClient(wsdl=" > https://wswhomo.afip.gov.ar/wsfev1/service.asmx?WSDL") > > 2. Extract the input and output structures > client.services['Service']['ports']['ServiceSoap12']['operations']['FECAESolicitar']['input'] > > > client.services['Service']['ports']['ServiceSoap12']['operations']['FECAESolicitar']['output'] > > > The returned structures are {'FECAESolicitar': *{u'Auth': *{u'Token': > <type 'unicode'>, u'Sign': <type 'unicode'>, u'Cuit': <type 'long'>}*, > u'FeCAEReq': *{u'FeCabReq': *{u'CantReg': <type 'int'>, ... , you need > to do some clean up (for example, replace <type 'unicode'> with just > unicode, remove the * that marks an ordered dict, etc.) > > 3. Decorate your function accordingly > @service.soap('FECAESolicitar', > returns={'FECAESolicitarResult': {...}, > args={ > 'Auth': {'Token': str, 'Sign': str, 'Cuit': str}, > ...} > > 4. Modify the original WSDL with the web2py location and test > > To go further, you may need to adjust some xml parameters like the > namepaces, prefixes, and so on, to reproduce the exact behaviour of > the original webservice, it may be tricky but it should be doable. > > Best regards. > > Mariano Reingart > http://www.sistemasagiles.com.ar > http://reingart.blogspot.com > > > On Wed, Jun 19, 2013 at 8:17 AM, Massimo Di Pierro > <massimo....@gmail.com <javascript:>> wrote: > > Can you provide a simple example? > > > > > > On Wednesday, 19 June 2013 04:18:16 UTC-5, Mariano Reingart wrote: > >> > >> Do you have the wsdl file? > >> > >> It would be relatively possible to create a server from the WSDL if it > >> is not too complicated (at least using pysimplesoap) > >> > >> The trick would be read and parse the WSDL with the soap client to see > >> the expected structures. > >> You can se the client.services attribute, it contains the parsed wsdl > >> and you can even manipulate it: > >> http://code.google.com/p/pysimplesoap/wiki/SoapClient > >> The same structure can be used to expose the method (controllers' > >> function in web2py), as the serialization mechanism is the same. > >> > >> I did this once to simulate a production webservice, and there is no > >> need to generate code or clasess (again, at least using pysimplesoap), > >> it is just formating the xml as desired using python data types > >> (mainly dicts and lists, for most webservices) > >> > >> Best regards, > >> > >> Mariano Reingart > >> http://www.sistemasagiles.com.ar > >> http://reingart.blogspot.com > >> > >> > >> On Tue, Jun 18, 2013 at 4:33 AM, Massimo Di Pierro > >> <massimo....@gmail.com> wrote: > >> > If you find a solution to your problem let me know. I have a similar > >> > problem. The process usually is [create server] -> [generate wsdl] -> > >> > [create client from wsdl]. I would like to see an example ot [create > >> > server > >> > from wsdl]. > >> > > >> > > >> > On Tuesday, 18 June 2013 01:55:40 UTC-5, Barry Bridges wrote: > >> >> > >> >> Hi Massimo, > >> >> Your correct in that I need to create a server that is complaint > with > >> >> someone else's WSDL. I have to full spec of the API, but need to > >> >> provide > >> >> that to the client devices. If I use pysimplesoap, the WSDL is > created > >> >> for > >> >> me but is not totally compliant/formted to the customers spec. So > the > >> >> issue > >> >> is can I serve up my WSDL file rather than the interally generated > one. > >> >> > >> >> You'll have to forgive my terminology but I'm and embedded engineer > not > >> >> a > >> >> web developer so it's all a little new to me. > >> >> > >> >> On Tuesday, 18 June 2013 06:22:55 UTC+1, Massimo Di Pierro wrote: > >> >>> > >> >>> If you have WSDL service you can connect to is using suds (pip > insall > >> >>> suds) > >> >>> > >> >>> from suds.client import Client > >> >>> client = Client(wsdl_service) > >> >>> result = client.service.function(input) > >> >>> > >> >>> here function is a service which must provided by in WSLD. > >> >>> > >> >>> I understand you have the opposite problem. Create a server that is > >> >>> compliant with given WSDL. Actually I need to do same for a project > >> >>> and I > >> >>> have been unable to. I am not sure this is logically possible > because > >> >>> the > >> >>> WSDL contains enough info to generate the service. > >> >>> > >> >>> > >> >>> On Monday, 17 June 2013 08:44:06 UTC-5, Barry Bridges wrote: > >> >>>> > >> >>>> > >> >>>> Hi all, > >> >>>> I'm trying to create a SOAP server which uses a local wsdl file > >> >>>> supplied > >> >>>> by a third party. How can I use this within Web2py > >> >>>> > >> >>>> > >> >>>> Thanks > >> >>>> Barry > >> > > >> > -- > >> > > >> > --- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "web2py-users" group. > >> > To unsubscribe from this group and stop receiving emails from it, > send > >> > an > >> > email to web2py+un...@googlegroups.com. > >> > For more options, visit https://groups.google.com/groups/opt_out. > >> > > >> > > > > > -- > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "web2py-users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to web2py+un...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > >
-- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.