Skip to content

Commit

Permalink
Added SOAP submodule and templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferjiangkells committed Jun 20, 2024
1 parent 10cac22 commit a305f89
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
from spyne import rpc, Service, Unicode, ByteArray
from typing import Callable

from .models.notereaderresponse import Response


log = logging.getLogger(__name__)


class ICDSServices(Service):
class CDSServices(Service):
# Ugh WHY did Epic name it like this - I'm not sure if this is something you can change so I will keep it like this
def __init__(self, service_func: Callable) -> None:
super().__init__()
self._service_func = service_func
Expand All @@ -24,11 +27,11 @@ def __init__(self, service_func: Callable) -> None:
"document": "Document",
},
_wsdl_part_name="parameters",
# _returns=Response
_returns=Response,
# _faults=[ClientFault, ServerFault]
)
def ProcessDocument(ctx, sessionId, workType, organizationId, document):
def ProcessDocument(self, ctx, sessionId, workType, organizationId, document):
# will this work?
# response = ctx._service_func(document)
response = self._service_func(document)

pass
return response
8 changes: 8 additions & 0 deletions healthchain/service/soap/models/notereaderresponse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from spyne import ComplexModel
from spyne import Unicode, ByteArray


class NoteReaderResponse(ComplexModel):
__namespace__ = "urn:epic-com:Common.2013.Services"
Document = ByteArray
Error = Unicode
6 changes: 3 additions & 3 deletions healthchain/service/soap/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication

from .icdsservices import ICDSServices
from .cdsservices import CDSServices


def start_wsgi():
def start_wsgi(service_func):
application = Application(
[ICDSServices],
[CDSServices(service_func=service_func)],
name="ICDSServices",
tns="urn:epic-com:Common.2013.Services",
in_protocol=Soap11(validator="lxml"),
Expand Down
25 changes: 25 additions & 0 deletions healthchain/templates/soap_envelope.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:epic-com:Common.2013.Services"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<urn:ProcessDocument>
<!--Optional:-->
<!--type: string-->
<urn:SessionID>0000-0000-0000-0000</urn:SessionID>
<!--Optional:-->
<!--type: string-->
<urn:OrganizationID>UCLH</urn:OrganizationID>
<!--Optional:-->
<!--type: string-->
<urn:WorkType>2</urn:WorkType>
<!--Optional:-->
<!--type: base64Binary-->
<urn:Document>
<!-- Your XML content here -->
</urn:Document>
<!--urn:Document xsi:type="xsd:base64Binary">cid:666</urn:Document-->
</urn:ProcessDocument>
</soapenv:Body>
</soapenv:Envelope>
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
include = ["healthchain/templates/*"]

[project.urls]
"Homepage" = "https://dotimplement.github.io/HealthChain/"
Expand Down

0 comments on commit a305f89

Please sign in to comment.