• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 195

Backtrace:

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/views/question.php
Line: 195
Function: _error_handler

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/controllers/Questions.php
Line: 416
Function: view

File: /home/u125378470/domains/lawhelpguru.org/public_html/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

How to make authenticated connection to web service with python?

I successfully authenticated connection to my web service, I wrote in asp.net with PHP.

PHP codes:

<?php
ini_set("soap.wsdl_cache_enabled", "0");
$soapURL = 'http://localhost:49280/orhan.asmx?WSDL';
$username = 'test';
$password = 'test';

    $client = new SoapClient($soapURL);
    $auth = new stdClass();
$auth->Username = $username;
$auth->Password = $password ;

$header = new SoapHeader('http://tempuri.org/', 'AuthHeader', $auth, true);
$client->__setSoapHeaders($header);

$response = $client->HelloWorld();

$xml = $response->HelloWorldResult;

echo "
";
var_dump($xml);
echo "
"
; ?>

This website if the authenticated is true printing hello world, or authenticated is wrong, printing password or username is wrong. Everything is fine and the program runs smoothly. But when I try to authenticate with python, unfortunately, appears on the console.

Python Code:

from requests.auth import HTTPBasicAuth  # or HTTPDigestAuth, or OAuth1, etc.
from requests import Session
from zeep import Client
from zeep.transports import Transport
wsdl='http://localhost:49280/orhan.asmx?WSDL'
user = 'test'
password = 'test'

session = Session()
session.auth = HTTPBasicAuth(user, password)
client = Client(wsdl,
            transport=Transport(session=session))

How do I get the string to appear on the console after authenticating in python?