<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Log &#187; soap</title>
	<atom:link href="http://www.php-log.de/programmierer/php/soap/feed" rel="self" type="application/rss+xml" />
	<link>http://www.php-log.de</link>
	<description>Eine feine Sammlung nützlicher PHP Notizen</description>
	<lastBuildDate>Mon, 20 Sep 2010 00:22:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ein paar SOAP Notizen</title>
		<link>http://www.php-log.de/5/php/ein-paar-soap-notizen</link>
		<comments>http://www.php-log.de/5/php/ein-paar-soap-notizen#comments</comments>
		<pubDate>Thu, 22 Jan 2009 16:02:45 +0000</pubDate>
		<dc:creator>ralle</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[soap]]></category>

		<guid isPermaLink="false">http://www.php-log.de/?p=5</guid>
		<description><![CDATA[Oftmals ist es so dass ein SOAP Client die Daten nicht in einem der üblichen Request Parameter sendet. Wie z.b. $_POST, $_GET oder als Fileupload, sondern in einer reichlich schlecht dokumentierten Variable namens $GLOBALS['HTTP_RAW_POST_DATA'] oder $HTTP_RAW_POST_DATA. Der richtige Content Type für die Antwort eines SOAP Servers ist application/soap+xml also header&#40;'Content-Type: application/soap+xml;charset=utf-8'&#41;; Beim senden der Antwort [...]]]></description>
			<content:encoded><![CDATA[<p>Oftmals ist es so dass ein SOAP Client die Daten nicht in einem der üblichen Request Parameter sendet. Wie z.b. $_POST, $_GET oder als Fileupload, sondern in einer reichlich schlecht dokumentierten Variable namens $GLOBALS['HTTP_RAW_POST_DATA'] oder $HTTP_RAW_POST_DATA.</p>
<p><span id="more-5"></span>Der richtige Content Type für die Antwort eines SOAP Servers ist application/soap+xml also</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type: application/soap+xml;charset=utf-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Beim senden der Antwort sollte darauf geachtet werden alle Zeilenumbrüche und Tabs zu entfernen. Auch alle Quotes im Antworttext sollten transformiert werden.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;lt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;amp;amp;lt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;amp;amp;gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;amp;amp;quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>$message enthält in diesem eine Antwort in xml</p>
<p>Manche Systeme tranformieren die Inhalte einer SOAP Kommunikation nach UTF-8. Man findet dann seltsame Konstrukte wie &amp;#xC3;&amp;#xB6; in den Antworten. Zumindest für die deutschen Sonderzeichen hilft untenstehende Replace-Orgie:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//  Apply some extra transformations accordingly to</span>
<span style="color: #666666; font-style: italic;">//  http://www.utf8-zeichentabelle.de/unicode-utf8-table.pl?number=1024&amp;amp;htmlent=1</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#xB6;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ö&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#x96;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Ö&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#xA4;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ä&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#x84;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Ä&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#x9C;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Ü&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#xBC;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ü&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#xBC;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ü&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;#xC3;&amp;amp;#x9F;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ß&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.php-log.de/5/php/ein-paar-soap-notizen/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

