Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Load the classes constructed by wsdl2php
- require_once './SLIM_Service.php';
- // Define the SOAP options.
- $a_SoapOptions = array
- (
- 'encoding' => 'UTF-8',
- 'exception' => True, // Turn SOAPFaults into Exceptions so PHP can report upon them.
- 'trace' => True, // Turn on tracing so we can see EXACTLY what the headers and request/response are.
- );
- // As we are going to need to display XML, use Tidy to make it pretty.
- $a_TidyConfig = array
- (
- 'indent' => 4,
- 'indent-attributes' => true,
- 'input-xml' => true,
- 'output-xml' => true,
- 'wrap' => 0,
- );
- $o_Tidy = new Tidy;
- $s_WsdlUrl = "http://betaservices.membersolutions.com/Business.PartnerService/svc/SLIM.svc?wsdl";
- try
- {
- // Create the service.
- $o_Service = new SLIM_Service($s_WsdlUrl, $a_SoapOptions);
- // Construct the parameter for the HelloWorld method.
- $o_HelloWorld = new HelloWorld;
- // Call the HelloWorld method.
- $o_HelloWorldResponse = $o_Service->HelloWorld($o_HelloWorld);
- // Display the results.
- echo PHP_EOL,
- // Show trace.
- 'Request Headers', PHP_EOL,
- '---------------', PHP_EOL,
- $o_Service->__getLastRequestHeaders(), PHP_EOL,
- 'Request (XML)', PHP_EOL,
- '-------------', PHP_EOL,
- $o_Tidy->repairString($o_Service->__getLastRequest(), $a_TidyConfig), PHP_EOL, PHP_EOL,
- 'Response Headers', PHP_EOL,
- '----------------', PHP_EOL,
- $o_Service->__getLastResponseHeaders(), PHP_EOL,
- 'Response (XML)', PHP_EOL,
- '--------------', PHP_EOL,
- $o_Tidy->repairString($o_Service->__getLastResponse(), $a_TidyConfig), PHP_EOL, PHP_EOL, PHP_EOL,
- 'Response (Interpreted)', PHP_EOL,
- '----------------------', PHP_EOL,
- print_r($o_HelloWorldResponse->HelloWorldResult, True), PHP_EOL;
- }
- catch(Exception $e)
- {
- echo PHP_EOL,
- // Show trace.
- 'Request Headers', PHP_EOL,
- '---------------', PHP_EOL,
- $o_WAPI->__getLastRequestHeaders(), PHP_EOL,
- 'Request (XML)', PHP_EOL,
- '-------------', PHP_EOL,
- $o_Tidy->repairString($o_Service->__getLastRequest(), $a_TidyConfig), PHP_EOL, PHP_EOL,
- 'Response Headers', PHP_EOL,
- '----------------', PHP_EOL,
- $o_Service->__getLastResponseHeaders(), PHP_EOL,
- 'Response (XML)', PHP_EOL,
- '--------------', PHP_EOL,
- $o_Tidy->repairString($o_WAPI->__getLastResponse(), $a_TidyConfig), PHP_EOL, PHP_EOL, PHP_EOL,
- // Show exception.
- 'Exception', PHP_EOL,
- '---------', PHP_EOL,
- $e->getMessage(), PHP_EOL;
- }
Advertisement
Add Comment
Please, Sign In to add comment