user1998112
user1998112

Reputation: 11

(php) calling wsdl method using soapclient with parameter in parameter name

Hi i'm using PHP's soapclient function to call a soap webservices (with wdsl).

I know how to pass parameters to a method, but the webservice i'm using is expecting parameters in the parameter name (not sure how to call this).

This is what the webservice is expecting when using parameters:

<searchCriteria>
    <Name MatchType=”MatchBeginning”>Exmaple Company</Name>
    <Address>
        <Street>Example Street</Street>
    </Address>
</searchCriteria>

It's about this part in the Name parameter: MatchType=”MatchBeginning”

This is how i'm calling the webservice:

<?php
    $client = @new \SoapClient($url,array(
            'exceptions' => 1,
            'login' => '****',
            'password' => '****',
            'trace' => 1,
    ));

    $parameter = array(
        "countries" => array(
            "CountryCode" => "NL",
        ),
        "searchCriteria" => array(
            "Name" => "value"
        ),
    );

Can someone tell me how to add the parameter using the above method? Much appreciated.

BTW i'm trying to consume a webservice from Creditsafe. Maybe someone will find this question by adding this info.

Upvotes: 1

Views: 1302

Answers (1)

Marco
Marco

Reputation: 21

I figured out how to do it:

    $parameter = array(
        "countries" => array(
            "CountryCode" => "DE",
        ),
        "searchCriteria" => array(
            "Name" => array( "_" => "value",
             "MatchType" => "MatchBeginning"
            ),
        )
    );

Upvotes: 2

Related Questions