def test_soap12_fault_handling(self): stub = soap.Stub(location="empty") stub.SERVICE = soap.Service(name=None, targetNamespace=None, location="mock_location", schema=None, version=soap.SOAPVersion.SOAP12, methods=[]) e = assert_raises( core.SOAPError, lambda: stub._handle_response(None, None, SOAP12_ERROR_ROLE)) assert_equals('env:Sender', e.code) assert_equals('\nMessage does not have necessary info\n', e.message) assert_equals('http://gizmos.com/order', e.actor)
def test_soap11_fault_handling(self): stub = soap.Stub(location="empty") stub.SERVICE = soap.Service(name=None, targetNamespace=None, location="mock_location", schema=None, version=soap.SOAPVersion.SOAP11, methods=[]) e = assert_raises( core.SOAPError, lambda: stub._handle_response(None, None, SOAP11_ERROR_MESSAGE)) assert_equals('Result', e.code) assert_none(e.message) assert_equals('Resultset empty2.', e.actor)
def test_soap11_fault_handling(self): service = soap.Service( location='mock_location', methods=[], name=None, schemas=[], targetNamespace=None, version=soap.SOAPVersion.SOAP11, ) stub = soap.Stub(location='empty', service=service) with self.assertRaises(core.SOAPError) as cm: stub._handle_response(None, None, SOAP11_ERROR_MESSAGE) self.assertEqual('Result', cm.exception.code) self.assertIsNone(cm.exception.message) self.assertEqual('Resultset empty2.', cm.exception.actor)
def test_soap12_fault_handling(self): service = soap.Service( location='mock_location', methods=[], name=None, schemas=[], targetNamespace=None, version=soap.SOAPVersion.SOAP12, ) stub = soap.Stub(location='empty', service=service) with self.assertRaises(core.SOAPError) as cm: stub._handle_response(None, None, SOAP12_ERROR_ROLE) self.assertEqual('env:Sender', cm.exception.code) self.assertEqual('\nMessage does not have necessary info\n', cm.exception.message) self.assertEqual('http://gizmos.com/order', cm.exception.actor)
sp.prices.append(xsd.NIL) return sp get_stock_price_method = xsd.Method( function=get_stock_price, soapAction="http://code.google.com/p/soapfish/stock/get_stock_price", input="getStockPrice", output="stockPrice", operationName="GetStockPrice") SERVICE11 = soap.Service( name="StockService", targetNamespace= "http://code.google.com/p/soapfish/stock.wsdl", # WSDL targetNamespce version=soap.SOAPVersion.SOAP11, # The url were request should be send. location="http://127.0.0.1:8000/stock/soap11", schemas=[Schema], methods=[get_stock_price_method]) SERVICE12 = soap.Service( # WSDL targetNamespce name="StockService", targetNamespace="http://code.google.com/p/soapfish/stock.wsdl", version=soap.SOAPVersion.SOAP12, # The url where request should be sent. location="http://127.0.0.1:8000/stock/soap12", schemas=[Schema], methods=[get_stock_price_method])
soapAction=settings.RECEPTOR_HOST + 'ValideElServicio', input='ValideElServicio', inputPartName='parameters', output='ValideElServicioResponse', outputPartName='parameters', operationName='ValideElServicio', style='document', ) ############################################################################## # SOAP Service ResultadoDeSolicitudSoap_SERVICE = soap.Service( name='ResultadoDeSolicitudSoap', targetNamespace=settings.RECEPTOR_HOST, location='${scheme}://${host}/' + settings.WS_URL_NOTIFICATION, schemas=[Schema_c49e7], version=soap.SOAPVersion.SOAP12, methods=[NotifiqueLaRespuesta_method, ValideElServicio_method], ) ############################################################################## # NOTE: Uncomment the following lines to turn on dispatching for Django: # from soapfish.django_ import django_dispatcher # dispatcher = django_dispatcher(ResultadoDeSolicitudSoap_SERVICE) # NOTE: Put these lines in the urls.py for your project or application: # urlpatterns += patterns('', # (r'^wcfv2\/Bccr\.Sinpe\.Fva\.EntidadDePruebas\.Notificador\/ResultadoDeSolicitud\.asmx$', '<module>.dispatcher'), # )
'ops': xsd.Element('Ops'), 'status': xsd.Element('Status') }) PutOps_method = xsd.Method( soapAction='http://polaris.flightdataservices.com/ws/ops/PutOps', input='ops', # Pointer to Schema.elements inputPartName='body', output='status', # Pointer to Schema.elements outputPartName='body', operationName='PutOps') PutOpsPort_SERVICE = soap.Service( name='PutOpsPort', targetNamespace='http://flightdataservices.com/ops.wsdl', location='http://127.0.0.1:8088/mockPutOpsBinding', schema=Schema, version=soap.SOAPVersion.SOAP11, methods=[PutOps_method]) class PutOpsPortServiceStub(soap.Stub): SERVICE = PutOpsPort_SERVICE def PutOps(self, ops): # noqa return self.call('PutOps', ops) if __name__ == '__main__': from datetime import datetime stub = PutOpsPortServiceStub()
'TransactionCodeInvalid': xsd.Element(__name__ + '.SmevFault'), 'UnknownMessageType': xsd.Element(__name__ + '.Void') }, ) ############################################################################## # SOAP Service SMEVMessageExchangeEndpoint_SERVICE = soap.Service( name='SMEVMessageExchangeEndpoint', targetNamespace= 'urn://x-artefacts-smev-gov-ru/services/message-exchange/1.2', location='${scheme}://${host}/smev/v1.2/ws', schemas=[Schema_54195, Schema_5dace, Schema_a6a2c], version=soap.SOAPVersion.SOAP11, methods=[ GetResponse_method, GetStatus_method, Ack_method, GetRequest_method, SendResponse_method, SendRequest_method ], ) ############################################################################## # SOAP Service Stub class SMEVMessageExchangeEndpointServiceStub(soap.Stub): SERVICE = SMEVMessageExchangeEndpoint_SERVICE SCHEME = 'http' HOST = 'smev3-d.test.gosuslugi.ru:7500'
inputPartName='parameters', output='ValideElServicioResponse', outputPartName='parameters', operationName='ValideElServicio', style='document', ) ############################################################################## # SOAP Service ValidadorDeCertificadoSoap_SERVICE = soap.Service( name='ValidadorDeCertificadoSoap', targetNamespace=settings.FVA_HOST, location='${scheme}://${host}/' + settings.SERVICE_URLS['valida_certificado'], schemas=[Schema_c49e7], version=soap.SOAPVersion.SOAP12, methods=[ SoliciteLaValidacionDelCertificadoDeAutenticacion_method, ValideElServicio_method ], ) ############################################################################## # SOAP Service Stub class ValidadorDeCertificadoSoapServiceStub(soap.Stub): SERVICE = ValidadorDeCertificadoSoap_SERVICE SCHEME = settings.STUB_SCHEME HOST = settings.STUB_HOST
sp.prices.append(xsd.NIL) return sp get_stock_price_method = xsd.Method( function=get_stock_price, soapAction='http://code.google.com/p/soapfish/stock/get_stock_price', input='getStockPrice', output='stockPrice', operationName='GetStockPrice') SERVICE11 = soap.Service( name='StockService', targetNamespace= 'http://code.google.com/p/soapfish/stock.wsdl', # WSDL targetNamespce version=soap.SOAPVersion.SOAP11, # The url were request should be send. location='http://127.0.0.1:8000/stock/soap11', schemas=[Schema], methods=[get_stock_price_method]) SERVICE12 = soap.Service( # WSDL targetNamespce name='StockService', targetNamespace='http://code.google.com/p/soapfish/stock.wsdl', version=soap.SOAPVersion.SOAP12, # The url where request should be sent. location='http://127.0.0.1:8000/stock/soap12', schemas=[Schema], methods=[get_stock_price_method])
inputPartName='parameters', output='ElServicioEstaDisponibleResponse', outputPartName='parameters', operationName='ElServicioEstaDisponible', style='document', ) ############################################################################## # SOAP Service SelladorElectronicoConControlDeLlaveSoap_SERVICE = soap.Service( name='SelladorElectronicoConControlDeLlaveSoap', targetNamespace=settings.FVA_HOST, location='${scheme}://${host}/'+settings.SERVICE_URLS['sello'], schemas=[Schema_c49e7], version=soap.SOAPVersion.SOAP12, methods=[RecibaLaSolicitudDeSelladoElectronicoXmlEnvelopedCoFirma_method, RecibaLaSolicitudDeSelladoElectronicoXmlEnvelopedContraFirma_method, RecibaLaSolicitudDeSelladoElectronicoMSOffice_method, RecibaLaSolicitudDeSelladoElectronicoPdf_method, RecibaLaSolicitudDeSelladoElectronicoOdf_method, ElServicioEstaDisponible_method], ) ############################################################################## # SOAP Service Stub class SelladorElectronicoConControlDeLlaveSoapServiceStub(soap.Stub): SERVICE = SelladorElectronicoConControlDeLlaveSoap_SERVICE SCHEME = settings.STUB_SCHEME HOST = settings.STUB_HOST def RecibaLaSolicitudDeSelladoElectronicoXmlEnvelopedCoFirma(self, RecibaLaSolicitudDeSelladoElectronicoXmlEnvelopedCoFirma, header=None):
soapAction='{}/soap/user_registry/get_user_details'.format(settings.FQDN), input='getUser', # inputPartName='parameters', output='User', # outputPartName='parameters', operationName='GetUser', # style='document' ) UserRegistrySoapService = soap.Service( name = 'UserRegistrySoapPort', targetNamespace='{}/soap/user_registry.wsdl'.format(settings.FQDN), location='{}/soap/user_registry'.format(settings.FQDN), # where request should be sent. schemas=[Schema_User, # Schema_UserNotFoundException, # Schema_SystemException ], # version=soap.SOAPVersion.SOAP11, methods=[get_user_details_method], ) if __name__ == '__main__': user = User() user.Username = '******' # export to xml xml = user.xml('user_registry').decode() print(xml)
input='ValideElServicio', inputPartName='parameters', output='ValideElServicioResponse', outputPartName='parameters', operationName='ValideElServicio', style='document', ) ############################################################################## # SOAP Service VerificadorSoap_SERVICE = soap.Service( name='VerificadorSoap', targetNamespace=settings.FVA_HOST, location='${scheme}://${host}/' + settings.SERVICE_URLS['verifica'], schemas=[Schema_c49e7], version=soap.SOAPVersion.SOAP12, methods=[ ExisteUnaSolicitudDeFirmaCompleta_method, ValideElServicio_method ], ) ############################################################################## # SOAP Service Stub class VerificadorSoapServiceStub(soap.Stub): SERVICE = VerificadorSoap_SERVICE SCHEME = settings.STUB_SCHEME HOST = settings.STUB_HOST def ExisteUnaSolicitudDeFirmaCompleta(self,
inputPartName='parameters', output='ValideElServicioResponse', outputPartName='parameters', operationName='ValideElServicio', style='document', ) ############################################################################## # SOAP Service AutenticadorSoap_SERVICE = soap.Service( name='AutenticadorSoap', targetNamespace=settings.FVA_HOST, location='${scheme}://${host}/'+settings.SERVICE_URLS['autenticacion'], schemas=[Schema_c49e7], version=soap.SOAPVersion.SOAP12, methods=[RecibaLaSolicitudDeAutenticacion_method, ValideElServicio_method], ) ############################################################################## # SOAP Service Stub class AutenticadorSoapServiceStub(soap.Stub): SERVICE = AutenticadorSoap_SERVICE SCHEME = settings.STUB_SCHEME HOST = settings.STUB_HOST def RecibaLaSolicitudDeAutenticacion(self, RecibaLaSolicitudDeAutenticacion, header=None):
output='ValideElServicioResponse', outputPartName='parameters', operationName='ValideElServicio', style='document', ) ############################################################################## # SOAP Service ValidadorDeDocumentoSoap_SERVICE = soap.Service( name='ValidadorDeDocumentoSoap', targetNamespace=settings.FVA_HOST, location='${scheme}://${host}/' + settings.SERVICE_URLS['valida_documento'], schemas=[Schema_c49e7], version=soap.SOAPVersion.SOAP12, methods=[ ValideElDocumentoXmlEnvelopedCoFirma_method, ValideElDocumentoXmlEnvelopedContraFirma_method, ValideElDocumentoMSOffice_method, ValideElDocumentoOdf_method, ValideElDocumentoPdf_method, ValideElServicio_method ], ) ############################################################################## # SOAP Service Stub class ValidadorDeDocumentoSoapServiceStub(soap.Stub): SERVICE = ValidadorDeDocumentoSoap_SERVICE SCHEME = settings.STUB_SCHEME HOST = settings.STUB_HOST
inputPartName='parameters', output='getUserDetailsResponse', outputPartName='parameters', operationName='getUserDetails', style='document', ) ############################################################################## # SOAP Service UserRegistrySoapPort_SERVICE = soap.Service( name='UserRegistrySoapPort', targetNamespace='http://it/cineca/pda/ws/anagrafe', location='${scheme}://${host}/services/UserRegistry', schemas=[ Schema_e8a30, Schema_d14fd, Schema_1e9f6, Schema_0d16e, Schema_65f1f, Schema_105a2, Schema_e6ea1 ], version=soap.SOAPVersion.SOAP11, methods=[getUserProperties_method, getUserDetails_method], ) ############################################################################## # NOTE: Uncomment the following lines to turn on dispatching for Django: # from soapfish.django_ import django_dispatcher # dispatcher = django_dispatcher(UserRegistrySoapPort_SERVICE) # NOTE: Put these lines in the urls.py for your project or application: # urlpatterns += patterns('', # (r'^services\/UserRegistry$', '<module>.dispatcher'),
input='RequestInterface', inputPartName='parameters', output='ResponseInterface', outputPartName='parameters', operationName='requestMessage', ) ############################################################################## # SOAP Service HelloServicePort_SERVICE = soap.Service( name='HelloServicePort', targetNamespace='http://example.com/HelloWorld', # FIXME 自分の設定へと修正 location='http://localhost/hello', # location='${scheme}://${host}/hello', schemas=[Schema_ab251], version=soap.SOAPVersion.SOAP11, methods=[requestMessage_method], ) ############################################################################## # NOTE: Uncomment the following lines to turn on dispatching for Django: # from soapfish.django_ import django_dispatcher # dispatcher = django_dispatcher(HelloServicePort_SERVICE) # NOTE: Put these lines in the urls.py for your project or application: # urlpatterns += patterns('', # (r'^hello$', '<module>.dispatcher'),
fid = user.id users = Users() for i in range(0, 10): uu = User(name="Sandro - {}".format(i), city="São Paulo", email="*****@*****.**", mobile="11991504030", address="Rua xpto", cep="013312000", neighborhood="jd america", numb="11") users.user.append(uu) # user.nnn = 'dasasd' return users get_user_method = xsd.Method(function=get_user, soapAction="http://next.me/user/get_user", input="getUser", output="users", operationName="http://next.me/user") SERVICE = soap.Service( name="NextUser", targetNamespace="http://next.me/user.wsdl", # WSDL targetNamespce version=soap.SOAPVersion.SOAP11, # location="http://test-api.next.me:5000/user", location="http://127.0.0.1:5000/user", schemas=[Schema], methods=[get_user_method])