Results 1 to 13 of 13

Thread: WSDL Problem

  1. #1
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts

    WSDL Problem

    I'll buy the person who can help me fix this numerous pints, as I've been at it for days and cant figure it out.
    My WSDL file keeps displaying a "prefix not bound to a namespace" error
    Code is as follows:
    Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <definitions name='policy'
      targetNamespace="http://localhost/PHP/policy.wsdl"
      xmlns:tns="http://localhost/PHP/policy.wsdl"
      xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
      xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsd1='http://localhost/PHP/policy.xsd'
     xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap12/"
     xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
     xmlns="http://schemas.xmlsoap.org/wsdl/">
    
    <message name='getQuote'>
      <part name='symbol' type='xsd1:string'/>
    </message>
    <message name='getQuoteResponse'>
      <part name='return' type='xsd1:string'/>
    </message>
    
    <portType name='policyPortType'>
      <operation name='getQuote'>
        <input message='tns:getQuote'/>
        <output message='tns:getQuoteResponse'/>
      </operation>
    </portType>
    
    <binding name="policySoap" type="tns:policyPortType">
    <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> 
    </binding>
    
    <service name='policyService'>
      <port name='policyPort' binding='tns:policySoap'>
        <SOAP:address location='http://localhost/PHP/server2'/>
      </port>
    </service>
    </definitions>
    if anyone can help, i'd be muchos happy
    Cheers guys,
    Steve

  2. #2
    Member
    Join Date
    Jul 2006
    Posts
    83
    Thanks
    0
    Thanked
    10 times in 9 posts
    You got capitalisation inconsistencies here. You defined SOAP (caps), but then later on use soap (lowercase). Just change
    Code:
    <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
    to
    Code:
    <SOAP:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
    and your error should go away.

  3. Received thanks from:

    Steve B (23-07-2007)

  4. #3
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts
    now i just get:
    Code:
    SoapFault exception: [Client] Function ("getQuote") is not a valid method for this service in /var/www/test2/client4.php:7
    Stack trace:
    #0 [internal function]: SoapClient->__call('getQuote', Array)
    #1 /var/www/test2/client4.php(7): SoapClient->getQuote('ibm')
    #2 {main}
    cheers for helping though

  5. #4
    Member
    Join Date
    Jul 2006
    Posts
    83
    Thanks
    0
    Thanked
    10 times in 9 posts
    That's an error in your client4.php file. Could you please post that file.

    Chances are that soap should be lowercase. So you might just want to change all the SOAP (uppercase) terms in the above XML file to soap (lowercase). You might want to do the same with WSDL.
    Last edited by Budding; 23-07-2007 at 03:31 PM.

  6. Received thanks from:

    Steve B (23-07-2007)

  7. #5
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts
    New policy.wsdl file:
    Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <definitions name='policy2'
      targetNamespace="http://localhost/test2/policy2.wsdl"
      xmlns:tns="http://localhost/test2/policy2.wsdl"
      xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
      xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsd1='http://localhost/test2/policy.xsd'
     xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap12/"
     xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
     xmlns="http://schemas.xmlsoap.org/wsdl/">
    
    <message name='getQuote'>
      <part name='symbol' type='xs:string'/>
    </message>
    <message name='getQuoteResponse'>
      <part name='return' type='xs:float'/>
    </message>
    
    <portType name='policyPortType'>
      <operation name='getQuote'>
        <input message='tns:getQuote'/>
        <output message='tns:getQuoteResponse'/>
      </operation>
    </portType>
    
    <binding name="policySoap" type="tns:policyPortType">
    <SOAP:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> 
    </binding>
    
    <service name='policyService'>
      <port name='policyPort' binding='tns:policySoap'>
        <SOAP:address location='http://localhost/test2/policy2.wsdl'/>
      </port>
    </service>
    </definitions>
    New client4.php file:
    Code:
    <?php
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
    $ini = ini_set("soap.wsdl_cache_enabled","0");
      $client = new SoapClient("http://localhost/test2/policy2.wsdl");
      try {
        echo "<pre>\n";
        print($client->getQuote("ibm"));
        echo "\n";
        print($client->getQuote("microsoft"));  
        echo "\n</pre>\n";
      } catch (SoapFault $exception) {
        echo $exception;      
      }
    ?>

  8. #6
    Member
    Join Date
    Jul 2006
    Posts
    83
    Thanks
    0
    Thanked
    10 times in 9 posts
    Yeah, change all the SOAP in policy.wsdl to soap.

  9. Received thanks from:

    Steve B (23-07-2007)

  10. #7
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts
    policy2.wsdl
    Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <definitions name='policy2'
      targetNamespace="http://localhost/test2/policy2.wsdl"
      xmlns:tns="http://localhost/test2/policy2.wsdl"
      xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope"
      xmlns:soap-enc="http://www.w3.org/2003/05/soap-encoding"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsd1='http://localhost/test2/policy.xsd'
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"
     xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
     xmlns="http://schemas.xmlsoap.org/wsdl/">
    
    <message name='getQuote'>
      <part name='symbol' type='xs:string'/>
    </message>
    <message name='getQuoteResponse'>
      <part name='return' type='xs:float'/>
    </message>
    
    <portType name='policyPortType'>
      <operation name='getQuote'>
        <input message='tns:getQuote'/>
        <output message='tns:getQuoteResponse'/>
      </operation>
    </portType>
    
    <binding name="policySoap" type="tns:policyPortType">
    <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> 
    </binding>
    
    <service name='policyService'>
      <port name='policyPort' binding='tns:policySoap'>
        <soap:address location='http://localhost/test2/server2.php'/>
      </port>
    </service>
    </definitions>
    client4.php
    Code:
    <?php
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
    $ini = ini_set("soap.wsdl_cache_enabled","0");
      $client = new SoapClient("http://localhost/test2/policy2.wsdl");
      try {
        echo "<pre>\n";
        print($client->getQuote("ibm"));
        echo "\n";
        print($client->getQuote("microsoft"));  
        echo "\n</pre>\n";
      } catch (SoapFault $exception) {
        echo $exception;      
      }
    ?>
    server2.php
    Code:
    <?php
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
    class QuoteService {
      private $quotes = array("ibm" => 98.44, "microsoft" => 101.34);  
    
      function getQuote($symbol) {
        if (isset($this->quotes[$symbol])) {
          return $this->quotes[$symbol];
        } else {
          throw new SoapFault("Server","Unknown Symbol '$symbol'.");
        }
      }
    }
    
    $server = new SoapServer("policy2.wsdl");
    $server->setClass("QuoteService");
    $server->handle();
    ?>
    upon accessing client4.php:
    not a valid method.

  11. #8
    Member
    Join Date
    Jul 2006
    Posts
    83
    Thanks
    0
    Thanked
    10 times in 9 posts
    I don't suppose changing WSDL to lowercase makes any difference? Have you tried using relative links for your new SoapClient() function? I'm assuming the invalid method is still getQuote()?

  12. #9
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts
    still no different

  13. #10
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts
    anyone?

  14. #11
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    Is it not $client->call('methodName', $params); ?
    To err is human. To really foul things up ... you need a computer.

  15. #12
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    To err is human. To really foul things up ... you need a computer.

  16. #13
    The King of Vague Steve B's Avatar
    Join Date
    Oct 2005
    Location
    Glasgow
    Posts
    5,051
    Thanks
    116
    Thanked
    67 times in 63 posts
    modifying to:
    Code:
    print($client->__soapCall("getQuote", array("ibm")));
    makes no difference, it still gives me the getQuote not a valid service

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem with Xbox 360 and Samsung TFT
    By JamesD in forum Help! Quick Relief From Tech Headaches
    Replies: 8
    Last Post: 15-11-2007, 01:49 PM
  2. IE7 problem - please help?
    By SkyNetworks in forum Help! Quick Relief From Tech Headaches
    Replies: 5
    Last Post: 20-06-2007, 09:36 PM
  3. CD/DVD drive problem
    By scratched in forum Help! Quick Relief From Tech Headaches
    Replies: 5
    Last Post: 22-03-2006, 04:12 PM
  4. X360 & Samsung SM 930bf Problem
    By JamesD in forum Gaming
    Replies: 0
    Last Post: 08-02-2006, 05:52 PM
  5. gf4 ti4200 screen standby problem.
    By Pete in forum Graphics Cards
    Replies: 3
    Last Post: 14-11-2004, 12:02 AM

Posting Permissions

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