Advertisement

08.05.2008 at 07:33AM PDT, ID: 23622347
[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!

8.7

PHP:SOAP - Complex Types

Asked by BadRomeo in SOAP, PHP Scripting Language, Web Services Description Language

Tags:

I am trying to communicate with a soap webservice.  Below is the WSDL and how the XML should look and here is my request and response from the debug as well as the php code.  I think it may have something to do with the complex type??  What am I doing wrong?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:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
$client = new SoapClient('**********?WSDL',array("trace" => 1,"exceptions" => 0));
	
	$ipaddress = "69.20.57.134";
	$stamp = date('c');
	$returnCode = rand(100,9999999999999999999999999999999999999999999999999999999999);
	$commentMode = "na";
	$rid = rand(100,99999999999999999999999999999999999999999999999999999999999999999);
	
	
			$FirstName 	= $_POST['first_name'];
			$LastName  	= $_POST['last_name'];
			$Title 		= $_POST['affiliation'];
			$Address 	= $_POST['address'];
			$City 		= $_POST['city'];
			$State 		= $_POST['state'];
			$Country 	= $_POST['country'];
			$Zip 		= $_POST['zip'];
			$Email 		= $_POST['email'];
			$PhoneNumber = $_POST['telephone'];
			$CommentText = $_POST['comments'];
 
	$params = array (
			"FirstName" 	=> $FirstName,
			"LastName"  	=> $LastName,
			"Title" 		=> $Title,
			"Address" 		=> $Address,
			"City" 			=> $City,
			"State" 		=> $State,
			"Country" 		=> $Country,
			"Zip" 			=> $Zip,
			"Email" 		=> $Email,
			"PhoneNumber" 	=> $PhoneNumber,
			"CommentText"	=> $CommentText,
			"IPAddress"		=> $ipaddress, //$_POST['ipaddress'],
			"DocumentDate"	=> $stamp,
			"ReturnCode"	=> $returnCode,
			"CommentMode"	=> $commentMode,
			"RID"			=> $rid,
			"MailingListSelection" => 'none'
			);
 
 
print"<hr />";
print($client->SubmitComment('SubmitComment',$params));
print"<hr />";
print_r($params);
 
 
 
print "<br /><br />";
print "<strong>Request</strong> ".htmlspecialchars($client->__getLastRequest());
print "<br /><br />";
print "<strong>Response</strong> ".htmlspecialchars($client->__getLastResponse());
print"<hr />";
 
 
--------------------------------------------------------------------
 
POST /ttc/piservice/piservice.asmx HTTP/1.1
Host: www.***.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SubmitComment xmlns="http://www.******.com/">
      <submittedComment FirstName="string" LastName="string" Title="string" Address="string" City="string" State="string" Country="string" Zip="string" Email="string" PhoneNumber="string" CommentText="string" IPAddress="string" DocumentDate="date" ReturnCode="string" CommentMode="string" RID="integer">
        <MailingListSelection>Email or Mail or None or Both</MailingListSelection>
      </submittedComment>
    </SubmitComment>
  </soap12:Body>
</soap12:Envelope>
 
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
 
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <SubmitCommentResponse xmlns="http://www.****.com/">
      <SubmitCommentResult FirstName="string" LastName="string" Title="string" Address="string" City="string" State="string" Country="string" Zip="string" Email="string" PhoneNumber="string" CommentText="string" IPAddress="string" DocumentDate="date" ReturnCode="string" CommentMode="string" RID="integer">
        <MailingListSelection>Email or Mail or None or Both</MailingListSelection>
      </SubmitCommentResult>
    </SubmitCommentResponse>
  </soap12:Body>
</soap12:Envelope>
 
--------------------------------------------------------------------
<wsdl:definitions targetNamespace="http://www.***.com/">

<wsdl:types>

<s:schema elementFormDefault="qualified" targetNamespace="http://www.***.com/">

<s:element name="SubmitComment">

<s:complexType>

<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="submittedComment" type="tns:Comment"/>
</s:sequence>
</s:complexType>
</s:element>

<s:complexType name="Comment">

<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="MailingListSelection" type="tns:MailingListElection"/>
</s:sequence>
<s:attribute name="FirstName" type="s:string"/>
<s:attribute name="LastName" type="s:string"/>
<s:attribute name="Title" type="s:string"/>
<s:attribute name="Address" type="s:string"/>
<s:attribute name="City" type="s:string"/>
<s:attribute name="State" type="s:string"/>
<s:attribute name="Country" type="s:string"/>
<s:attribute name="Zip" type="s:string"/>
<s:attribute name="Email" type="s:string"/>
<s:attribute name="PhoneNumber" type="s:string"/>
<s:attribute name="CommentText" type="s:string"/>
<s:attribute name="IPAddress" type="s:string"/>
<s:attribute name="DocumentDate" type="s:date" use="required"/>
<s:attribute name="ReturnCode" type="s:string"/>
<s:attribute name="CommentMode" type="s:string"/>
<s:attribute name="RID" type="s:integer"/>
</s:complexType>

<s:simpleType name="MailingListElection">

<s:restriction base="s:string">
<s:enumeration value="Email"/>
<s:enumeration value="Mail"/>
<s:enumeration value="None"/>
<s:enumeration value="Both"/>
</s:restriction>
</s:simpleType>

<s:element name="SubmitCommentResponse">

<s:complexType>

<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="SubmitCommentResult" type="tns:Comment"/>
</s:sequence>
</s:complexType>
</s:element>

<s:element name="SubmitMailingListRegistration">

<s:complexType>

<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="submittedMailingListRegistration" type="tns:MailingListRegistration"/>
</s:sequence>
</s:complexType>
</s:element>

<s:complexType name="MailingListRegistration">

<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="MailingListSelection" type="tns:MailingListElection"/>
</s:sequence>
<s:attribute name="FirstName" type="s:string"/>
<s:attribute name="LastName" type="s:string"/>
<s:attribute name="Title" type="s:string"/>
<s:attribute name="Address" type="s:string"/>
<s:attribute name="City" type="s:string"/>
<s:attribute name="State" type="s:string"/>
<s:attribute name="Country" type="s:string"/>
<s:attribute name="Zip" type="s:string"/>
<s:attribute name="Email" type="s:string"/>
<s:attribute name="PhoneNumber" type="s:string"/>
<s:attribute name="IPAddress" type="s:string"/>
<s:attribute name="DocumentDate" type="s:date" use="required"/>
<s:attribute name="ReturnCode" type="s:string"/>
<s:attribute name="CommentMode" type="s:string"/>
<s:attribute name="RID" type="s:integer"/>
</s:complexType>

<s:element name="SubmitMailingListRegistrationResponse">

<s:complexType>

<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="SubmitMailingListRegistrationResult" type="s:boolean"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>

<wsdl:message name="SubmitCommentSoapIn">
<wsdl:part name="parameters" element="tns:SubmitComment"/>
</wsdl:message>

<wsdl:message name="SubmitCommentSoapOut">
<wsdl:part name="parameters" element="tns:SubmitCommentResponse"/>
</wsdl:message>

<wsdl:message name="SubmitMailingListRegistrationSoapIn">
<wsdl:part name="parameters" element="tns:SubmitMailingListRegistration"/>
</wsdl:message>

<wsdl:message name="SubmitMailingListRegistrationSoapOut">
<wsdl:part name="parameters" element="tns:SubmitMailingListRegistrationResponse"/>
</wsdl:message>

<wsdl:portType name="PIServiceSoap">

<wsdl:operation name="SubmitComment">
<wsdl:input message="tns:SubmitCommentSoapIn"/>
<wsdl:output message="tns:SubmitCommentSoapOut"/>
</wsdl:operation>

<wsdl:operation name="SubmitMailingListRegistration">
<wsdl:input message="tns:SubmitMailingListRegistrationSoapIn"/>
<wsdl:output message="tns:SubmitMailingListRegistrationSoapOut"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="PIServiceSoap" type="tns:PIServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="SubmitComment">
<soap:operation soapAction="http://www.***.com/SubmitComment" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="SubmitMailingListRegistration">
<soap:operation soapAction="http://www.***.com/SubmitMailingListRegistration" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:binding name="PIServiceSoap12" type="tns:PIServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="SubmitComment">
<soap12:operation soapAction="http://www.****.com/SubmitComment" style="document"/>

<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="SubmitMailingListRegistration">
<soap12:operation soapAction="http://www.***.com/SubmitMailingListRegistration" style="document"/>

<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="PIService">

<wsdl:port name="PIServiceSoap" binding="tns:PIServiceSoap">
<soap:address location="http://www.****.com/ttc/piservice/piservice.asmx"/>
</wsdl:port>

<wsdl:port name="PIServiceSoap12" binding="tns:PIServiceSoap12">
<soap12:address location="http://www.****.com/ttc/piservice/piservice.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
 
 
 
--------------------------------------------------------------
 
 
Request:
 
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.i-69ttc.com/">
	<SOAP-ENV:Body>
		<ns1:SubmitComment/>
		<param1>
			<item>
				<key>FirstName</key>
				<value>test</value>
			</item>
			<item>
				<key>LastName</key>
				<value>test</value>
			</item>
			<item>
				<key>Title</key>
				<value>test</value>
			</item>
			<item>
				<key>Address</key>
				<value>test</value>
			</item>
			<item>
				<key>City</key>
				<value>test</value>
			</item>
			<item>
				<key>State</key>
				<value>TX</value>
			</item>
			<item>
				<key>Country</key>
				<value>United States</value>
			</item>
			<item>
				<key>Zip</key>
				<value>44444</value>
			</item>
			<item>
				<key>Email</key>
				<value>asdf@aef.com</value>
			</item>
			<item>
				<key>PhoneNumber</key>
				<value>asdf</value>
			</item>
			<item>
				<key>CommentText</key>
				<value>asdf</value>
			</item>
			<item>
				<key>IPAddress</key>
				<value>69.20.57.134</value>
			</item>
			<item>
				<key>DocumentDate</key>
				<value>2008-08-05T10:22:00-04:00</value>
			</item>
			<item>
				<key>ReturnCode</key>
				<value>46</value>
			</item>
			<item>
				<key>CommentMode</key>
				<value>na</value>
			</item>
			<item>
				<key>RID</key>
				<value>52</value>
			</item>
			<item>
				<key>MailingListSelection</key>
				<value>none</value>
			</item>
		</param1>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 
 
Response:
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<soap:Body>
		<soap:Fault>
			<faultcode>soap:Server</faultcode>
			<faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object. at CommentSubmissionService.PIService.ValidateCommentData(Comment&amp; submittedComment) in C:\Projects\I69PILogsComments\CommentSubmissionService\PIService.asmx.cs:line 61 at CommentSubmissionService.PIService.SubmitComment(Comment submittedComment) in C:\Projects\I69PILogsComments\CommentSubmissionService\PIService.asmx.cs:line 33 --- End of inner exception stack trace ---</faultstring>
			<detail />
		</soap:Fault>
	</soap:Body>
</soap:Envelope>
Related Solutions: Declare SoapAction
[+][-]08.06.2008 at 01:25PM PDT, ID: 22174728

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]08.06.2008 at 02:18PM PDT, ID: 22175259

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.

 
[+][-]08.06.2008 at 02:28PM PDT, ID: 22175328

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]08.06.2008 at 02:49PM PDT, ID: 22175506

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.

 
[+][-]08.06.2008 at 02:53PM PDT, ID: 22175529

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.

 
[+][-]08.06.2008 at 02:56PM PDT, ID: 22175550

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]08.06.2008 at 02:56PM PDT, ID: 22175552

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]08.06.2008 at 09:51PM PDT, ID: 22177964

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.

 
[+][-]08.07.2008 at 06:07AM PDT, ID: 22180514

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

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

 
[+][-]08.08.2008 at 06:56AM PDT, ID: 22189886

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.

 
[+][-]08.08.2008 at 07:01AM PDT, ID: 22189924

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: SOAP, PHP Scripting Language, Web Services Description Language
Tags: PHP:SOAP
Sign Up Now!
Solution Provided By: virmaior
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628