Question

convert asp soap request to php soap request

Asked by: rwinnick

I am new to xml and web services -
I  have an example of a web service request in asp and need to get it into php
I have spent hours trying to understand soap wsdl etc and get this to work with no luck
I would appreciate it if someone would show me what this should look like in php
I have changed some of the parameters as they are for a private web service
thanks
Richard

<%@  language="VBScript" %>
<html>
<head>
    <title>example</title>
</head>
<body>
<%
	Dim username
	strResp = createInputXmlDoc()
	
	Function createInputXmlDoc()
		Dim oDoc
        Dim strReq
 
		strReq = "<?xml version='1.0' encoding='utf-8'?>" & _
				"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"&_
  				"<soap:Body>"&_
					"<GetReport xmlns='http://temple.org/'>" & _
                       "<login>"&_
					   		"<username>admin</username>" & _
                       		"<password>#hotel123</password>" & _
	                   		"<hotelAccount>v123hotel</hotelAccount> " & _
				       "</login>"&_
					   "<startDate>5/1/2009</startDate>" & _
					   "<EndingDate>5/30/2009</EndingDate>" & _
                	"</GetReport>"&_
					"</soap:Body>"&_
					"</soap:Envelope>"
	
		Set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
		xmlhttp.Open "POST"," http://agent3.hotel.com/BFAPI/Report.asmx?WSDL",false
		xmlhttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"
		xmlhttp.setRequestHeader "HOST","agent3.hotel.com"
		xmlhttp.setRequestHeader "Content-Length",LEN(SoapRequest)
		xmlhttp.setRequestHeader "SOAPAction", "http://temple.org/GetReport" 
		xmlhttp.Send(strReq)		
		
		If xmlhttp.Status = 200 Then
 
		Set xmlDOC = server.CreateObject("MSXML.DOMDocument")
		xmlDOC.load(xmlhttp.responseXML)
		'Response.Write xmlDOC.documentElement.selectNodes("a_name").text 'show a node
		Response.Write xmlDOC.documentElement.ChildNodes.item(0).text 
		Set xmlDOC = nothing
		
		Else
		
		'Response.Write xmlhttp.Status&"&nbsp;"
		'Response.Write xmlhttp.StatusText
		
		
		End if
		Set xmlhttp = Nothing
	End Function	
	
%>
</body>
</html>

                                  
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:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-14 at 16:35:34ID24731385
Tags

asp php soap wsdl

Topics

SOAP

,

PHP for Windows

,

Active Server Pages (ASP)

Participating Experts
1
Points
500
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Pear Soap WSDL Timeout
    <?php require_once('SOAP/Client.php'); $wsdl=new SOAP_WSDL('http://w.co.uk/CarQuotes?wsdl'); ?> How can I increase the timeout period for the above object ?
  2. SOAP With Attachments in PHP
    What is wrong with this php script. Unable to retrieve the attachment $soap_out = 'Content-Type: multipart/related; boundary=5314073.1204113495567; type="text/xml"; start="25296894.1204113495567I" --5314073.1204113495567 Content-Type: text/xml; charset=...
  3. SOAP and WSDL with PHP
    Hi. Brand new to SOAP services. Implementing a simple service to validate a code. The code is used to uniquely identify a fax - we get around 2,500 a day and each one is automatically given a unique code which represents the date and time the fax arrived and the page numbe...
  4. PHP, WSDL, SOAP related problem
    I am not sure why it is not recognizing the encoding style, any help will be greatly appreciated. The error message is listed below Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Unknown encodingStyle 'http://www.w3.org/2001/12/soap-encoding' in...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: SilhouettePosted on 2009-09-15 at 03:20:31ID: 25333399

Hi,

I am not sure what version of PHP you are using but if you are using version 5 then the following code might help

