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 9194941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:31:45+00:00 2026-06-17T21:31:45+00:00

I have used php.net and followed the documentation for creating a SOAP request using

  • 0

I have used php.net and followed the documentation for creating a SOAP request using SoapClient in php, but I have not been able to figure out how to get the request formatted correctly with headers in the correct place. This is causing an “invalid autentication type used” error when my script runs.

The example request I need to form is:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Header>
    <ServiceAuthHeader xmlns="http://voicepad.com/DataServices_Vivek/DataServices">
      <Username>string</Username>
      <Password>string</Password>
    </ServiceAuthHeader>
  </soap12:Header>
  <soap12:Body>
    <GetData xmlns="http://voicepad.com/DataServices_Vivek/DataServices">
      <sQueryType>string</sQueryType>
      <StartDate>string</StartDate>
      <EndDate>string</EndDate>
      <PhoneNumber>string</PhoneNumber>
    </GetData>
  </soap12:Body>
</soap12:Envelope>

My last try using php to make the request is:

$client = new SoapClient("url", array( 'trace' => TRUE, 'exceptions'=>0 ));
$header = new SoapHeader( 'soap12', 'ServiceAuthHeader',  array('Username' => "$s_uname", 'Password' => "$s_pass"));
$client->__setSoapHeaders(array($header));

$result = $client->GetData(array('PhoneNumber'=>'##########'));

print_r($result);

The request this code is generating is this:

<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://voicepad.com/DataServices_Vivek/DataServices" xmlns:ns2="soap12">
    <soap-env:header>
        <ns2:serviceauthheader>
            <item>
                <key>
                    Username
                </key>
                <value>
                    *********
                </value>
            </item>
            <item>
                <key>
                    Password
                </key>
                <value>
                    *********
                </value>
            </item>
        </ns2:serviceauthheader>
    </soap-env:header>
    <soap-env:body>
        <ns1:getdata>
            <ns1:phonenumber>
                ###########
            </ns1:phonenumber>
        </ns1:getdata>
    </soap-env:body>
</soap-env:envelope>

as you can see this request is wrong, but its also the closes ive been able to get. its the ONLY trial I had where i at least got the username and password to show up in the header of the request. I’m lost somebody please help!

  • 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-06-17T21:31:46+00:00Added an answer on June 17, 2026 at 9:31 pm

    If you are looking at the first comment on the PHP.net documentation for SoapHeader, the example is exactly what you need, besides the fact that you also need to set the XML namespace correctly.

    One has to know that XML has several rules to mark elements as belonging to them, and that this does not matter to the XML processor.

    So here is the adjusted example for your problem. I hope it works for you:

    $client = new SoapClient(WSDL,array());
    
    $auth = array(
         'UserName'=>'USERNAME',
         'Password'=>'PASSWORD',
         );
    $header = new SoapHeader(
        'http://voicepad.com/DataServices_Vivek/DataServices',
        'ServiceAuthHeader',
        $auth,
        false
    );
    $client->__setSoapHeaders($header);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used PHP years ago but have since been developing in C#/VB.Net. In ASP.Net
I want to get Httpresponse body in php.I have used pear.but it gives me
I used to have PHP websites and using url rewriting on picture to have
I have a bit of experience in creating web applications using asp.net however I
I am new to ASP.NET MVC. I have used PHP before and it was
i am using authorize.net {aim} for payment gate way. I have used http://www.johnconde.net/blog/tutorial-integrating-the-authorizenet-aim-api-with-php/ class
I have two applications (PHP and .NET) working on the same machine but different
I have used PHP array for HTML select, then I put my codes in
I have recently used a PHP pagination tutorial, Pagination - what it is and
Having used PHP GD for some time I have decided to move to Imagemagick.

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.