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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:19:45+00:00 2026-06-14T01:19:45+00:00

I have been working on this for a week now and have trouble executing

  • 0

I have been working on this for a week now and have trouble executing this code. I want to retrieve data via SOAP and work with it in PHP. My trouble is, that I am having trouble sending the RequesterCredentials.

I will show the XML code so you all can see the information I am trying to send, and then the PHP code I am using.

XML sample code

POST /AuctionService.asmx HTTP/1.1
Host: apiv2.gunbroker.com
Content-Type: text/xml; charset=utf-8
Content-Length: 200
SOAPAction: "GunBrokerAPI_V2/GetItem"

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     <soap:Header>
       <RequesterCredentials xmlns="GunBrokerAPI_V2">
         <DevKey>devkey</DevKey>
         <AppKey>appkey</AppKey>
       </RequesterCredentials>
     </soap:Header>
     <soap:Body>
    <GetItem xmlns="GunBrokerAPI_V2">
      <GetItemRequest>
        <ItemID>312007942</ItemID>
        <ItemDetail>Std</ItemDetail>
      </GetItemRequest>
    </GetItem>
  </soap:Body>
</soap:Envelope>

PHP code that I am using to make the call

$client = new SoapClient("http://apiv2.gunbroker.com/AuctionService.asmx?WSDL");

$appkey = 'XXXXXX-XXXXXX-XXXXXX';
$devkey = 'XXXXXX-XXXXXX-XXXXXX';

$header = new SoapHeader('GunBrokerAPI_V2', 'RequesterCredentials', array('DevKey' => $devkey, 'AppKey' => $appkey), 0);
$client->__setSoapHeaders(array($header));

$result = $client->GetItem('312343077');

echo '<pre>', print_r($result, true), '</pre>';

The result I get

stdClass Object
(
    [GetItemResult] => stdClass Object
    (
        [Timestamp] => 2012-11-07T18:17:31.9032903-05:00
        [Ack] => Failure
        [Errors] => stdClass Object
            (
                [ShortMessage] => GunBrokerAPI_V2 Error Message : [GetItem]
                // You must fill in the 'RequesterCredentialsValue'
                // SOAP header for this Web Service method.
                [ErrorCode] => 1
            )
// The rest if just an array of empty fields that
// I could retrieve if I wasn’t having problems.

I’m not sure if the problem is the way I’m sending the SoapHeaders or if I am misunderstanding the syntax. How can I fix 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-06-14T01:19:46+00:00Added an answer on June 14, 2026 at 1:19 am

    Use an object instead of an associative array for headers:

    $obj = new stdClass();
    
    $obj->AppKey = $appkey;
    $obj->DevKey = $devkey;
    
    $header = new SoapHeader('GunBrokerAPI_V2', 'RequesterCredentials', $obj, 0);
    

    And the next problem you might face will be at the GetItem call. You also need an object, wrapped in an associative array:

    $item = new stdClass;
    $item->ItemID = '312343077';
    $item->ItemDetail = 'Std';
    
    $result = $client->GetItem(array('GetItemRequest' => $item));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working with this stored procedure Sys.xp_readerrorlog for around a week now,
I have been working on this for a week now and have posted a
ok I have been working on this webpage for a week now and have
I have been working on this problem for 2 days now and it's an
I have been working on this problem for a while now. I am trying
I have been working on this for 24 hours now, trying to optimize it.
I have been working on this for some time now and just cant quite
I've not been working with EF until this week (v5) and now I'm making
We've been investigating this issue for a week now. We have two applications deployed
I have been trying this for a week or so now. I have followed

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.