Python calls the WebService interface, where we use the SUDS package
If there is no direct cmd command to install the subs package
Pip Suds Install
Successful installation will prompt successful words.
------------------------------
First import the Package
First look at what types and methods webservice provide, then we know how to invoke, which parameters to pass.
From suds.client import clientfrom Suds.transport.https import httpauthenticated #webservice需要安全难证t = httpauthenticated (Username= ' Rfcatuser ', password= ' q123456 ') #安全验证所需用户, password url = "http://hqxt1.sinopec.com:50000/dir/wsdl?p=sa/ 65BD52BD76DE381DAF15736A37D13AB1 "test = Client (url,transport=t) Print test
The following starts the invocation of the arguments:
#coding =utf-8# Import Package from suds.client import clientfrom Suds.transport.https import httpauthenticated #webservice需要安全难证 # Secure authentication, get service services T = httpauthenticated (username= ' rfcatuser ', password= ' q123456 ') #安全验证所需用户, password URL = "/http/ HQXT1.SINOPEC.COM:50000/DIR/WSDL?P=SA/65BD52BD76DE381DAF15736A37D13AB1 "test = Client (url,transport=t) Print test # Create an instance with Test.factory.create request=test.factory.create (' dt_ipm_send_psbudget_req ') Ipm_msg_head = Test.factory.create (' msg_head ') Request.is_msg_head = Ipm_msg_headipm_msg_head. Sendtime = ' 20170421102908 ' Ipm_msg_head. Reciver = ' ECC ' Ipm_msg_head. SENDER = ' IPM ' Ipm_msg_head. interface_id = ' project_create ' Ipm_msg_head. Spras = Noneipm_msg_head. OPERATOR = Noneipm_msg_head. system_id = Noneipm_msg_head. proxy_id = Noneipm_msg_head. GUID = Noneipm_msg_head. Mandt = Nonerequest.iv_bukrs = "X060" Request.iv_testrun = "X" request.it_psbudget=[] #用test. Service.xxxxx to Invoke Method m= Test.service.SI_IPM_SEND_PSBUDGET_REQ_A_OUT (Request) Print Ipm_msg_headprint request
Python calls the WebService interface