<?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>build broken &#187; ASP-Classic</title>
	<atom:link href="http://blog.aztec-project.org/tag/asp-classic/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.aztec-project.org</link>
	<description>but we can fix it! Sometimes :)</description>
	<lastBuildDate>Fri, 11 Jun 2010 12:52:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>.NET-Webservice mit ASP-Classic ansprechen</title>
		<link>http://blog.aztec-project.org/2009/06/19/net-webservice-mit-asp-classic-ansprechen/</link>
		<comments>http://blog.aztec-project.org/2009/06/19/net-webservice-mit-asp-classic-ansprechen/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 10:55:28 +0000</pubDate>
		<dc:creator>Christina Hirth</dc:creator>
				<category><![CDATA[Webservice]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP-Classic]]></category>
		<category><![CDATA[Refaktorisierung]]></category>

		<guid isPermaLink="false">http://blog.aztec-project.org/?p=216</guid>
		<description><![CDATA[Seit einiger Zeit sind wir dabei, unser Portal zu refaktorisieren. Das entfernte Ziel ist, alles in .NET um zu bauen. Das betrifft zur Zeit über tausend Seiten aber wir möchten noch in diesem Leben fertig sein ;) 

Dazu kommt noch, dass wir - selbstverständlich - agiles Softwarentwicklung betreiben, was eine ständige und rhythmische Iteration vorsieht, keine Mega-Projekte mit ungewissem Ende. Also haben wir die verschiedenen Bereiche identifiziert und diese werden einer nach dem anderen neu gebaut.
Die neuen DLL-s in .NET werden mit Hilfe von verschiedenen Webservices angesprochen. <a href="http://blog.aztec-project.org/?p=216">weiter lesen ...</a>]]></description>
			<content:encoded><![CDATA[<p>Seit einiger Zeit sind wir dabei, unser Portal zu refaktorisieren. Das entfernte Ziel ist, alles in .NET um zu bauen. Das betrifft zur Zeit über tausend Seiten aber wir möchten noch in diesem Leben fertig sein <img src='http://blog.aztec-project.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Dazu kommt noch, dass wir &#8211; selbstverständlich &#8211; agiles Softwarentwicklung betreiben, was eine ständige und rhythmische Iteration vorsieht, keine Mega-Projekte mit ungewissem Ende. Also haben wir die verschiedenen Bereiche identifiziert und diese werden einer nach dem anderen neu gebaut.<br />
Die neuen DLL-s in .NET werden mit Hilfe von verschiedenen Webservices angesprochen. Das führt allerdings unweigerlich dazu, 2 Technologien &#8211; ASP-Classic und .NET(C#) &#8211; miteinander <span style="text-decoration: underline;">sicher</span> kommunizieren zu lassen. Das funktioniert so:</p>
<p>Dieser hier könnte der besagte .NET Webservice sein:</p>
<pre>
<div style="font-size: 10pt; background: white; color: black; font-family: Courier New;">
<span style="color: #2b91af;">    1</span> POST <a href="http://www.webAdresse.de/Webservice.asmx">http://www.webAdresse.de/Webservice.asmx</a> HTTP/1.1
<span style="color: #2b91af;">    2</span> Host: webServer
<span style="color: #2b91af;">    3</span> Content-Type: text/xml; charset=utf-8
<span style="color: #2b91af;">    4</span> Content-Length: length
<span style="color: #2b91af;">    5</span> SOAPAction: "http://tempuri.org/AendernEtwas"
<span style="color: #2b91af;">    6</span>
<span style="color: #2b91af;">    7</span> <span style="color: blue;">&lt;?</span><span style="color: #a31515;">xml</span> <span style="color: red;">version</span><span style="color: blue;">="1.0"</span> <span style="color: red;">encoding</span><span style="color: blue;">="utf-8"?&gt;</span>
<span style="color: #2b91af;">    8</span> <span style="color: blue;">&lt;</span><span style="color: #a31515;">soap</span><span style="color: blue;">:</span><span style="color: #a31515;">Envelope</span> <span style="color: #a31515;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">xsi</span><span style="color: blue;">=http://www.w3.org/2001/XMLSchema-instance</span>
<span style="color: #2b91af;">    9</span>  <span style="color: #a31515;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">xsd</span><span style="color: blue;">="http://www.w3.org/2001/XMLSchema"</span> <span style="color: #a31515;">xmlns</span><span style="color: blue;">:</span><span style="color: red;">soap</span><span style="color: blue;">="http://schemas.xmlsoap.org/soap/envelope/"&gt;</span>
<span style="color: #2b91af;">   10</span>   <span style="color: blue;">&lt;</span><span style="color: #a31515;">soap</span><span style="color: blue;">:</span><span style="color: #a31515;">Body</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   11</span>     <span style="color: blue;">&lt;</span><span style="color: #a31515;">AendernEtwas</span> <span style="color: red;">xmlns</span><span style="color: blue;">="http://tempuri.org/"&gt;</span>
<span style="color: #2b91af;">   12</span>       <span style="color: blue;">&lt;</span><span style="color: #a31515;">id</span><span style="color: blue;">&gt;</span>int<span style="color: blue;">&lt;/</span><span style="color: #a31515;">id</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   13</span>       <span style="color: blue;">&lt;</span><span style="color: #a31515;">person</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   14</span>         <span style="color: blue;">&lt;</span><span style="color: #a31515;">nachname</span><span style="color: blue;">&gt;</span>string<span style="color: blue;">&lt;/</span><span style="color: #a31515;">nachname</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   15</span>         <span style="color: blue;">&lt;</span><span style="color: #a31515;">vorname</span><span style="color: blue;">&gt;</span>string<span style="color: blue;">&lt;/</span><span style="color: #a31515;">vorname</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   16</span>       <span style="color: blue;">&lt;/</span><span style="color: #a31515;">person</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   17</span>     <span style="color: blue;">&lt;/</span><span style="color: #a31515;">AendernEtwas</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   18</span>   <span style="color: blue;">&lt;/</span><span style="color: #a31515;">soap</span><span style="color: blue;">:</span><span style="color: #a31515;">Body</span><span style="color: blue;">&gt;</span>
<span style="color: #2b91af;">   19</span> <span style="color: blue;">&lt;/</span><span style="color: #a31515;">soap</span><span style="color: blue;">:</span><span style="color: #a31515;">Envelope</span><span style="color: blue;">&gt;</span></div>
</pre>
<p>Um ihn aufzurufen, brauchen wir in ASP folgendes:</p>
<pre style="font-size: 10pt; background: white; color: black; font-family: Courier New;"><span style="color: #2b91af;">    1</span> <span style="color: green;">'Webserviceaufruf mit Angaben von Methodennamen und Parameter-XML</span>
<span style="color: #2b91af;">    2</span> <span style="color: blue;">Function</span> webserviceCall(<span style="color: blue;">ByVal</span> methode, <span style="color: blue;">ByVal</span> xmlParameters)
<span style="color: #2b91af;">    3</span>     <span style="color: blue;">Dim</span> objRequest, strRet
<span style="color: #2b91af;">    4</span>     <span style="color: blue;">Set</span> objRequest = Server.createobject(<span style="color: #a31515;">"MSXML2.XMLHTTP"</span>)
<span style="color: #2b91af;">    5</span>     <span style="color: blue;">With</span> objRequest
<span style="color: #2b91af;">    6</span>     .open <span style="color: #a31515;">"POST"</span>, <span style="color: #a31515;">"http://www.webadresse.de/Webservices.asmx"</span>, <span style="color: blue;">False</span>
<span style="color: #2b91af;">    7</span>     .setRequestHeader <span style="color: #a31515;">"Content-Type"</span>, <span style="color: #a31515;">"text/xml; charset=utf-8"</span>
<span style="color: #2b91af;">    8</span>     .setRequestHeader <span style="color: #a31515;">"SOAPAction11"</span>, <span style="color: #a31515;"><span style="color: #000000;">methode</span></span>
<span style="color: #2b91af;">    9</span>     .send xmlParameters
<span style="color: #2b91af;">   10</span>     <span style="color: blue;">End</span> <span style="color: blue;">With</span>
<span style="color: #2b91af;">   11</span>     strRet = objRequest.responseText
<span style="color: #2b91af;">   12</span>     <span style="color: blue;">if</span> <span style="color: blue;">CInt</span>(objRequest.status) &lt;&gt; 200 <span style="color: blue;">then</span>
<span style="color: #2b91af;">   13</span>         <span style="color: green;">'Fehlerbehandlung, wenn Aufruf fehlgeschlagen
</span><span style="color: #2b91af;">   14</span>     <span style="color: blue;">end</span> <span style="color: blue;">if</span>
<span style="color: #2b91af;">   15</span>     <span style="color: blue;">Set</span> objRequest = <span style="color: blue;">Nothing</span>
<span style="color: #2b91af;">   16</span>     webserviceCall = strRet
<span style="color: #2b91af;">   17</span> <span style="color: blue;">end</span> <span style="color: blue;">function</span></pre>
<p><!--EndFragment--><span style="color: #000000;">Die Parameter werden so übergeben:</span></p>
<div style="font-family: Courier New; font-size: 10pt; color: black; background: white;">
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = <span style="color: #a31515;">&quot;&lt;?xml version=&quot;&quot;1.0&quot;&quot; encoding=&quot;&quot;utf-8&quot;&quot;?&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&lt;soap:Envelope xmlns:xsi=&quot;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&quot; xmlns:xsd=&quot;&quot;http://www.w3.org/2001/XMLSchema&quot;&quot; xmlns:soap=&quot;&quot;http://www.w3.org/2003/05/soap-envelope&quot;&quot;&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &lt;soap:Body&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;AendernEtwas xmlns=&quot;&quot;http://www.webadresse.de&quot;&quot;&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;id&gt;</span>  &amp; id &amp; <span style="color: #a31515;">&lt;/id&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;person&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;nachname&gt;&lt;![CDATA[&quot;</span> &amp; nachname &amp; <span style="color: #a31515;">&quot;]]&gt;&lt;/nachname&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;vorname&gt;&lt;![CDATA[&quot;</span> &amp; vorname &amp; <span style="color: #a31515;">&quot;]]&gt;&lt;/nachname&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/person&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/AendernEtwas&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&nbsp;&nbsp;&nbsp; &lt;/soap:Body&gt;&quot;</span> &amp; VbCrLf</p>
<p style="margin: 0px;">&nbsp;&nbsp;&nbsp; strParameters = strParameters &amp; <span style="color: #a31515;">&quot;&lt;/soap:Envelope&gt;&quot;</span></p>
</div>
<p>Und das wäre dann alles, jetzt muss die Funktion nur noch aufgerufen werden:<br />
<span style="left: 10px;font-size: 10pt; background: white; color: black; font-family: Courier New;"><br />
responseText = webserviceCall(<span style="color: #a31515;">&quot;AendernEtwas&quot;</span>, strParameters)</span></p>
<p>Das Ergebnis kann man danach mit Microsoft.XMLDOM ausgelesen werden.</p>
<p>Noch ein paar Bemerkungen:<br />
- .NET ist im Gegensatz zu ASP-Classic case sensitive und eine stark typisierte Sprache, also obacht auf</p>
<ol>
<li>die korrekte Schreibweise der Parameternamen in XML und auf</li>
<li>die Datentypen: <span style="color: #0000ff;">strings </span>müssen mit <span style="color: #000000;"><strong>CDATA </strong></span>umklammert, <span style="color: #0000ff;">Enums</span> mit dem Namen angesprochen und Datumswerte in ISO 8601-Datumsformat (<span style="color: #0000ff;">YYYY-MM-DDThh:min:sec.millisecond</span>) angegeben werden.</li>
</ol>
<p><!--EndFragment--><a href="http://blog.aztec-project.org/?p=216"></a></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.aztec-project.org/2009/06/19/net-webservice-mit-asp-classic-ansprechen/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

