获取ARERR 149必须在控制记录中提供用户名

I have a SOAP url , while running the url through browser I am getting a wsdl response.But when I am trying to call a method in the response using the required parameter list, and it is showing "ARERR [149] A user name must be supplied in the control record".I tried using PHP as well as python but I am getting the same error.

I searched this error and got the information like this : "The name field of the ARControlStruct parameter is empty. Supply the name of an AR System user in this field.".But nowhere I saw how to supply the user name parameter.

I got the solution for this problem.Following are the steps I followed to solve the issue (I have used "zeep" a 3rd party module to solve this):

  1. Run the following command to understand WSDL:

python -mzeep wsdl_url

  1. Search for string "Service:". Below that we can see our operation name

  2. For my operation I found following entry:

MyOperation(parameters..., _soapheaders={parameters: ns0:AuthenticationInfo})

which clearly communicates that, I have to pass parameters and an auth param using kwargs "_soapheaders"

With that I came to know that I have to pass my authentication element as _soapheaders argument to MyOperation function.

  1. Created Auth Element:

auth_ele = client.get_element('ns0:AuthenticationInfo') auth = auth_ele(userName='me', password='mypwd')

  1. Passed the auth to my Operation:

cleint.service.MyOperation('parameters..', _soapheaders=[auth])