3

It appears that Spyne sets the port in the WSDL definition according to how the service is accessed. For example, if I first (i.e., after a restart) access the service at http://domain.com/soap-api/, it will embed that URL in the WSDL. However, if I use https://www.domain.com/soap-api/, it will use that URL. Below is a segment of my WSDL:

<wsdl:service name="QuestService">
  <wsdl:port name="Application" binding="tns:Application">
    <soap:address location="https://app.stage.domain.com/soap-api/quest/"/>
  </wsdl:port>
</wsdl:service>
<wsdl:portType name="Application">
  <wsdl:operation name="ReceiveLabReqStatus" parameterOrder="ReceiveLabReqStatus">
  ...

When I use suds to access the server, suds doesn't seem to care which URL is in the definition and which URL I feed to suds. However, it appears that other clients do care and, if they're not using the right URL, will throw an error when the URLs don't match (at least I think that's what's happening).

So, my question: is there a way in Spyne to explicitly set the URL that's associated with the service?

Josh
  • 12,896
  • 4
  • 48
  • 49

1 Answers1

2

Yes, that's possible for 2.10.7 and up. I've fixed a bug related to that use-case and updated the documentation. Assuming you're using the WsgiApplication family of transports, here's how to do it:

wsgi_app = WsgiApplication(...)
wsgi_app.doc.wsdl11.build_interface_document("http://example.com")

Note that it's slightly different for the TwistedWebResource transport:

resource = TwistedWebResource(...)
resource.http_transport.doc.wsdl11.build_interface_document("http://example.com")

The links to the relevant parts of the documentation are:

http://spyne.io/docs/2.10/reference/server.html#module-spyne.server.wsgi http://spyne.io/docs/2.10/reference/server.html#module-spyne.server.twisted

Let me know how it works out for you.

Burak Arslan
  • 7,671
  • 2
  • 15
  • 24