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

  • Home
  • SEARCH
  • 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 4088558
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:59:52+00:00 2026-05-20T18:59:52+00:00

Been having major issues trying to solve this issue, I’ll be happy to give

  • 0

Been having major issues trying to solve this issue, I’ll be happy to give a +500 bounty to someone who can help me get this work.

Basically, I’m trying to call this web service using Nusoap:

https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?op=QueryCustomer

This is what I’ve got so far:

class Eway
{
    var $username = 'test@eway.com.au';
    var $pw = 'test123';
    var $customerId = '87654321';
    private function setHeaders($client)
    {
        $headers = <<<EOT
<eWAYHeader xmlns="http://www.eway.com.au/gateway/managedPayment">
      <eWAYCustomerID>$this->customerId</eWAYCustomerID>
      <Username>$this->username</Username>
      <Password>$this->pw</Password>
    </eWAYHeader> 
EOT;
       $client->setHeaders($headers);
       return $client;
    }

     function getCustomer($ewayId = 9876543211000)
     {
        $url = 'https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?WSDL';  
        $client = new Nusoap_client($url, true);
        $this->setHeaders($client);

        $args['QueryCustomer'] = array('managedCustomerID'=>$ewayId);

        $result = $client->call('QueryCustomer', $args);
        print_r($result);
    }
}

When I run this code and do $eway->getCustomer() I get the following error:

Array
(
    [faultcode] => soap:Client
    [faultstring] => eWayCustomerID, Username and Password needs to be specified in the soap header.
)

What am I doing wrong?

If you could fix my class and give me working code which is able to do the QueryCustomer method using the test customer id and return its info, I’ll be glad to give you +500 rep and my eternal gratitude. Obviously it’ll be 48 hours before I can start the bounty, but I promise that I will do it.

  • 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-20T18:59:52+00:00Added an answer on May 20, 2026 at 6:59 pm

    I could be missing the point, but you never actually assign the returned object to $client:

    function getCustomer($ewayId = 9876543211000)
     {
        $url = 'https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?WSDL';  
        $client = new Nusoap_client($url, true);
        $client = $this->setHeaders($client);
    
        $args['QueryCustomer'] = array('managedCustomerID'=>$ewayId);
    
        $result = $client->call('QueryCustomer', $args);
        print_r($result);
    }
    

    You could also set $client as a class variable if desired or by sending the parameter as a reference.


    Looking at the data, I do not know if this matters, but you are using var for your class variable declarations and then using private for the function. If you are using php5 I would stay away from the var:

    private $username = 'test@eway.com.au';
    private $pw = 'test123';
    private $customerId = '87654321';
    

    Use the private or public or protected (whichever your class requires) instead to keep consistency. I doubt this will solve your problem, just something to be conscious about.


    Possible Solution

    Ok, doing some digging of my own, figured this out, you need to encase the actual header you add in a SOAP:Header deal. I tested the below and it was working for me, so give it a try:

    private function setHeaders($client)
    {
        $headers = <<<EOT
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" >
    <SOAP:Header>
    <eWAYHeader xmlns="http://www.eway.com.au/gateway/managedPayment">
      <eWAYCustomerID>$this->customerId</eWAYCustomerID>
      <Username>$this->username</Username>
      <Password>$this->pw</Password>
    </eWAYHeader>
    </SOAP:Header>
    EOT;
       $client->setHeaders($headers);
       return $client;
    }
    

    It did not return any errors. So yea, it seems that is the likely culprit. (Note I also implemented the $client = $this->setHeaders($client); I mentioned above as well.


    And my Final Answer is:

    Alright did a bit of digging and found something that works. Not saying it is right, but yea it works.

    private function setHeaders($client)
    {
        $headers = <<<EOT
    <eWAYHeader xmlns="https://www.eway.com.au/gateway/managedpayment">
      <eWAYCustomerID>$this->customerId</eWAYCustomerID>
      <Username>$this->username</Username>
      <Password>$this->pw</Password>
    </eWAYHeader>
    EOT;
       $client->setHeaders($headers);
       return $client;
    }
    
     function getCustomer($ewayId = 123456789012)
     {
        $url = 'https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?WSDL';
        $client = new nusoap_client($url);
        $client = $this->setHeaders($client);
    
        $args['QueryCustomer'] = array('managedCustomerID'=>$ewayId);
    
        $result = $client->call('QueryCustomer', $args, $namespace='https://www.eway.com.au/gateway/managedpayment', $soapAction='https://www.eway.com.au/gateway/managedpayment/QueryCustomer');
    
        print_r($result);
    
        //echo "\n{$client->request}\n"; // This echos out the response you are sending for debugging.
    }
    

    It seems the namespace and soapAction were the key ingredients. I found these using the link you originally posted: https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?op=QueryCustomer

    Basically, I just looked at that response, and then did some searching to figure out the soapAction, and then just messed with it until the request being sent matched the page you posted. It returns a failed login, but yea. That generally means something is working, and is probably due to the test data. But that gives you a baseline to go off of.

    And the $client->request is a handy debugging tool for the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having major issues with a ScrollPane component in Papervision3D. This issue has
I've been having some major issues with a layout I'm making specifically in Internet
I'm having a major issue which has been bugging me for a while now.
i have been having this trouble when trying to obtain json data. lets say
I have been having this issue for a while now and I cannot seem
I have been having some major issues with my Visual Studio 2008 Pro install.
I've been having a hard time trying to understand PyPy's translation. It looks like
We've been having some issues with a SharePoint instance in a test environment. Thankfully
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I've been having a lot of problems trying to figure out how to use

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.