Python calls the WebService interface

Source: Internet
Author: User
Tags wsdl

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.