<?php
 
  try { 
		$client = new SoapClient("http://localhost/WebService1/Service1.asmx?WSDL",array( 
		"trace"      => 1)); 
		$output = $client->GetReport(
				array(
					"login" => array(
						"username"=> "admin",
						"password"=>"#hotel123",
						"hotelAccount"=>"v123hotel"
					),
					"startDate" => "5/1/2009",
					"EndingDate" => "5/30/2009"
				)
			); 
		print "<pre>\n"; 
		print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n"; 
		print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n"; 
		print "output:\n";
		print_r($output); 
		
		print "</pre>"; 
  } 
  catch (SoapFault $exception) { 
    echo $exception;       
  } 
 
?>

                                              
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:

Select allOpen in new window

 

by: rwinnickPosted on 2009-09-15 at 09:58:31ID: 25336955

Hi Silhouette:

Perfect!  works like a dream - I can't believe after how many hours I spent trying to figure this out how 'clean' it is - this has really helped my understanding -
I also found out when I went to check what php version I was using that the soap stuff was not installed -
So thanks twice :-)
Would it be too much of an effort to ask how I  would take the result of this request and add it to a table in a mysql db without all the xml tags ?
If necessary I will increase points -
Really appreciate your help on this -

Richard

 

by: SilhouettePosted on 2009-09-15 at 10:03:57ID: 25336999

Hi Richard,

Glad to hear it works, if you post a copy of the response I will take a look at it and see if I can help with the database stuff as well.

 

by: rwinnickPosted on 2009-09-15 at 10:17:20ID: 25337104

Great - Thanks -
here's response -
I put in the line breaks for clarity -
I can set up the table for this info any way I like -
so we could have a field named for each 'tag' if that's the best way to do it -

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>
<GetReportResponse xmlns="http://temple.org/"><GetReportResult>&lt;Report&gt;&lt;ReportList&gt;&lt;PropertyID&gt;7008&lt;/PropertyID&gt;&lt;UnitCode&gt;02BCH&lt;/UnitCode&gt;&lt;PropertyName&gt;Beach This Now&lt;/PropertyName&gt;&lt;Date&gt;5/28/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Frequency &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;7008&lt;/PropertyID&gt;&lt;UnitCode&gt;02BCH&lt;/UnitCode&gt;&lt;PropertyName&gt;Beach This Now&lt;/PropertyName&gt;&lt;Date&gt;5/25/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Frequency &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;6986&lt;/PropertyID&gt;&lt;UnitCode&gt;01PINE&lt;/UnitCode&gt;&lt;PropertyName&gt;Madness &amp; Mayhem&lt;/PropertyName&gt;&lt;Date&gt;5/24/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Temporary &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;7008&lt;/PropertyID&gt;&lt;UnitCode&gt;02BCH&lt;/UnitCode&gt;&lt;PropertyName&gt;Beach This Now&lt;/PropertyName&gt;&lt;Date&gt;5/21/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Arrival &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;6470&lt;/PropertyID&gt;&lt;UnitCode&gt;4326-10&lt;/UnitCode&gt;&lt;PropertyName&gt;Tenth Street Cottage&lt;/PropertyName&gt;&lt;Date&gt;5/21/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Departure &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;6830&lt;/PropertyID&gt;&lt;UnitCode&gt;1234&lt;/UnitCode&gt;&lt;PropertyName&gt;Oregon Desert Delight&lt;/PropertyName&gt;&lt;Date&gt;5/20/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Temporary &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;6519&lt;/PropertyID&gt;&lt;UnitCode&gt;103MON&lt;/UnitCode&gt;&lt;PropertyName&gt;Monatee Place&lt;/PropertyName&gt;&lt;Date&gt;5/19/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Departure &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;6483&lt;/PropertyID&gt;&lt;UnitCode&gt;122GRAND&lt;/UnitCode&gt;&lt;PropertyName&gt;Grand Oaks&lt;/PropertyName&gt;&lt;Date&gt;5/14/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Departure &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;6483&lt;/PropertyID&gt;&lt;UnitCode&gt;122GRAND&lt;/UnitCode&gt;&lt;PropertyName&gt;Grand Oaks&lt;/PropertyName&gt;&lt;Date&gt;5/7/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Departure &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;7008&lt;/PropertyID&gt;&lt;UnitCode&gt;02BCH&lt;/UnitCode&gt;&lt;PropertyName&gt;Beach This Now&lt;/PropertyName&gt;&lt;Date&gt;5/7/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Frequency &lt;/Type&gt;&lt;/ReportList&gt;&lt;ReportList&gt;&lt;PropertyID&gt;6830&lt;/PropertyID&gt;&lt;UnitCode&gt;1234&lt;/UnitCode&gt;&lt;PropertyName&gt;Oregon Desert Delight&lt;/PropertyName&gt;&lt;Date&gt;5/2/2009 12:00:00 AM&lt;/Date&gt;&lt;Type&gt;Departure &lt;/Type&gt;&lt;/ReportList&gt;&lt;/Report&gt;</GetReportResult></GetReportResponse>
</soap:Body>
</soap:Envelope> 
output: stdClass Object ( [GetReportResult] => 700802BCHBeach This Now5/28/2009 12:00:00 AMFrequency 700802BCHBeach This Now5/25/2009 12:00:00 AMFrequency 698601PINEMadness & Mayhem5/24/2009 12:00:00 AMTemporary 700802BCHBeach This Now5/21/2009 12:00:00 AMArrival 64704326-10Tenth Street Cottage5/21/2009 12:00:00 AMDeparture 68301234Oregon Desert Delight5/20/2009 12:00:00 AMTemporary 6519103MONMonatee Place5/19/2009 12:00:00 AMDeparture 6483122GRANDGrand Oaks5/14/2009 12:00:00 AMDeparture 6483122GRANDGrand Oaks5/7/2009 12:00:00 AMDeparture 700802BCHBeach This Now5/7/2009 12:00:00 AMFrequency 68301234Oregon Desert Delight5/2/2009 12:00:00 AMDeparture  ) 

                                              
1:
2:
3:
4:
5:
6:
7:

