【问题标题】:ASIC BRS SOAP API service Binding BugASIC BRS SOAP API 服务绑定错误
【发布时间】:2020-12-31 08:22:00
【问题描述】:

我正在为客户打造 ASIC(澳大利亚)商业登记 (BRS) 应用程序。 UAT 中的 ASIC SOAP API 在soap 响应中的服务绑定中有一个错误。它返回一个不正确的 URL。

【问题讨论】:

    标签: python django soap


    【解决方案1】:

    以下代码解决了这个问题:

    def your_wsdl(DocumentHeader, DocumentBody):
    
        """Call ASIC using the SOAP API listin the BRS document
        :param DocumentHeader: dictonary with the fields as specifed in BRS documentation 
        :param DocumentBody: dictonary with the fields as specifed in BRS documentation
        """
    
    
    wsdl = Config.objects.get(code="ASIC_API").value + str('?WSDL')
    wsdl_session = Session()
    wsdl_session.auth = HTTPBasicAuth(Config.objects.get(code="ASIC_API_ID").value, Config.objects.get(code="ASIC_API_PASS").value)
    transport = Transport(session=wsdl_session)
    client = Client(wsdl, transport=transport)
    
    ##get_service2 fixes the incorrect binding response in BRS UAT
    service = get_service2(client=client)
    
    
    soap_response={}
    with client.settings(raw_response=True, xsd_ignore_sequence_order=False):
        try:
            soap_response= service.externalInitiat
        except Exception as e:
            soap_response = { 'status_code': 500 }            
            
    

    def get_service2(客户端):

        """Fix for the incorrect Service Binding
        :param client: soap client object
        """
    
    service_binding = client.service._binding.name
    service_address = Config.objects.get(code="ASIC_API_url").value
    return client.create_service(service_binding, service_address)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-22
      • 1970-01-01
      • 2018-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多