0

I have given below the Wsdl file, request instance and expected response instance and all I need is how to execute it to get the expected response using SOAP in php.

I need to know how to send request to soap environment and response as expected. So please provide me solution for it.

As of documentation

The notifySmsDeliveryReceipt operation must be implemented by a Web Service at the application side if it requires notification of SMS delivery receipt. It will be invoked by the Parlay X 3 server to notify the application when a SMS sent by an application has been delivered to the terminal of the recipient or if delivery is impossible. The notification will occur if and only if the status of the sent SMS is DeliveredToTerminal or DeliveryImpossible and the application has specified interest in notification when sending an SMS message using one of the following mutually exclusive mechanisms: by specifying the optional receiptRequest part. The correlator returned corresponds to the identifier specified by the application in the receiptRequest of the original sendSMS request. by invoking the startDeliveryReceiptNotification operation requesting to receive delivery receipt notifications. The correlator returned corresponds to the identifier specified by the application in the reference of the original startDeliveryReceiptNotification request

wsdl file:

<?xml version="1.0" encoding="UTF-8"?>
    <!-- March 7, 2007 -->
    <wsdl:definitions
       name="parlayx_sms_notification_service"
       targetNamespace="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/service"
       xmlns="http://schemas.xmlsoap.org/wsdl/"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:tns="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/service"
       xmlns:interface="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/interface">

       <wsdl:import namespace="http://www.csapi.org/wsdl/parlayx/sms/notification/v3_1/interface" location="parlayx_sms_notification_interface_3_1.wsdl"/>

       <wsdl:binding name="SmsNotificationBinding" type="interface:SmsNotification">
          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

          <wsdl:operation name="notifySmsReception">
             <soap:operation soapAction="" style="document"/>
                <wsdl:input>
                <soap:header message="interface:NotifySOAPHeader" part="NotifySOAPHeader" use="literal"/>
                   <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                   <soap:body use="literal"/>
                </wsdl:output>
          </wsdl:operation>

          <wsdl:operation name="notifySmsDeliveryReceipt">
             <soap:operation soapAction="" style="document"/>
                <wsdl:input>
                <soap:header message="interface:NotifySOAPHeader" part="NotifySOAPHeader" use="literal"/>
                   <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                   <soap:body use="literal"/>
                </wsdl:output>
          </wsdl:operation>
       </wsdl:binding>

       <wsdl:service name="SmsNotificationService">
          <wsdl:port name="SmsNotification" binding="tns:SmsNotificationBinding">
             <soap:address location="http://localhost:9080/SmsNotificationService/services/SmsNotification"/>
          </wsdl:port>
       </wsdl:service>
    </wsdl:definitions>

SOAP Request instance:

    <soapenv:Envelope xmlns:soapenv=‘http://schemas.xmlsoap.org/soap/envelope/’ xmlns:v3=‘http://www.csapi.org/schema/parlayx/common/v3_1’ xmlns:loc=‘http://www.csapi.org/schema/parlayx/sms/notification/v3_1/local’>
       <soapenv:Header>
          <v3:NotifySOAPHeader>
             <spId>600002</spId>
          </v3:NotifySOAPHeader>
       </soapenv:Header>
       <soapenv:Body>
          <loc:notifySmsDeliveryReceipt>
             <loc:correlator>123</loc:correlator>
             <loc:deliveryStatus>
                <address>tel:+86123</address>
                <deliveryStatus>DeliveredToTerminal</deliveryStatus>
             </loc:deliveryStatus>
          </loc:notifySmsDeliveryReceipt>
       </soapenv:Body>
    </soapenv:Envelope>

Response instance:

    <soapenv:Envelope xmlns:soapenv=‘http://schemas.xmlsoap.org/soap/envelope/’ xmlns:loc=‘http://www.csapi.org/schema/parlayx/sms/notification/v3_1/local’>
       <soapenv:Header/>
       <soapenv:Body>
          <loc:notifySmsDeliveryReceiptResponse/>
       </soapenv:Body>
    </soapenv:Envelope>
Gangasree
  • 1
  • 1
  • Duplicate of https://stackoverflow.com/questions/11593623/how-to-make-a-php-soap-call-using-the-soapclient-class – jjok Mar 15 '18 at 10:39

1 Answers1

0

First of all read this PHP: SoapClient class reference

How to work with SoapClient?

Firts of all php SoapClient is a class that provides u an object that allows u to handle the fuctions the webservice has, i'm gonna show u how i did it when i had to works with the same like 2 months ago.

Let's create the instance

$url = 'http://this.is.the.server:somePort/the_service?wsdl';
$soapObject = new SoapClient($url, array('with some options, check the docs'));

Let's call a method Is really important to pass the parameters with the exact name those have in the service function.

 $response = $soapObject->theFunctionName(array('parameter1' => 'value1',
 'parameter2' => 'value2'));

Simple way to get the returned values This is only my opinion but i think that working with a referencial array instead of mapping to an object is easier (maybe because im used to it).

function transformSoapResponseToArray($response){
    $refArrayOfResponse= json_encode($response);
    return json_decode($refArrayOfResponse, true);
}

Hope my answer helps u.

Francisco Hahn
  • 435
  • 5
  • 10