Select allOpen in new window

 

by: SilhouettePosted on 2009-09-15 at 12:30:06ID: 25338388

Hi,

You can try the following

<?php
 
  try { 
		$client = new SoapClient("http://localhost/WebService1/Service1.asmx?WSDL",array( 
		"trace"      => 1)); 
		$output = $client->GetReport(
				array(
					"login" => array(
						"username"=> "admin",
						"password"=>"#hotel123",
						"hotelAccount"=>"v123hotel"
					),
					"startDate" => "5/1/2009",
					"EndingDate" => "5/30/2009"
				)
			); 
		print "<pre>\n"; 
		print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n"; 
		print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n"; 
		print "</pre>\n"; 
 
		$doc = new SimpleXMLElement($output->GetReportResult);
		
		$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
		if (!$link) {
			die('Could not connect: ' . mysql_error());
		}
		ysql_select_db('mydb');
 
		
		foreach ($doc->ReportList as $report) {
			$insert_sql = "INSERT INTO mytable (PropertyID, UnitCode, PropertyName, Date, Type )";
			$insert_sql .= " values ('" . $report->PropertyID . "','" . $report->UnitCode . "','" . $report->PropertyName . "','" . $report->Date . "','" . $report->Type . "',)";
			echo $insert_sql . "<br />";
			mysql_query($insert_sql);
		}
		mysql_close($link);
		
  } 
  catch (SoapFault $exception) { 
    echo $exception;       
  } 
 
?>

                                              
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:

Select allOpen in new window

 

by: rwinnickPosted on 2009-09-15 at 16:55:22ID: 25340704

Hi Silhouette:

