/    Sign up×
Community /Pin to ProfileBookmark

Fatal error: Uncaught SoapFault exception: [ns1:Client.AUTH_1] Authentication Failed

hi

I wonder if you could help me query a SOAP API. I have all the documentation and passwords, but this isn’t a lot of good when you’re stuck at first base. OK here’s a snapshot of my WSDL file:

[CODE]
#14
<!– User authentication –>

<element name=”UserAuthentication”>
<complexType>
<sequence>
<element name=”iId” type=”xsd:int” />
<element name=”sPassword” type=”xsd:string” />
<element name=”sType” type=”api:UserType” />
</sequence>
</complexType>
</element>

# 663
<operation name=”getProductList”>
<soap:operation soapAction=”” />
<input>
<soap:header message=”api:UserAuthentication” part=”parameters” use=”literal” />
<soap:header message=”api:getQuotaRequest” part=”parameters” use=”literal” />
<soap:body use=”literal” />
</input>
<output>
<soap:header message=”api:getQuotaResponse” part=”return” use=”literal” />
<soap:body use=”literal” />
</output>
<fault name=”ApiException”>
<soap:fault name=”ApiException” use=”literal” />
</fault>
</operation>

<!– MESSAGES –>

<!– Headers –>
<message name=”UserAuthentication”>
<part name=”parameters” element=”api:UserAuthentication” />
</message>

<!– Product List –>

<element name=”getProductList”>
<complexType>
<sequence>
<element name=”sQuery” type=”xsd:string” minOccurs=”0″ />
<element name=”bAdult” type=”xsd:boolean” minOccurs=”0″ />
<element name=”bHotPick” type=”xsd:boolean” minOccurs=”0″ />
<element name=”bIncludeTree” type=”xsd:boolean” minOccurs=”0″ />
<element name=”sSort” type=”api:ProductListSortOption” minOccurs=”0″ />
<element name=”iOffset” type=”xsd:int” minOccurs=”0″ />
<element name=”iLimit” type=”xsd:int” minOccurs=”0″ />
<element name=”oActiveRefineByGroup” minOccurs=”0″ maxOccurs=”unbounded” type=”api:RefineByGroup” />
<element name=”iLimitRefineBy” type=”xsd:int” minOccurs=”0″ />
</sequence>
</complexType>
</element>
[/CODE]

I’m only interested in the

[code=php]
[17] => struct getProductList {
string sQuery;
boolean bAdult;
boolean bHotPick;
boolean bIncludeTree;
ProductListSortOption sSort;
int iOffset;
int iLimit;
RefineByGroup oActiveRefineByGroup;
int iLimitRefineBy;
}
[/code]

[code=php]getProductList()[/code]

method from the API.

Just to start with, I am correct to kick off with:

[code=php]
$client = new SoapClient(“http://api.example.com/v2/Example?wsdl”,
array(
‘iId’ => 123456,
‘sPassword’ => ‘gkgkgkgkgkgkgkkgkgkggkkgkgkgkg’,
‘sType’ => ‘fhfhfhfhhfhffhfhfhhffhhfhfhfhfhfh’));
[/code]

Is this right? I mean from the error message ‘Authentication Failed’ I’m thinking something is missing at this point. Moreover the rest of the script:

[code=php]
$oRefineByDefinition = new stdClass();
$oRefineByDefinition->sId = 1203;
$oRefineByDefinition->sName = ”;
$oRefineBy->oRefineByDefinition = $oRefineByDefinition;

$aParams7 = array(
“sQuery” => “jeans”,
“bAdult” => 0,
“iOffset” => 0,
“iLimit” => 30,
//”oActiveRefineByGroup” => $oRefineBy,
“sColumnToReturn” => array(“sDescription”,”sBrand”));

$products = $client->getProductList($aParams7);

print_r($products);
[/code]

fails to execute?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @1cookie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...