XML to SOAP Client Call

Based on SOAP server I need to produce this command.

<?xml version="1.0" encoding="utf-8"?>
<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:Body>
    <Test xmlns="https://book.mylimobiz.com/api">
      <apiId>string</apiId>
      <apiKey>string</apiKey>
    </Test>
  </soap:Body>
</soap:Envelope>

Open in new window


I'm having a little trouble getting it to work in php SOAP.

What I have...

<?php

$opt = array( 'trace'  =>1 );

$client = new SoapClient('http://qa.book.mylimobiz.com/api/ApiService.asmx?wsdl', $opt);


$param['ApiKey'] = '*** Api Key ***';
$param['ApiId'] = *** Api ID ***'; 
  
$tagVar = new SoapVar($param, SOAP_ENC_OBJECT);

$result = $client->__call('Test', array($tagVar));

echo $client->__getLastRequest();

print_r($result);
?>

Open in new window


Help Please
nomie7Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
What problems are you having?

Without the API Key or ID - we cannot test your code - the call seems to go through correctly but obviously rejects the API Key - so you need to tell us what is going wrong.
0
Rose BabuSenior Team ManagerCommented:
Try like this...

<?php

$client = new SoapClient('https://qa.book.mylimobiz.com/api/ApiService.asmx?wsdl');

$options = array(
				'ApiKey'     => '*** Key ***',
				'ApiId'	 =>	'*** Id ****'
				);

$result = $client-> Test($options);

print_r($result);

?>

Open in new window

0
nomie7Author Commented:
This is the response I get.

stdClass Object
(
    [TestResult] => stdClass Object
        (
            [ResponseCode] => 1
            [ResponseText] => Service Type is invalid
        )

)

Open in new window


Here is the code with Api & ID

$opt = array( 'trace'  =>1 );

$client = new SoapClient('http://qa.book.mylimobiz.com/api/ApiService.asmx?wsdl', $opt);

$param['apiId'] = 'm23IEETGsi1f9Ux'; 
$param['apiKey'] = '$9o3fKr@p9peBSCiR6U#';
  
$tagVar = new SoapVar($param, SOAP_ENC_OBJECT);

$result = $client->__call('Test', array($tagVar));

echo $client->__getLastRequest();

print_r($result);*/

Open in new window


Api Service details can be found here...

http://qa.book.mylimobiz.com/api/ApiService.asmx?op=Test
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Rose BabuSenior Team ManagerCommented:
The problem is with the Test webmethod...

try to test GetAffiliates web method. it returns the response correctly.

<?php

$client = new SoapClient('https://qa.book.mylimobiz.com/api/ApiService.asmx?wsdl');
         
$options = array('apiId' => 'm23IEETGsi1f9Ux',
                 'apiKey' => '$9o3fKr@p9peBSCiR6U#');

$result = $client-> GetAffiliates($options);

print_r($result);

?>

Open in new window

If possible contact the service provider's support to check why the Test web method returning the "Service Type is invalid" response text
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
In the PHP script here, the $tagVar variable is undefined.  Suggest you add error_reporting(E_ALL) to the top of your PHP scripts so you can catch things like this.
0
Julian HansenCommented:
the $tagVar variable is undefined.

=> $tagVar = new SoapVar($param, SOAP_ENC_OBJECT); ???
0
Ray PaseurCommented:
@julianH: Thanks -- don't know how I missed seeing that!  Maybe it's because I think SOAP is inherently evil and so I don't pay close enough attention.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.