Executing a WSDL method using SOAPClient in PHP with a parameter specified in the parameter name

Hello, I am currently utilizing PHP's soapclient function to make a call to a soap webservice (with wdsl).

While I understand how to pass parameters to a method, the webservice I am working with requires parameters to be specified within the parameter name itself (unsure of the technical term for this).

This is the expected format for parameters in the webservice:

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

The specific part I am struggling with is setting MatchType=”MatchBeginning” for the Name parameter.

This is my current code for 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"
        ),
    );

If anyone could provide guidance on how to include the required parameter using the given method, it would be greatly appreciated.

Additionally, I am attempting to access a webservice from Creditsafe. This additional information may help someone who comes across this question.

Answer №1

After some trial and error, I finally cracked the code:

   $options = array(
        "continents" => array(
            "ContinentCode" => "EU",
        ),
        "searchFilters" => array(
            "Product" => array( "_" => "item",
             "Type" => "ExactMatch"
            ),
        )
    );

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to change static properties in child classes in PHP

<?php class Base { protected static $c = 'base'; public static function getC() { return self::$c; } } class Derived extends Base { protected static $c = 'derived'; } echo Base::getC(); // output "base" echo Derived::ge ...

Is there a way to send a variable to PHP and execute it on the current page?

I need to integrate an inventory search feature on a local clothing store's website. The challenge lies in setting up the PHP script that pulls and organizes the data to run on the same page as the search form itself. Given my limited experience with ...

Filtering nested relations in Laravel

Is there a way to filter query results by translation relation (specifically the name column)? $item = Cart::select('product_id','quantity') ->with(['product.translation:product_id,name','product.manufacturer:id,name&a ...

Encountering the error message "Angular: invalid URL value sanitization" every time I attempt to refer to a folder within

I'm currently working on a project where I need to pull images from my disk into an Angular application using PHP as the backend for file retrieval. <ngb-carousel *ngIf="imageNames" class="carousel-fade"> ...

PHP incorporate diverse files from various subfolders located within the main directory

My question is similar to PHP include file strategy needed. I have the following folder structure: /root/pages.php /root/articles/pages.php /root/includes/include_files.php /root/img/images.jpg All pages in the "/root" and "/root/art ...

Loading a form on the fly using jQuery

As I delve into the realm of web design, I encountered a perplexing issue that has left me stumped. My goal is to dynamically load a form into a div element using jQuery. Here's a snippet of my code: Inside the main file: $('#left_colum'). ...

Struggling to update JSON file with PHP code

I have been attempting to run a query and save the output to my title.json file. The query is situated in my lib/conn.php file. When I access this page in my browser, I can see that it says connected, and upon checking NetBeans, I can confirm that the tit ...

Upon successful completion of the Ajax call, refresh the page without causing any blinking

Hey there, I'm facing an issue with my website, I've implemented ajax to fetch data from my API, and upon successful retrieval, I need to reload the page to display the information, However, sometimes the page blinks before reloading, while oth ...

A setter that stands alone, waiting for its matching getter

Similar Question: What are practical applications of write-only properties? Having a getter without a setter is expected, creating a read-only property. Makes sense, no issue here. However, I'm faced with code that has setters but lacks getters, ...

Fetch information that was transmitted through an ajax post submission

How can I retrieve JSON formatted data sent using an ajax post request if the keys and number of objects are unknown when using $_POST["name"];? I am currently working on a website that functions as a simple online store where customers can choose items m ...

"Incorporating input boxes for MySQL updates using PHP, MySQL, and HTML

I'm looking to make my input box dynamic, where it can read the current value from the database and allow users to change that value. Currently, when I enter a number like 1000 into the input box, it posts fine. The PHP results show: Data updated: c ...

Compose an email to the recipient specified in the form and send it

I currently have a standard contact form that includes fields for name, email address, and phone number. In addition to sending an email to the designated email address as per the standard form, $to = '<a href="/cdn-cgi/l/email-protection" cl ...

Navigating XML documents in PHP using OTA standards

While I have a basic understanding of utilizing Xpath in PHP, I am currently facing difficulties with a specific scenario. Initially, I suspect that the issue lies within the standards. The following XML snippet adheres to the OTA standards: <SendHote ...

Transform your cURL command to cURL PHP code equivalent

I am new to cURL and AJAX. I have been trying to learn on my own, but I am struggling to figure out how to convert a cURL CMD script into a cURL PHP script. Below is my cURL CMD script: curl 'https://example.url' ^ -H 'authority: example. ...

Incorporating AJAX functionality into an existing PHP form

I am currently working on a PHP registration form that validates user inputs using $_POST[] requests. Validating username length (3-20 characters) Checking username availability Ensuring the username matches /^[A-Za-z0-9_]+$/ pattern and more... Instead ...

What are the steps to set up a cronjob?

After extensive research online, I have been unable to come across any concise explanations regarding the functionality of cronjobs. My main concern is understanding where to designate the specific time for these commands to execute. During my search, I d ...

Stop the execution of the setTimeout function when the webpage loads in JavaScript

In my postgres database, I have a table named students for storing student information. The structure of the table is as follows: id first_name last_name time_remind 1 pers1 pers1_name 2022-07-30 21:30 2 pers2 pers2_name 2022-07-30 20:38 Current ...

Error is being returned by the JSONP callback

Looking to grasp JSONP. Based on my online research, I've gathered that it involves invoking a function with a callback. Other than that, is the way data is handled and the data format similar to JSON? I'm experimenting with JSONP as shown below ...

Mastering the art of inserting data using Zend 2's tableGateway

I have been using zf2's tableGateway and I am uncertain about the resulting design. Here is an example from zf2's documentation on how to use tableGateway for inserting data: public function saveAlbum(Album $album) { $data = array( ...

The HTML head JavaScript files are not applicable to dynamic Bootstrap modals

I have broken down my PHP files into smaller parts, for example, tillbody.php contains everything from the HTML tag to the body tag, followed by navbar.php and so on. I am including these files in index.php. Here is the code for a better understanding: &l ...