Thanks for the reply
I'm not getting any errors in my error log file. When I print a stack trace the exception is thrown at this line:
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) - methodName not found
The NuSoap (PHP) service code:
1
2
3
4 // NuSoap API
5 require_once('nusoap.php');
6
7 // Customers API
8 require_once('CustomerAccess.php');
9 require_once('Customer.php');
10
11 // create the server instance
12 $webServer = new soap_server();
13
14 $namespace = 'http://localhost/MacpellWebService/Server.php?wsdl';
15 $webServer->configureWSDL('MacpellWebService');
16 $webServer->wsdl->schemaTargetNamespace = $namespace;
17
18 // our individual customer type
19 $webServer->wsdl->addComplexType
20 (
21 'Customer',
22 'complexType',
23 'struct',
24 'all',
25 '',
26 array( 'CustomerID' => array('name' => 'CustomerID', 'type' => 'xsd:int'),
27 'LastName' => array('name' => 'LastName', 'type' => 'xsd:string'),
28 'FirstName' => array('name' => 'FirstName', 'type' => 'xsd:string'),
29 'Address' => array('name' => 'Address', 'type' => 'xsd:string'),
30 'City' => array('name' => 'City', 'type' => 'xsd:string'),
31 'Province' => array('name' => 'Province', 'type' => 'xsd:string'),
32 'PostalCode' => array('name' => 'PostalCode', 'type' => 'xsd:string'),
33 'PhoneNumber' => array('name' => 'PhoneNumber', 'type' => 'xsd:string'))
34 );
35
36 // our customer array type
37 $webServer->wsdl->addComplexType
38 (
39 'Customers',
40 'complexType',
41 'array',
42 '',
43 'SOAP-ENC:Array',
44 array(),
45 array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:Customer[]')),
46 'tns:Customer'
47 );
48
49
50 // register all the functions
51 $methodName = 'AddNewCustomer';
52 $input = array('customerInfo' => 'tns:Customer');
53 $output = array('return' => 'xsd:boolean');
54 $soapAction = false;
55 $style = 'rpc';
56 $use = 'encoded';
57 $description = 'A web service to add a new customer';
58 $webServer->register($methodName, $input, $output, $namespace, $soapAction, $style, $use, $description);
59
60 $methodName = 'DeleteCustomer';
61 $input = array('customerID' => 'xsd:int');
62 $output = array('return' => 'xsd:boolean');
63 $soapAction = false;
64 $style = 'rpc';
65 $use = 'encoded';
66 $description = 'A web service to delete a customer';
67 $webServer->register($methodName, $input, $output, $namespace, $soapAction, $style, $use, $description);
68
69 $methodName = 'EditCustomer';
70 $input = array('customerID' => 'xsd:int', 'customerInfo' => 'tns:Customer');
71 $output = array('return' => 'xsd:boolean');
72 $soapAction = false;
73 $style = 'rpc';
74 $use = 'encoded';
75 $description = 'A web service to edit a customer';
76 $webServer->register($methodName, $input, $output, $namespace, $soapAction, $style, $use, $description);
77
78 $methodName = 'GetCustomer';
79 $input = array('customerID' => 'xsd:int');
80 $output = array('return' => 'tns:Customer');
81 $soapAction = 'localhost/MacpellWebService/Server.php';
82 $style = 'rpc';
83 $use = 'encoded';
84 $description = 'A web service to get a customer';
85 $webServer->register($methodName, $input, $output, $namespace, $soapAction, $style, $use, $description);
86
87 $methodName = 'GetAllCustomers';
88 $input = array();
89 $output = array('return' => 'tns:Customers');
90 $soapAction = false;
91 $style = 'rpc';
92 $use = 'encoded';
93 $description = 'A web service to get all customers';
94 $webServer->register($methodName, $input, $output, $namespace, $soapAction, $style, $use, $description);
95
96 $methodName = 'SearchForCustomers';
97 $input = array('lastName' => 'xsd:string');
98 $output = array('return' => 'tns:Customers');
99 $soapAction = false;
100 $style = 'rpc';
101 $use = 'encoded';
102 $description = 'A web service to search for customers by last name';
103 $webServer->register($methodName, $input, $output, $namespace, $soapAction, $style, $use, $description);
104
105 $methodName = 'TestPrint';
106 $input = array('message' => 'xsd:string');
107 $output = array('return' => 'xsd:string');
108 $soapAction = false;
109 $style = 'rpc';
110 $use = 'encoded';
111 $description = 'A test print method';
112 $webServer->register($methodName, $input, $output, $namespace, $soapAction, $style, $use, $description);
113
114 $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
115 $webServer->service($HTTP_RAW_POST_DATA);
116
117
118
119 // our functions
120 function AddNewCustomer($customerInfo)
121 {
122 $customer_db = new CustomerAccess();
123 $customer = GetCustomerObject($customerInfo);
124 return $customer_db->AddNewCustomer($customer);
125
126 }
127
128 function DeleteCustomer($customerID)
129 {
130 $customber_db = new CustomerAccess();
131 return $customer_db->DeleteCustomer($customerID);
132 }
133
134 function EditCustomer($customerID, $customerInfo)
135 {
136 $customber_db = new CustomerAccess();
137 return $customer_db->EditCustomer($customerID, GetCustomerObject($customerInfo));
138
139 }
140
141 function GetCustomer($customerID)
142 {
143 $customer_db = new CustomerAccess();
144 return GetCustomerArray($customer_db->GetCustomer($customerID));
145 }
146
147 function GetAllCustomers()
148 {
149 $customer_db = new CustomerAccess();
150 $allCustomers = array();
151 $customers = $customer_db->GetCustomers();
152 for ($i = 0; $i < count($customers); $i++)
153 $allCustomers[$i] = GetCustomerArray($customers[$i]);
154
155 return $allCustomers;
156 }
157
158 function SearchForCustomers($lastName)
159 {
160 $customer_db = new CustomerAccess();
161 $matchingCustomers = array();
162 $customers = $customer_db->SearchForCustomers($lastName);
163 for ($i = 0; $i < count($customers); $i++)
164 $matchingCustomers[$i] = GetCustomerArray($customers[$i]);
165
166 return $matchingCustomers;
167 }
168
169 function TestPrint($message)
170 {
171 return "This is a message: " . $message;
172 }
173
174
175
176 // our supporting functions
177 function GetCustomerObject($customerInfo)
178 {
179 $customer = new Customer($customerInfo['LastName'], $customerInfo['FirstName']);
180 $customer->SetCustomerID($customerInfo['CustomerID']);
181 $customer->SetAddress($customerInfo['Address']);
182 $customer->SetCity($customerInfo['City']);
183 $customer->SetProvince($customerInfo['Province']);
184 $customer->SetPostalCode($customerInfo['PostalCode']);
185 $customer->SetPhoneNumber($customerInfo['PhoneNumber']);
186
187 return $customer;
188 }
189
190 function GetCustomerArray($customer)
191 {
192 $customerArray = array();
193
194 $customerArray['CustomerID'] = $customer->GetCustomerID();
195 $customerArray['LastName'] = $customer->GetLastName();
196 $customerArray['FirstName'] = $customer->GetFirstName();
197 $customerArray['Address'] = $customer->GetAddress();
198 $customerArray['City'] = $customer->GetCity();
199 $customerArray['Province'] = $customer->GetProvince();
200 $customerArray['PostalCode'] = $customer->GetPostalCode();
201 $customerArray['PhoneNumber'] = $customer->GetPhoneNumber();
202
203 return $customerArray;
204
205 }
206
207 ?>