Jump to content

lsr1981

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lsr1981's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I just checked the source in the browser and the tags are there so it is returning the data correctly. Should have checked that first as I have been used to working with .NET which returns the data as is and doesn't strip the tags out when rendering in the browser. As long as the full string is returned that is fine as it is never retunred to the browser. I can now send it to MySQL to populate a table in a Stored Proc to use. I am just looking at the possability of switching to PHP and MySQL from VBScript and .NET and MS-SQL. Out of interest is there any reason why the tags are shown when using _getLastResponse? Is it rendered differently when shown in the browser? As for the missing XML start tag that was in the web service, copied code from an existing web service I used which strips the XML tag out. It is back in now but shouldn't make a difference now. Thank you for all the help, I should have probablly checked the source of the page first but like I said been used to .NET which seems to render the output as is. Lee
  2. Just noticed that if I use the following code: $client = new SoapClient("http://webservice.lhldev.net/testservice.asmx?wsdl", array('trace' => 1)); $result = $client->TestString(); echo $client->__getLastResponse(); Then I get the following response: <information><MainA>ABCDE</MainA><MainB>123456789</MainB><SetA><ValuesA><TextLine1>Test Text 1</TextLine1><TextLine2>Test Text 1</TextLine2></ValuesA></SetA><SetB><ValuesB><NumberLine1>123456</NumberLine1><NumberLine2>123456</NumberLine2></ValuesB></SetB></information> Which is what I would expect so it seems that when storing the $client to a $result variable the XML is stripped out and I am left with just the data. Am I calling the web service incorrectly in the first case? Lee
  3. Hello, I tried that but no joy. This is the code that I am using, have set up a test web service so you can check. <?php try { $client = new SoapClient("http://webservice.lhldev.net/testservice.asmx?wsdl"); $result = $client->TestString(); print_r($result); } catch (Exception $e) { echo "Error!<br />"; echo $e -> getMessage (); } ?> Returns: stdClass Object ( [TestStringResult] => ABCDE123456789Test Text 1Test Text 1123456123456 ) The web service code is: [WebMethod] public string TestString() { return "<information><MainA>ABCDE</MainA><MainB>123456789</MainB><SetA><ValuesA><TextLine1>Test Text 1</TextLine1><TextLine2>Test Text 1</TextLine2></ValuesA></SetA><SetB><ValuesB><NumberLine1>123456</NumberLine1><NumberLine2>123456</NumberLine2></ValuesB></SetB></information>"; } As you can see the XML formatting is being stripped out, however if you run the web service directly then string is shown fully so I suspect somethign in the PHP Soap Client is removing the XML formatting. Obviously having a XML string returned as a string is not ideal but the web service I am using is 3rd party and out of my control so I need a way to use the data. Current;y the string is sent to a MS-SQL server proc and the string is then converted to XML and placed in a table. The data can then be read and used for a comparasion agaisnt the server. Thanks again, Lee
  4. Hello, I am quite new to PHP so am still finding my way around so this may have a really obvious answer, but my searches so far have not given me the answer. I have a need to connect to two web services and am using the SoapClient function. One of the web services is working fine as it returns the data as an object which I am able to use "$result-> -> [Required value from data];" and it returns the value from the XML as expected. The code I am using is, minus the values as they are user tokens, etc. [code=php:0] $client = new SoapClient("Web Service URL"); $result = $client->GetHistory(array("Parameter1" => "Value","Parameter2" => "Value")); print_r($result); [/code] However the other web service returns the data as a string of XML: <?xml version="1.0"?><tag1><tag2>Data</tag2><tag2>Data</tag2><tag3>Data</tag3></tag1> The problem is that when returned if I output using print_r($result) to see what is contained all of the tags have been removed including the "<?xml version="1.0"?>". This makes the data unusable as it is just a long string now with no seperators to identify the seperation of the data. Why is this happening? What have I missed? Any help would be much appreciated. Thanks, Lee
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.