Jump to content

SOAP CALL function from PHP


andriuxs

Recommended Posts

How to corectly define parameters in call function using PHP that I get this soap request:

    <soap:Body>

    <GetProductList xmlns="http://schemas.acme.eu/">

      <GetProductListRequest>

        <Filters>

          <Filter>

            <Name>Language</Name>

            <Value>lt-LT</Value>

          </Filter>

          <Filter>

            <Name>Currency</Name>

            <Value>LTL</Value>

          </Filter>

        </Filters>

      </GetProductListRequest>

    </GetProductList>

  </soap:Body>

 

I defined parameters this way: $par= array('Filter' => array('Name' => 'Language', 'Value' => 'lt-lt'), 'Filter' => array('Name' => 'Currency', 'Value' => 'LTL'))); and get error: System.NullReferenceException: Object reference not set to an instance of an object

Link to comment
Share on other sites

Yes i read it and other methods works fine if there is no parameters but then i call GetProductList method with defined parameters it returns an error. So it means that I have defined parameters incorrectly, and I don't no how to define them correctly, that I could get this request:

<GetProductList xmlns="http://schemas.acme.eu/">

      <GetProductListRequest>

        <Filters>

          <Filter>

            <Name>Language</Name>

            <Value>lt-LT</Value>

          </Filter>

          <Filter>

            <Name>Currency</Name>

            <Value>LTL</Value>

          </Filter>

        </Filters>

      </GetProductListRequest>

    </GetProductList>   

 

my php code:

 

$licenseKey = '498ec72c-e8e7-48f2-b300-d95666aeb141';

$soapClient = new soapclient_nusoap('https://api.acme.lt/0.1/commerce.asmx?WSDL', false);

$soapFault = $soapClient->getError();

if ($soapFault)

{

echo '<h2>Constructor error</h2><pre>' . $soapFault . '</pre>';

}

$soapClient->soap_defencoding = 'UTF-8';

$soapHeaders = '<LicenseHeader xmlns="http://schemas.acme.eu/"><LicenseKey>'.$licenseKey.'</LicenseKey></LicenseHeader>';

 

//I'd tried to define parameters in two ways but it doesn't worked.

$par= array('Filter' => array('Name' => 'Language', 'Value' => 'lt-lt'), 'Filter' => array('Name' => 'Currency', 'Value' => 'LTL'));

 

//$par = array('Name' => 'Language', 'Value' => 'lt-lt', 'Name' => 'Currency', 'Value' => 'LTL');  

 

// Make Request

//$result = $soapClient->call('GetVendorList', '', 'http://schemas.acme.eu/', 'http://schemas.acme.eu/GetVendorList', $soapHeaders); This works

//$result = $soapClient->call('GetProductClassification', '', 'http://schemas.acme.eu/', 'http://schemas.acme.eu/GetProductClassification', $soapHeaders); This works

$result = $soapClient->call('GetProductList', $par, 'http://schemas.acme.eu/', 'http://schemas.acme.eu/GetProductList', $soapHeaders);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.