Just tried the new code -
first part works fine as before - I get Request: and Response OK -
Connects to db OK - that is - does not 'die' -
(note missing 'm' in mysql_select_db)
But the rest of the code does not update table in db -
If I understand the code the echo $insert_sql . "<br/>";
should 'print' out the insert sql to the page -
I do not see anything -
Could it have anything to do with the foreach() -
I do not understand the 'ReportList' in the foreach statement -
What am I missing -
Thanks for the help - and the very prompt replies :-)
Richard

 

by: rwinnickPosted on 2009-09-15 at 17:03:57ID: 25340742

Hi back again -

Code seems to stop working after the
$doc = new SimpleXMLElement($output->GetReportResult);
line - that is if I put a print "xxxx" after the line it doesn't print -
prior to that line it prints -
does this help -

R

 

by: SilhouettePosted on 2009-09-16 at 00:13:56ID: 25342738

Hi,

I made some changes to correct the mysql code but I don't think that will fix your problem.
The echo $insert_sql should be showing you the insert statements that are used. If this is not happening and it breaks where you say it does then SimpleXML might not be set up.

'ReportList' is a tag in your XML response that contains all the details, the code should loop over those tags and insert the values in each entry.

<?php
 
  try { 
		$client = new SoapClient("http://localhost/WebService1/Service1.asmx?WSDL",array( 
		"trace"      => 1)); 
		$output = $client->GetReport(
				array(
					"login" => array(
						"username"=> "admin",
						"password"=>"#hotel123",
						"hotelAccount"=>"v123hotel"
					),
					"startDate" => "5/1/2009",
					"EndingDate" => "5/30/2009"
				)
			); 
		print "<pre>\n"; 
		print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n"; 
		print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n"; 
		print "</pre>\n"; 
 
		
		$link = mysql_connect('localhost', 'test', 'test');
		if (!$link) {
			die('Could not connect: ' . mysql_error());
		}
		mysql_select_db('testdb');
 
		
		$doc = new SimpleXMLElement($output->GetReportResult);
		foreach ($doc->ReportList as $report) {
			$insert_sql = "INSERT INTO mytable (PropertyID, UnitCode, PropertyName, Date, Type )";
			$insert_sql .= " values ('" . $report->PropertyID . "','" . $report->UnitCode . "','" . $report->PropertyName . "','" . $report->Date . "','" . $report->Type . "')";
			echo $insert_sql . "<br />";
			mysql_query($insert_sql);
		}
		mysql_close($link);
		
  } 
  catch (SoapFault $exception) { 
    echo $exception;       
  } 
 
?>

                                              
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:

Select allOpen in new window

 

by: rwinnickPosted on 2009-09-16 at 06:55:12ID: 25345575

Hi Silhouette:
Simple XML is installed
checked and getting the following error

[Wed Sep 16 06:36:09 2009] [error] [client 209.41.163.23] PHP Fatal error:  Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /vservers/statustracker/htdocs/soap_EE_Table_test_2.php:32\nStack trace:\n#0 /vservers/statustracker/htdocs/soap_EE_Table_test_2.php(32): SimpleXMLElement->__construct('<CleaningReport...')\n#1 {main}\n  thrown in /vservers/statustracker/htdocs/soap_EE_Table_test_2.php on line 32 [Wed Sep 16 06:36:14 2009]

line 32 reads as follows

$doc = new SimpleXMLElement($output->GetCLeaningReportResult);

I had changed the name of the report in the original post - the actual result is as follows -

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><GetCLeaningReportResponse xmlns="http://temple.org/"><GetCLeaningReportResult>&lt;CleaningReport&gt;&lt;CleaningReportList&gt;&lt;PropertyID&gt;7008&lt;/PropertyID&gt;&lt;UnitCode&gt;02BCH&lt;/UnitCode&gt;&lt;PropertyName&gt;Beach This Now&lt;/PropertyName&gt;&lt;CleaningDate&gt;5/28/2009 12:00:00 AM&lt;/CleaningDate&gt;&lt;CleaningType&gt;Frequency cleaning&lt;/CleaningType&gt;&lt;/CleaningReportList&gt;&lt;/CleaningReport&gt;</GetCLeaningReportResult></GetCLeaningReportResponse></soap:Body></soap:Envelope> 

                                              
1:

