• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1016
  • Last Modified:

When attempting a sample webservice (SOAP request, using PHP), I'm getting an error that the function is Not Found

I'm trying to follow the sample script here:

http://www.oreillynet.com/pub/a/php/2007/07/26/php-web-services.html

I'm using my ISP account, and I've created a folder called 'webservice' under the main root (http://mydomain.com/webservice/) under which I have placed the sample files catalog.wsdl, soap_client.php, and soap_server.php

I'm a novice at php and know NOTHING about soap, so this is a stretch assignment for me.  In the service block of the WSDL (posted below) I cnaged the tag:
<soap:address location='http://localhost/soap-server.php'/>
to
<soap:address location='http://mydomain.com/webservice/soap-server.php'/>

but  Istill get the error message:

Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in /home/paul/public_html/webservice/soap-client.php:4 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://localhos...', 'urn:localhost-c...', 1, 0) #1 [internal function]: SoapClient->__call('getCatalogEntry', Array) #2 /home/paul/public_html/webservice/soap-client.php(4): SoapClient->getCatalogEntry('catalog1') #3 {main} thrown in /home/paul/public_html/webservice/soap-client.php on line 4
<?xml version ='1.0' encoding ='UTF-8' ?> 
<definitions name='Catalog'
  targetNamespace='http://mydomain.com/webservice/catalog'
  xmlns:tns='http://mydomain.com/webservice/catalog'
  xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
  xmlns:xsd='http://www.w3.org/2001/XMLSchema'
  xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding'
  xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
  xmlns='http://schemas.xmlsoap.org/wsdl/'> 
 
<message name='getCatalogRequest'> 
  <part name='catalogId' type='xsd:string'/> 
</message> 
<message name='getCatalogResponse'> 
  <part name='Result' type='xsd:string'/> 
</message> 
 
<portType name='CatalogPortType'> 
  <operation name='getCatalogEntry'> 
    <input message='tns:getCatalogRequest'/> 
    <output message='tns:getCatalogResponse'/> 
  </operation> 
</portType> 
 
<binding name='CatalogBinding' type='tns:CatalogPortType'> 
  <soap:binding style='rpc' 
    transport='http://schemas.xmlsoap.org/soap/http'
  /> 
  <operation name='getCatalogEntry'> 
    <soap:operation soapAction='urn:localhost-catalog#getCatalogEntry'/> 
    <input> 
      <soap:body use='encoded' namespace='urn:localhost-catalog' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </input> 
    <output> 
      <soap:body use='encoded' namespace='urn:localhost-catalog' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
    </output> 
  </operation> 
</binding> 
 
<service name='CatalogService'> 
  <port name='CatalogPort' binding='CatalogBinding'> 
    <soap:address location='http://mydomain.com/webservice/soap-server.php'/> 
  </port> 
</service>
</definitions>

Open in new window

0
PaultheBroker
Asked:
PaultheBroker
  • 2
1 Solution
 
PaultheBrokerAuthor Commented:
php is version 5.2.6
0
 
Ray PaseurCommented:
No offense meant, but why are you using SOAP?  As you can see, it is one of the most complicated ways to consume web services because it requires the calling programs to have some knowledge of the structure and behavior of the service.

A simpler way to do this is called "REST" and without writing a huge post, let me outline the basics.

The calling program sends all its inquiry parameters via the URL, including an API key that authenticates the identity of the caller.

The web service returns all its response data in a comma-separated string (CSV) or XML.  

There are no "exposed internals" on the web service side, every call is atomic and complete.  The result is a simple and dependable interface that works every time.

The "Hello World" of RESTful web services is the Yahoo Geocoder API.  You can read about it here:
http://developer.yahoo.com/maps/rest/V1/geocode.html

Hope that helps, ~Ray
0
 
Ray PaseurCommented:
Thanks for the points - as you may have guessed, I am a bit of a REST evangelist.  I hope the answer was helpful, ~Ray
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now