Re: PHP 5.3 SoapClient Stripping HTML special characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 19 Aug 2011 17:30:27 +0100, Richard Quadling <rquadling@xxxxxxxxx>
wrote:
> On 19 August 2011 17:13, James Crow <james@xxxxxxxxxxxxx> wrote:
>> On Fri, 19 Aug 2011 16:33:43 +0100, Richard Quadling
>> <rquadling@xxxxxxxxx>
>> wrote:
>>> On 19 August 2011 16:16, James Crow <james@xxxxxxxxxxxxx> wrote:
>>>> Hi all,
>>>>
>>>> I am using the SOAP client to retrieve data from a web server. One
>> field
>>>> in the returned object is a text string that may contain embedded
>>>> carriage
>>>> returns. If I look at the raw packets they appear as '
>> ' in the
>>>> string.
>>>> When I get the string in the SoapClient the carriage return has been
>>>> stripped. So far I have been unable to find a setting that will leave
>>>> this
>>>> embedded character in place.
>>>>
>>>> Can someone point me in the right direction?
>>>>
>>>> Thanks,
>>>> James
>>>
>>> Can you supply a WSDL URL for the service? I can quickly verify what
>>> you are seeing.
>>>
>>> Can you tell us how you perceive the missing character? If you are
>>> echoing it to a browser, then there will be no visual line break as
>>> that is not a HTML character.
>>>
>>> But if you wrap the output in <pre>...</pre> tags, you should see it
>> just
>>> fine.
>>>
>>>
>>>
>>>
>>> --
>>> Richard Quadling
>>> Twitter : EE : Zend : PHPDoc
>>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea
>>
>> Richard,
>>
>> Thanks for the response. My initial email appears garbled somewhat.
>> Between the single quotes should have been &#13;
>>
>> The WDSL is:
>> http://clients.mindbodyonline.com/api/0_5/AppointmentService.asmx?WSDL
>>
>> I am using functions which return (among other things) an Appointment
>> object. This Appointment object has a property named Notes. The Notes
>> item
>> in their software is displayed and edited in a html textarea field. If
a
>> newline is entered in the textarea field I need it to be present in the
>> string in the SoapClient.
>>
>> To actually connect to with a SOAP client requires a username and
>> password.
>>
>> Thanks,
>> James
>>
>>
> 
> What you need to determine is the EXACT content.
> 
> Can you dump the $o_Service->__getLastResponse() to a file, and zip it?
> 
> I have a framework that I use to test SOAP services. It isn't 100%
> automatic, but it doesn't take too long.
> 
> I've got it working as far as I can without the credentials.
> 
> Hopefully you can add them in and the rest of the code should work.
> 
> I assume it is just a SoapHeader you need to add.
> 
> Running the consume.php script currently outputs ...
> 
> Request Headers
> ---------------
> POST /api/0_5/AppointmentService.asmx HTTP/1.1
> Host: clients.mindbodyonline.com
> Connection: Keep-Alive
> User-Agent: PHP
> Content-Type: text/xml; charset=utf-8
> SOAPAction: "http://clients.mindbodyonline.com/api/0_5/GetScheduleItems";
> Content-Length: 742
> 
> 
> Request (XML)
> -------------
> <?xml version="1.0" encoding="utf-8"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
>                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>                   
xmlns:ns1="http://clients.mindbodyonline.com/api/0_5";>
>   <SOAP-ENV:Body>
>     <ns1:GetScheduleItems>
>       <ns1:Request>
>         <ns1:XMLDetail xsi:nil="true" />
>         <ns1:PageSize xsi:nil="true" />
>         <ns1:CurrentPageIndex xsi:nil="true" />
>         <ns1:LocationIDs>
>           <ns1:int>1</ns1:int>
>           <ns1:int>2</ns1:int>
>           <ns1:int>3</ns1:int>
>         </ns1:LocationIDs>
>         <ns1:StaffIDs>
>           <ns1:long>100</ns1:long>
>           <ns1:long>200</ns1:long>
>           <ns1:long>300</ns1:long>
>         </ns1:StaffIDs>
>         <ns1:StartDate>2011-01-01T00:00:00Z</ns1:StartDate>
>         <ns1:EndDate>2011-12-31T23:59:59Z</ns1:EndDate>
>       </ns1:Request>
>     </ns1:GetScheduleItems>
>   </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> Response Headers
> ----------------
> HTTP/1.1 200 OK
> Cache-Control: private, max-age=0
> Content-Type: text/xml; charset=utf-8
> Server: Microsoft-IIS/7.5
> X-AspNet-Version: 2.0.50727
> X-Powered-By: ASP.NET
> P3P: CAO DSP COR CUR TAIa OUR NOR UNI STA
> Date: Fri, 19 Aug 2011 16:28:44 GMT
> Content-Length: 614
> 
> Response (XML)
> --------------
> <?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>
>     <GetScheduleItemsResponse
>     xmlns="http://clients.mindbodyonline.com/api/0_5";>
>       <GetScheduleItemsResult>
>         <Status>InvalidCredentials</Status>
>         <Message>SourceCredentials must be provided.</Message>
>         <XMLDetail>Full</XMLDetail>
>         <ResultCount>0</ResultCount>
>         <CurrentPageIndex>0</CurrentPageIndex>
>         <TotalPageCount>0</TotalPageCount>
>       </GetScheduleItemsResult>
>     </GetScheduleItemsResponse>
>   </soap:Body>
> </soap:Envelope>
> 
> 
> Response (Interpreted)
> ----------------------
> GetScheduleItemsResult Object
> (
>     [StaffMembers] =>
>     [Status] => InvalidCredentials
>     [Message] => SourceCredentials must be provided.
>     [XMLDetail] => Full
>     [ResultCount] => 0
>     [CurrentPageIndex] => 0
>     [TotalPageCount] => 0
> )

I entered my login credentials in the consume.php script and changed it to
dump __getLastResponse() to a text file. I do not want to include the
entire file because it contains customer information, but I did look
through the file with vi. The Notes /Notes XMl items do not contain
embedded carriage returns or line feeds. I think this is a bug in the SOAP
service and not in the PHP SoapClient.

Thanks,
James


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux