Advertisement

04.21.2008 at 11:52PM PDT, ID: 23342008
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

How to make this WSDL file valid to be able to use with PHP SOAP extension?

Asked by COS_IT_AU in PHP for Windows, Extensible Markup Language (XML), SOAP

Tags: , , ,

I have tried to created a WSDL file ( http://users.tpg.com.au/lymber//COS_PDA_WSDL.wsdl ) to describe my PHP class to use with PHP SOAP extension. But the WSDL file fails validation when passed through a validator at http://www.xmethods.net/ve2/Tools.po The following errors are reported:
    * Service "COS_PDA_SERVICE" : Port "COS_PDA_PORT" points to undefined binding
    * Message for input element of operation "getParcels" is undefined
    * Message for output element of operation "getParcels" is undefined
    * Binding "COS_PDA_SERVER_BINDING" references undefined PortType

And when i do a call with the following function  (__getFunctions() )  i get:
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$client = new SoapClient("http://users.tpg.com.au/lymber//COS_PDA_WSDL.wsdll", array('trace' => 1));
$result = $client->__getFunctions();
echo "<pre>"; print_r($result); echo "</pre>";

THIS IS WHAT IS DISPLAYED ON THE BROWSER:

Array
(
    [0] => UNKNOWN getParcels(UNKNOWN $parameters)
)

But when i do the same but with other WSDL files like (http://soap.search.msn.com/webservices.asmx?wsdl and http://api.google.com/GoogleSearch.wsdl) i get the following.
For MSN search wsdl:
Array
(
    [0] => SearchResponse Search(Search $parameters)
)

For google wsdl:
Array
(
    [0] => base64Binary doGetCachedPage(string $key, string $url)
    [1] => string doSpellingSuggestion(string $key, string $phrase)
    [2] => GoogleSearchResult doGoogleSearch(string $key, string $q, int $start, int $maxResults, boolean $filter, string $restrict, boolean $safeSearch, string $lr, string $ie, string $oe)
).

Is somebody able to identify what is wrong with my WSDL file i have created for the following class.

I want the XML response to look like this:
<Response>
  <Status>200 </Status
  <Parcels>
   <Parcel>
    <order_number> 1 </order_number>
    <backorder_suffix>yy </backorder_suffix>
    <order_status> xxx </order_status>
    <driver_no> xxx </driver_no>
    <warehouse_code 123 </warehouse_code>
    <packtype_id> xxxx </packtype_id>
    <bulk_item> Y </bulk_item>
    <bulk_stk_code> xxx </bulk_stk_code>
    <bulk_qty> 5 </bulk_qty>
    <label_id> xxxx </label_id>
   <Parcel>
   <Parcel>
    <order_number> 2</order_number>
    <backorder_suffix>yy </backorder_suffix>
    <order_status> xxx </order_status>
    <driver_no> xxx </driver_no>
    <warehouse_code 123 </warehouse_code>
    <packtype_id> xxxx </packtype_id>
    <bulk_item> Y </bulk_item>
    <bulk_stk_code> xxx </bulk_stk_code>
    <bulk_qty> 5 </bulk_qty>
    <label_id> xxxx </label_id>
   <Parcel>
  <Parcels>
<Response>Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
//Code for the class
include_once('functions/errorHandler.php');
class Soap_PDA
{
	var $dbh;			// The database connection for this class
	var $dbh2;			// The database connection for this class
	var $error = '';	// Error messages returned stored in the class
	
	/******************************************************************************************************
	*	Class Constructor, creates a database connection
	*******************************************************************************************************/
	function Soap_PDA()
	{
		// Connect to the database
		include('includes/cosdb.conf');
		$this->dbh = $dbh;
		$this->dbh2 = $dbh2;
	}
	
	function authenticate_driver($driverNo, $password){
		return true;
	}
//this function stores the result from DB
	function storeResult($output_array, $result){
		$i = 0;
		while ($row = ifx_fetch_row($result)){
			while (list($key, $val) = each($row)){
				$output_array[$i][$key] = trim($val);
			}
			$i++;
		}
		return($output_array);
	}
 
	
	//This function will get a drivers package details so they can scan them in the WH
	function getParcels($driverNo, $password){
		//Authenticate driver
		if (!$this->authenticate_driver($driverNo, $password)){
			$this->error = "Authentication failed";
			return false;
		}
		$status = 200; //status for everything is OK
		$sql = "SELECT a.order_number,  
			a.backorder_suffix, 
			a.order_status, 
			a.driver_no,
			a.warehouse_code,
			b.packtype_id, 
			b.pklbl_type, 
			b.pklbl_stkcode, 
			b.pklbl_stkqty, 
			b.label_id  
			FROM sales_order a, so_pack_details b 
			WHERE a.order_status IN ('66', '76') 
			AND a.driver_no = '".$driverNo."' 
			AND (b.pklbl_scanbin = 'Y' OR b.pklbl_scanbin is null) 
			AND a.order_number = b.order_number 
			AND	a.backorder_suffix = b.backorder_suffix";
		
		$result = ifx_query($sql, $this->dbh);
		if (!$result) {
			$this->error = "Database Error: Unable to perform query (getParcels)";
			errorHandler("Soap_PDA.class.php $this->error", $sql, 3);
			$status = 500;
			return array($status, $result_array);
		}
		$result_array = $this->storeResult($result_array, $result);
		if ($result){
			ifx_free_result($result);
		}
return array($status, $result_array);				
	}//end function
}//end class
 
 
//code for the server
include_once('classes/Soap_PDA.class.php');
 
function getParcels($driver_no, $password){
	$Soap_PDA_OBJ = new Soap_PDA();
	list($status, $result) = $Soap_PDA_OBJ->getParcels($driver_no, $password);
	
	if ($status == 500){
		return new SoapFault("Server", $Soap_PDA_OBJ->error);
	}
	
	return array($status, $result);
}
 
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("http://users.tpg.com.au/lymber//COS_PDA_WSDL.wsdl");
$server->addFunction(SOAP_FUNCTIONS_ALL);
$server->handle();
 
Loading Advertisement...
 
[+][-]04.22.2008 at 03:04AM PDT, ID: 21409401

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP for Windows, Extensible Markup Language (XML), SOAP
Tags: PHP, WSDL, PHP SOAP extension, Firefox 2, http://users.tpg.com.au/lymber//COS_PDA_WSDL.wsdl, WSDL Validation Errors
Sign Up Now!
Solution Provided By: shivaspk
Participating Experts: 1
Solution Grade: B
 
 
[+][-]04.22.2008 at 06:41AM PDT, ID: 21410983

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628