By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,661 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

Php + Weblogic 8.1

P: 15
Hey does anyone know if it is possible to access a WEBLOGIC web service via php? I was thinking I might be able to access the web service using php's NUSOAP, and it works kinda. I can access the web service but I can't seem to pass variables or values to the web service. Any idea?
Jul 26 '07 #1
Share this Question
Share on Google+
2 Replies


pbmods
Expert 5K+
P: 5,821
Heya, EpicOfChaos.

What is the server sending back to you? Are you getting a server error, or is it throwing back 'malformed XML' errors?
Jul 26 '07 #2

P: 15
here is my php code:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <?php
  10. require_once('lib/nusoap.php');
  11.  
  12. $client = new soapclient('http://localhost:7001/MyJWSProject/Hello.jws?WSDL',true);
  13.  
  14. $err = $client->getError();
  15. if ($err) {
  16.     // Display the error
  17.     echo '<p><b>Constructor error: ' . $err . '</b></p>';
  18.     // At this point, you know the call that follows will fail
  19. }
  20. // Call the SOAP method
  21.  
  22. $result = $client->call('hello_synch',array('name' => "brody"));
  23. // Check for a fault
  24. if ($client->fault) {
  25.     echo '<p><b>Fault: ';
  26.     print_r($result);
  27.     echo '</b></p>';
  28. } else {
  29.     // Check for errors
  30.     $err = $client->getError();
  31.     if ($err) {
  32.         // Display the error
  33.         echo '<p><b>Error: ' . $err . '</b></p>';
  34.     } else {
  35.         // Display the result
  36.         //echo"printing result";
  37.         print_r($result);
  38.     }
  39. }
  40.  
  41. echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
  42. echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
  43. echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
  44. ?>
  45. </body>
  46. </html>
  47.  
  48.  
And here is the Weblogic webservice function:

Expand|Select|Wrap|Line Numbers
  1.  /**
  2.      * @common:operation
  3.      */
  4.     public String hello_synch(String name)
  5.     {
  6.         return "Hello, " + name;
  7.     }
  8.  
  9.  
And this is the output when I run it:

Array ( [hello_synchResult] => Hello, null )
Request

POST /MyJWSProject/Hello.jws HTTP/1.0
Host: 10w8w21:7001
User-Agent: NuSOAP/0.7.2 (1.94)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: "http://www.openuri.org/hello_synch"
Content-Length: 410

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns6838="http://tempuri.org"><SOAP-ENV:Body><hello_synch xmlns="http://www.openuri.org/"/></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response

HTTP/1.1 200 OK
Date: Thu, 26 Jul 2007 17:28:33 GMT
Pragma: no-cache
Server: WebLogic Server 8.1 SP3 Tue Jun 29 23:11:19 PDT 2004 404973 WebLogic Server 8.1 SP3 Tue Jun 29 23:11:19 PDT 2004 404973 WebLogic Server 8.1 SP3 Tue Jun 29 23:11:19 PDT 2004 404973
Content-Length: 415
Content-Type: text/xml; charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache
Connection: Close

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns:hello_synchResponse xmlns:ns='http://www.openuri.org/'><ns:hello_synchResult>Hello, null</ns:hello_synchResult></ns:hello_synchResponse> </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

************************************************** ******************
So it is running the service, but the variables are not being passed, it is getting null, and if you look at the request it doesn't even have them, so I must be doing something wrong when passing those using NuSOAP
Jul 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.