Results 1 to 4 of 4

Thread: [RESOLVED] Java web service from a php client

  1. #1

    Thread Starter
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Resolved [RESOLVED] Java web service from a php client

    Dear who ever reads this

    I have a Java web service using JAX-B. Recently I've been trying to use php to write a client side for this service. Everything has been working good, Php is still as cool as I've left it. I just have a small problem I don't know if it's me or php5.3.

    One of my Java web methods returns an array of integers. php gets the response as hashtable - using $client->__getTypes() - which is good. but if I tried to var_dump items in the hashtable I get:
    object(stdClass)#3 (0) { }
    object(stdClass)#4 (0) { }
    object(stdClass)#5 (0) { }
    object(stdClass)#6 (0) { }
    object(stdClass)#7 (0) { }
    object(stdClass)#8 (0) { }
    object(stdClass)#9 (0) { }
    where it should be [29, 32, 36, 37, 38, 39, 66]

    Any ideas?
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Java web service from a php client

    What code are you using?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Java web service from a php client

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    	<head>
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                    <title></title>
            </head>
            <body>
                    <?php
                    $wsdl_url = 'http://localhost/app/myservice?wsdl';
                    $client     = new SoapClient($wsdl_url);
    		echo '<p>';
    		var_dump($client->__getTypes());
    		echo '</p>';
                    $params   = array(
                            'username' => 'test-user',
                            'passwordMD5' => md5("asdasd")
                    );
                    $ret = $client->listProjects($params)->return;
    		echo '<b>Result:</b><br />';
    		var_dump($ret);
    		echo '<br /><b>Values</b><br />';
    		foreach ($ret as $x) {
    			var_dump($x);
    			echo '<br />';
    		}
                    ?>
    	</body>
    </html>
    PHP version: PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23 2009 14:35:05)
    Apache Version: Server version: Apache/2.2.11 (Ubuntu)
    Ubuntu Version: Linux my-desktop 2.6.28-14-generic #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009 i686 GNU/Linux
    Last edited by ComputerJy; Aug 18th, 2009 at 04:42 AM. Reason: Adding host info
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4

    Thread Starter
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Java web service from a php client

    Never mind this problem I was able to solve it. If anyone faces this.

    I'm using Netbeans as my Java IDE. For some reason netbeans decided to change the generated wsdl file name. but not the url assigned to it (thats how servlets work).

    Anyway I just deleted the original wsdl file (and it's xsd) found in: '$ProjectName\web\WEB-INF\wsdl\$HostName_$Port\$WebServiceName$' and rebuilt the project. And now it works. Not a php problem after all
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

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



Click Here to Expand Forum to Full Width