Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7098175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:01:19+00:00 2026-05-28T11:01:19+00:00

I am developing a web using django and it deals with wsdl. I have

  • 0

I am developing a web using django and it deals with wsdl. I have an example code in dealing with it but its written on PHP and I wanted to convert it to python for my django.
here is the PHP file …

<?php
  ini_set("soap.wsdl_cache_enabled", "0");

  $WSDL                  = "DirectConnect.test.WSDL";

  $MerchantCode          = "HELLO";
  $MerchantReference     = "" . time();
  $TransactionType       = 20;
  $Amount                = 100;
  $CurrencyCode          = "PHP";
  $CardHolderName        = "RAUL O REVECHE";
  $CardNumber            = "4005550000000001";
  $ExpiryMonth           = 5;
  $ExpiryYear            = 2013;
  $CardID                = 0;
  $CardSecurityCode      = "400";
  $CustomerAccountNumber = "";
  $BillNumber            = 0;
  $CardHolderEmail       = "development@yespayments.com.ph";
  $ClientIPAddress       = $_SERVER["REMOTE_ADDR"];
  $Notes                 = "This is a test.";

  $SoapClient = new SoapClient($WSDL,array(
    "soap_version" => SOAP_1_2,
    "features"     => SOAP_SINGLE_ELEMENT_ARRAYS,
    "cache_wsdl"   => WSDL_CACHE_NONE,
    "trace"        => 1,
    "exceptions"   => 0));

  try
  {
    $response = $SoapClient->OnlineTransaction(array(
      "MerchantCode"          => $MerchantCode,
      "MerchantReference"     => $MerchantReference,
      "TransactionType"       => $TransactionType,
      "Amount"                => $Amount,
      "CurrencyCode"          => $CurrencyCode,
      "CardHolderName"        => $CardHolderName,
      "CardNumber"            => $CardNumber,
      "ExpiryMonth"           => $ExpiryMonth,
      "ExpiryYear"            => $ExpiryYear,
      "CardID"                => $CardID,
      "CardSecurityCode"      => $CardSecurityCode,
      "CustomerAccountNumber" => $CustomerAccountNumber,
      "BillNumber"            => $BillNumber,
      "CardHolderEmail"       => $CardHolderEmail,
      "ClientIPAddress"       => $ClientIPAddress,
      "Notes"                 => $Notes
      ));

    print "<br />TransactionID: ".            $response->OnlineTransactionResult->TransactionID;
    print "<br />TransactionType: ".          $response->OnlineTransactionResult->TransactionType;
    print "<br />MerchantReference: ".        $response->OnlineTransactionResult->MerchantReference;
    print "<br />ResponseCode: ".             $response->OnlineTransactionResult->ResponseCode;
    print "<br />ResponseShortDescription: ". $response->OnlineTransactionResult->ResponseShortDescription;
    print "<br />ResponseDescription: ".      $response->OnlineTransactionResult->ResponseDescription;
    print "<br />TimeStamp: ".                $response->OnlineTransactionResult->TimeStamp;
    print "<br />CardID: ".                   $response->OnlineTransactionResult->CardData->CardID;
    print "<br />CardSuffix: ".               $response->OnlineTransactionResult->CardData->CardSuffix;
    print "<br />ExpiryYear: ".               $response->OnlineTransactionResult->CardData->ExpiryYear;
    print "<br />ExpiryMonth: ".              $response->OnlineTransactionResult->CardData->ExpiryMonth;
    print "<br />BINCountryCode: ".           $response->OnlineTransactionResult->BINCountryCode;
    print "<br />IPCountryCode: ".            $response->OnlineTransactionResult->IPCountryCode;
    print "<br />WarningArray: ".             $response->OnlineTransactionResult->WarningArray;

  }
  catch (SoapFault $exception)
  {
    print $exception;
  }

  print "<br /><br />Request:<br />". htmlspecialchars($SoapClient->__getLastRequest());
  print "<br /><br />Response:<br />". htmlspecialchars($SoapClient->__getLastResponse());

?>

and this is what i have done to converting it to python…

from suds.client import Client
import collections
url = 'file:///home/myFile/DirectConnect.test.WSDL'
client = Client(url)
values = collections.OrderedDict([
            ("MerchantCode", "HELLO"),
            ("MerchantReference", ""),
            ("TransactionType",20),
            ("Amount",100),
            ("CurrencyCode","PHP"),
            ("CardHolderName","RAUL O REVECHE"),
            ("CardNumber", "4005550000000001"),
            ("ExpiryMonth",5),
            ("ExpiryYear",2013),
            ("CardID",0),
            ("CardSecurityCode","400"),
            ("CustomerAccountNumber",""),
            ("BillNumber",0),
            ("CardHolderEmail","development@yespayments.com.ph"),
            ("ClientIPAddress","http://127.0.0.1:8000/"),
            ("Notes","This is test"),
            ])

