SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple PEAR SOAP web service on Powweb

    Hello all:

    I am having a problem with getting a web service to work. I am hosting the service on powweb. I found a basic script that takes two integers, adds them together, and returns the answer. Very simple right? Well, when I try to hit the web service, it returns a 500 error. I have attached an error screenshot and here is the code for the service followed by the wsdl(created by putting ?wsdl at the end of the url).

    In the wsdl and the code, I had to replace www with w_w_w and http with ttp in order for the forum to allow me to post.

    Can anyone see what I am doing wrong?

    Thanks,

    -Jason

    Code:
    <?php
      error_reporting(E_ALL ^ E_NOTICE);
      require_once 'SOAP/Server.php';
      class ServiceClass {
      	var $__dispatch_map = array();
    
    
      	function ServiceClass() {
    	    $this->__dispatch_map['add'] = array(
    	      'in'  => array('a' => 'int', 'b' => 'int'),
    	      'out' => array('c' => 'int')
    	    );
    	  }
    
    	function __dispatch($method) {
    	    if (isset($this->__dispatch_map[$method])) {
    	      return $this->__dispatch_map[$method];
    	    } else {
    	      return null;
    	    }
    	  }
    
    
    
    
    
      //HERE IS THE FUNCTION FOR THE SERVICE
        function add($a, $b) {
          $c = $a + $b;
          return $c;
        }
      }
    $soap = new SOAP_Server;
      $service = new ServiceClass();
      $soap->addObjectMap($service, 'urn:ServiceClass');
      if (isset($_SERVER['REQUEST_METHOD']) &&
          $_SERVER['REQUEST_METHOD'] == 'POST')
      {
          $soap->service($HTTP_RAW_POST_DATA);
      }
      else
      {
          require_once 'SOAP/Disco.php';
          $disco = new SOAP_DISCO_Server($soap,'DiscoServer');
          if (isset($_SERVER['QUERY_STRING']) &&
            strpos($_SERVER['QUERY_STRING'], 'wsdl') === 0)
          {
            header('Content-type: text/xml');
            echo $disco->getWSDL();
          }
      }
      ?>
    WSDL:
    Code:
    <?xml version="1.0" ?> 
    - <definitions name="DiscoServer" targetNamespace="urn:DiscoServer" xmlns:wsdl="ttp://schemas.xmlsoap.org/wsdl/" xmlns:soap="ttp://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:DiscoServer" xmlns:xsd="ttp://w_w_w.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="ttp://schemas.xmlsoap.org/soap/encoding/" xmlns="ttp://schemas.xmlsoap.org/wsdl/">
      <types xmlns="ttp://schemas.xmlsoap.org/wsdl/" /> 
    - <message name="addRequest">
      <part name="a" type="xsd:int" /> 
      <part name="b" type="xsd:int" /> 
      </message>
    - <message name="addResponse">
      <part name="c" type="xsd:int" /> 
      </message>
    - <portType name="DiscoServerPort">
    - <operation name="add">
      <input message="tns:addRequest" /> 
      <output message="tns:addResponse" /> 
      </operation>
      </portType>
    - <binding name="DiscoServerBinding" type="tns:DiscoServerPort">
      <soap:binding style="rpc" transport="ttp://schemas.xmlsoap.org/soap/http" /> 
    - <operation name="add">
      <soap:operation soapAction="urn:ServiceClass#ServiceClass#add" /> 
    - <input>
      <soap:body use="encoded" namespace="urn:ServiceClass" encodingStyle="ttp://schemas.xmlsoap.org/soap/encoding/" /> 
      </input>
    - <output>
      <soap:body use="encoded" namespace="urn:ServiceClass" encodingStyle="ttp://schemas.xmlsoap.org/soap/encoding/" /> 
      </output>
      </operation>
      </binding>
    - <service name="DiscoServerService">
      <documentation /> 
    - <port name="DiscoServerPort" binding="tns:DiscoServerBinding">
      <soap:address location="ttp://w_w_w.myserver.com/soaptest/add.php" /> 
      </port>
      </service>
      </definitions>
    Attached Images Attached Images

  2. #2
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am having similar problems and im with powweb too.
    Guess thats the reason, the webservice works perfectly on localhost.



    I've heard a bad things about powweb but this is the first time i've had any problem with their service


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •