4

I have written a Spyne web service via Django. I'm simulating some application, so I need to implement exact interfaces. I have following port definition in the original application:

< wsdl:service name = "SendSmsWebServiceImplService" >
  < wsdl:port binding = "tns:SendSmsWebServiceImplServiceSoapBinding" name = "SendSmsWebServiceImplPort" >
      < soap:address location = "http://192.168.100.31:8181/smsgateway/sendsms" / >
  < / wsdl:port >
< / wsdl:service >

And this is what I have in the simulator:

< wsdl:service name = "SendSmsWebServiceImplService" >
  < wsdl:port name = "SendSmsWebService" binding = "tns:SendSmsWebService" >
      < soap:address location = "http://127.0.0.1:5000/smsgateway/services/SendSms/" / >
  < / wsdl:port >
< / wsdl:service >

I'm trying to set name and binding for the port. I'm using module spyne.application.Application to implement main application. What is the way to set these properties?

Zeinab Abbasimazar
  • 9,835
  • 23
  • 82
  • 131

1 Answers1

1

To change the name of port and binding, you can set the "name" attribute of the Application class like the following :

   app = Application(services=[YourService],
      name='serviceName',
      tns='your.tns',
      in_protocol=Soap11(validator='lxml'),
      out_protocol=Soap11()
   )

but be aware that if you have more than one service exposed in the "services" param spyne will assign them all the same port/binding name. This can cause problems if you try to consume the service with axis.

If this is your case, you will probably need more instances of the spyne.application.Application class.

There is another way to rename these properties. You just need to save the wsdl as xml file, rename all the properties you want and then publish the xml at your web server in place of the generated wsdl. Feeding this xml file (with complete url) to your web service client should work just fine.

Hope it helps.