response = client.service.OnlineTransaction(values)

but when i run it, i got this error…

Traceback (most recent call last):
  File "yes_test.py", line 24, in <module>
    response = client.service.OnlineTransaction(values)
  File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 542, in __call__
    return client.invoke(args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 595, in invoke
    soapenv = binding.get_message(self.method, args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/suds/bindings/binding.py", line 120, in get_message
    content = self.bodycontent(method, args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/suds/bindings/document.py", line 63, in bodycontent
    p = self.mkparam(method, pd, value)
  File "/usr/local/lib/python2.7/dist-packages/suds/bindings/document.py", line 105, in mkparam
    return Binding.mkparam(self, method, pdef, object)
  File "/usr/local/lib/python2.7/dist-packages/suds/bindings/binding.py", line 287, in mkparam
    return marshaller.process(content)
  File "/usr/local/lib/python2.7/dist-packages/suds/mx/core.py", line 62, in process
    self.append(document, content)
  File "/usr/local/lib/python2.7/dist-packages/suds/mx/core.py", line 75, in append
    self.appender.append(parent, content)
  File "/usr/local/lib/python2.7/dist-packages/suds/mx/appender.py", line 102, in append
    appender.append(parent, content)
  File "/usr/local/lib/python2.7/dist-packages/suds/mx/appender.py", line 243, in append
    Appender.append(self, child, cont)
  File "/usr/local/lib/python2.7/dist-packages/suds/mx/appender.py", line 182, in append
    self.marshaller.append(parent, content)
  File "/usr/local/lib/python2.7/dist-packages/suds/mx/core.py", line 74, in append
    if self.start(content):
  File "/usr/local/lib/python2.7/dist-packages/suds/mx/literal.py", line 87, in start
    raise TypeNotFound(content.tag)
suds.TypeNotFound: Type not found: 'MerchantCode'

i think that the error is in these line of my python,

response = client.service.OnlineTransaction(values)

can anyone can give me an idea about my situation?

thanks in advance …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:01:20+00:00Added an answer on May 28, 2026 at 11:01 am

    Are you sure your DirectConnect.test.WSDL is correct? It seems it’s not. Please post it here.

    Added:

    I got it working. Please have a look at the result. Here is the working code (chmod +x main.py to run it).

    (sudstest)mike-imac:sudstest mike$ ./main.py 
    (OnlineResponse){
       TransactionID = 0
       TransactionType = 20
       MerchantReference = None
       ResponseCode = "ERMERC"
       ResponseShortDescription = "YESDEC"
       ResponseDescription = "Invalid Merchant Code"
       TimeStamp = "2012/01/24 17:21:37"
       CardData = 
          (YESCardData){
             CardID = 0
             ExpiryYear = 0
             ExpiryMonth = 0
          }
     }
    

    main.py

    #!/usr/bin/env python
    import os
    from suds.client import Client
    
    WSDL = 'DirectConnect.test.WSDL'
    
    def test_api():
        url = 'file://' + os.path.join(os.path.abspath(os.path.dirname(__file__)), WSDL)
        client = Client(url)
    
        data = {
            'MerchantCode': 'HELLO',
            'MerchantReference':  '',
            'TransactionType': 20,
            'Amount': 100,
            'CurrencyCode': 'USD',
            'CardHolderName': 'RAUL O REVECHE',
            'CardNumber': 4005550000000001,
            'ExpiryMonth': 5,
            'ExpiryYear': 2013,
            'CardID': 0,
            'CardSecurityCode': 400,
            'CustomerAccountNumber': '',
            'BillNumber': 0,
            'CardHolderEmail': 'development@yespayments.com.ph',
            'ClientIPAddress': 'http://127.0.0.1:8000/',
            'Notes': 'This is test',
        }
    
        result = client.service.OnlineTransaction(**data)
        print result
    
    if __name__ == '__main__':
        test_api()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a web application using Python, Django and MySql. I have a
I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have
I am developing an web application using php. One of the requirement is the
I am developing a web app using servlets and jsps. I have a question
I am developing web application using asp.net, but i want to work on asp
I am developing a web application using django, postgreSQL, html5 and javascript. The application
I am developing web app using asp.net. I have plenty of javascript files which
I have been developing Web Applications using WAMP stack. I use javascript jQuery extensively
we are developing a web application using MVC3 and VS2010. We have some pdf
we are developing a web application using MVC3 and Jquery. we have a situation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.