Select allOpen in new window

 

by: rwinnickPosted on 2009-09-16 at 07:37:24ID: 25346045

back again -
did some more error checking and it looks like we are getting an error that indicates that the xml passed to simplexml is not valid -
have sent a note to the web service folks -
will keep you posted
R

 

by: SilhouettePosted on 2009-09-16 at 07:44:53ID: 25346151

Hi Richard,

I am not sure why simplexml thinks the xml isn't valid but yes it does look like that is what is happening.

To see exactly what the XML looks like you can add this
      print_r($output->GetCLeaningReportResult);
to your code. Then if you view the source of your page you should see the xml displayed properly there.

 

by: rwinnickPosted on 2009-09-17 at 06:26:37ID: 25355807

Hi Silhouette:
The web service folks just got back to me -
There were 'special' characters in the data they were sending that fouled things up -
They have fixed their code to strip these and Guess What it all works like a dream :-)
There is one issue with the date that is sent - the date field in the database (datetime format) shows 0000-00-00 00:00:00 - all the other fields work fine -
and we are getting CleaningDate>5/28/2009 12:00:00 AM</CleaningDate from the web service -
How do we get it to show up as a date in the db - and I don't really need the 'time' -
I really appreciate your help on this and am learning a lot!
I may even try to put together my own web service at some point in time :-)
For now though - I have one more 'capability' to add to this to have everything I need -
I will increase points if you want me to for all the additional help you are giving me -
What I need to do now is to pass the date variables and a userid to this code which should then look up the username, password and account information in my database for the userid -
I can create a form that will post the userid and dates in the URL to the page that has this code - if that seems like a way to do this -
or however you think best -
thanks in advance
Richard

 

by: SilhouettePosted on 2009-09-17 at 07:43:08ID: 25356825

Hi Richard,

The date is not coming through properly because I didn't see that the actual field names had changed in the response, the attached snippet should fix the problem.

That sounds like the best way to do it.

I am glad I could help.

Martin
                  

$insert_sql = "INSERT INTO mytable (PropertyID, UnitCode, PropertyName, Date, Type )";
			$insert_sql .= " values ('" . $report->PropertyID . "','" . $report->UnitCode . "','" . $report->PropertyName . "','" . $report->CleaningDate . "','" . $report->CleaningType . "')";
			

                                              
1:
2:
3:

Select allOpen in new window

 

by: rwinnickPosted on 2009-09-17 at 11:17:22ID: 25359212

Hi Silhouette:

I had already caught that name change and fixed it -

So that ain't the problem :-)

Any other ideas -

R

 

by: SilhouettePosted on 2009-09-17 at 11:27:08ID: 25359314

Hi,

The field name also changed from Date to CleaningDate  and Type to CleaningType. Other than that there is nothing obvious to me. You can try printing out the insert statements to see if anything is missing or wrong with them.

 

by: rwinnickPosted on 2009-09-17 at 13:47:51ID: 25360905

Hi Silhouette:

Did a bunch of reading and playing with code and got the darn thing to work including passing the userid and date parameters and looking up the user's login and account info in the db -
I am soooo  proud of myself :-)
and couldn't have done it without your help and the things I've learned from your help -
I also got the date to work - it seems to have been a 'formatting' issue - after changing the web service result to a unix time stamp and then formating it in the date format I need it is working OK -
there was probably a more elegant way to do this but what the H ---- it works!!
Thank you so much for your help and moral support -
see you next time around -
Richard

 

by: rwinnickPosted on 2009-09-17 at 13:49:00ID: 31628671

helped in a way that I actually learned something new -
Great Job

 

by: SilhouettePosted on 2009-09-17 at 13:49:36ID: 25360923

My pleasure and well done

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...