Jump to content


Photo

Soap,php, and wsdl files

php soap wsdl

  • Please log in to reply
2 replies to this topic

#1 gork4life

gork4life

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationHouston

Posted 02 October 2013 - 09:45 AM

I'm new to soap and webservices , and wanting to know do I have to use soap with a wsdl file, or can I use something else like json?


Gork4life

#2 exeTrix

exeTrix

    Advanced Member

  • Members
  • PipPipPip
  • 53 posts
  • LocationUK
  • Age:27

Posted 02 October 2013 - 12:56 PM

I've only used SOAP a handful of times. All I can say is, from my experience, it's bloated and annoying to make simple changes. I think JSON is the way forwar. Just bear in mind that most browsers block cross site requests returning JSON, so when sending JSON from other hosts JSONP is your friend.

 

If you have code problems post them and we'll try and help :)



#3 gork4life

gork4life

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationHouston

Posted 14 October 2013 - 11:24 AM

Ok thanks I'm tring to create a webservice in php. My servercode is

<?php 
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);

$soap_server = new SoapServer('Notification.wsdl');
$soap_server->addFunction('Notify');

function Notify($message)
{
    return array('message' => $message);
}

$soap_server->handle();


?>

And I'm trying to create a client for the service  using this code

<?php

include 'soap_server.php';

$soap_client = new SoapClient('https://localhost:8888/Soap/Notification.wsdl', array(
                'proxy_host' => 'localhost',
                'proxy_port' => '8888',
                'local_cert' => 'APX_WS_API1.cer'  
            ));

try{
    $result = $soap_client->__soapCall('Notify',array('message' => 'Hello World'));
    echo $result;
}catch(SoapFault $e){
    echo "Error: " . $e->faultcode;
}


?>

The problem is when I run this I get could not connect to host error. If I can do this with JSONP. How can I do this with the wsdl file that I have to use? Please help?:)


Gork4life




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com