Search code examples
phpwsdl

Non-WSDL php call


I'm new to php and looking to integrate a website with some rental software. They use non-WSDL mode services and have supplied this piece of code but I'm a bit confused about the "this-is-the-action-uri". My guess is that's a method I need to call.

    $client = new SoapClient(NULL, array(
    'location' => '21.ip2.ip3.ip4/r2ws_v5/servlet/messagerouter',
    'uri' => 'urn:this-is-the-action-uri',
    'exceptions' => 1,
    );

I can call this and get a response.

http://21.ip2.ip3.ip4:8080/r2ws_v5/jsp/UBS_GetAvailability.jsp

The reposnse starts like this.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:getAvailabilityByItemResponse xmlns:ns1="UBS/R2" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<response>
<product>
<productID xsi:type="xsd:string">TESTUB</productID>
<level xsi:type="xsd:int">1</level>
<description xsi:type="xsd:string">
<![CDATA[ testub ]]>
</description>
</level>

Can you give me any idea of what the 'uri' parameter should be in this case or how it should be formatted?


Solution

  • Hi just create a PHP file and put below code into your PHP file.

    $xmlRequest = "<SOAP:Envelope xmlns:SOAP=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" .
        "<SOAP:Body>" .
        "<getAvailabilityByItem xmlns=\"UBS/R2WebServices/AvailabilityService\">" .
            "<request>" .
                "<detail xsi:type=\"xsd:string\">0</detail>" .
                "<products>".
                    "<product>" .
                        "<type xsi:type=\"xsd:int\">0</type>" .
                        "<productID xsi:type=\"xsd:string\"><![CDATA[DE014SML]]></productID>" .
                        "<startDate xsi:type=\"xsd:date\">12/07/2014</startDate>" .
                        "<startTime xsi:type=\"xsd:timeInstant\">8:00 AM</startTime>" .
                        "<endDate xsi:type=\"xsd:date\">12/08/2014</endDate>" .
                        "<endTime xsi:type=\"xsd:timeInstant\">12:00 PM</endTime>" .
                    "</product>".
                "</products>" .
            "</request>" .
        "</getAvailabilityByItem>" .
        "</SOAP:Body>" .
        "</SOAP:Envelope>" ;
    
    $location_URL = 'http://21.ip2.ip3.ip4/r2ws_v5/servlet/messagerouter';
    
    $client = new SoapClient(null, array(
    'location' => $location_URL,
    'uri' => "",
    'trace' => 1,
        ));
    $order_return = $client->__doRequest($xmlRequest, $location_URL, '' , 1);
    

    Hope you found the solution ;)