<?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>.:: Seam City ::. &#187; general</title>
	<atom:link href="http://seamcity.madeinxpain.com/archives/category/general/feed" rel="self" type="application/rss+xml" />
	<link>http://seamcity.madeinxpain.com</link>
	<description>Sobre programación en general, y Seam en particular</description>
	<lastBuildDate>Thu, 22 Jan 2009 15:35:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SEO-friendly URLs con Seam II</title>
		<link>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam-ii</link>
		<comments>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam-ii#comments</comments>
		<pubDate>Fri, 25 Jul 2008 08:55:12 +0000</pubDate>
		<dc:creator>Tes</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[seam]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://seamcity.madeinxpain.com/?p=52</guid>
		<description><![CDATA[Vamos a ampliar la información del post anterior con conceptos más avanzados.
Partimos de la base de que tenemos configurado y funcionando el módulo UrlRewrite.
El primer problema con el que me topé es que mi aplicación usaba identificadores numéricos, tipo .../product.seam?idProduct=123. Por lo tanto necesitaba traducir el identificador numerico a una palabra descriptiva del producto, como [...]]]></description>
			<content:encoded><![CDATA[<p>Vamos a ampliar la información del post anterior con conceptos más avanzados.<br />
Partimos de la base de que tenemos configurado y funcionando el módulo UrlRewrite.</p>
<p>El primer problema con el que me topé es que mi aplicación usaba identificadores numéricos, tipo .../product.seam?idProduct=123. Por lo tanto necesitaba traducir el identificador numerico a una palabra descriptiva del producto, como .../product/silla o .../product/mesa.</p>
<p>
Afortunadamente con Seam eso no presenta mucha dificultad y puede emplearse una EL Expression tipo #{rewriter.fromNameToId('silla')}.<br />
Por desgracia, en el archivo urlrewrite.xml no pueden incluirse EL Expressions.
</p>
<p>
Para solucionarlo, creé una 'página virtual' en el pages.xml que recogía los parámetros como String de la url y mediante una llamada a un componente de Seam los traducía en el correspondiente identificador numérico, aprovechando que en el archivo pages.xml sí que se pueden usar EL Expressions.</p>
<ul>
<li>Fichero urlrewrite.xml
<div class="syntax_hilite">
<div id="xml-4">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;urlrewrite<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;from<span style="font-weight: bold; color: black;">&gt;</span></span></span>^/pruduct/([A-Za-z]*)$<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/from<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;to</span> <span style="color: #000066;">last</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">&gt;</span></span>/virtual_product.seam?name=$1<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/to<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/urlrewrite<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p>
        </li>
<li>Fichero pages.xml
<div class="syntax_hilite">
<div id="xml-5">
<div class="xml">.....<br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">view-id</span>=<span style="color: #ff0000;">"/virtual_product.xhtml"</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"#{product.init}"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"name"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;navigation<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;redirect</span> <span style="color: #000066;">view-id</span>=<span style="color: #ff0000;">"/product.seam"</span><span style="font-weight: bold; color: black;">&gt;</span></span>&nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"idProduct"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"#{urlRewriter.idProductFromName(name)}"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/redirect<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/navigation<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
.....</div>
</div>
</div>
<p>
         </li>
<li>Componente rewrite
<div class="syntax_hilite">
<div id="java-6">
<div class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">int</span> idProductFromName<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">String</span></a> name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Consulta en la bbdd para halar </span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// el id del producto a partir del nombre</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam-ii/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Añadir logging a un cliente  SOAP de web services</title>
		<link>http://seamcity.madeinxpain.com/archives/anadir-logging-a-un-cliente-soap-de-web-services</link>
		<comments>http://seamcity.madeinxpain.com/archives/anadir-logging-a-un-cliente-soap-de-web-services#comments</comments>
		<pubDate>Mon, 09 Jun 2008 09:51:38 +0000</pubDate>
		<dc:creator>Tes</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://seamcity.madeinxpain.com/?p=49</guid>
		<description><![CDATA[Cuando trabajamos con web services en java, a la hora de depurar nos sería muy útil el poder ver el xml (protocolo SOAP) que se envían cliente y servidor.
Sin embargo no existe una forma 'sencilla' de hacerlo.
La idea consiste en hacer una clase que implemente el interface javax.xml.rpc.handler.Handler, capaz de interceptar los mensajes SOAP antes [...]]]></description>
			<content:encoded><![CDATA[<p>Cuando trabajamos con web services en java, a la hora de depurar nos sería muy útil el poder ver el xml (protocolo SOAP) que se envían cliente y servidor.<br />
Sin embargo no existe una forma 'sencilla' de hacerlo.</p>
<p>La idea consiste en hacer una clase que implemente el interface <em>javax.xml.rpc.handler.Handler</em>, capaz de interceptar los mensajes SOAP antes de su envío del cliente al servidor y  antes de la recepción por parte del cliente de los mensajes enviados por el servidor.<br />
Pueden añadirse varios handlers en serie para procesar las llamadas (handler chains). Este comportamiento es idéntico al de un ServletFilter en una cadena de filtros.<br />
Desde esta clase tenemos acceso al contenido del mensaje SOAP, por lo que somos capaces de leerlo y escribirlo en un fichero de texto o similar.</p>
<p>En el caso de un cliente hecho con apache axis, podemos obtener la lista de Handlers asociados a un nombre de puerto (javax.xml.namespace.QName) y a un punto de destino a través de la clase <em>org.apache.axis.client.Service</em>. Una vez obtenida la lista, solo nos resta añadir nuestro Handler.</p>
<p>Vamos a ello. En primer lugar implementamos el interfaz <em><a href="http://ws.apache.org/axis/java/apiDocs/org/apache/axis/client/Service.html" onclick="javascript:pageTracker._trackPageview('article_out/ws.apache.org');">javax.xml.rpc.handler.Handle</a>r</em> para interceptar la llamada soap:</p>
<div class="syntax_hilite">
<div id="java-10">
<div class="java">package com.<span style="color: #006600;">madeinxpain</span>.<span style="color: #006600;">seamcity</span>.<span style="color: #006600;">ws</span>;</p>
<p><span style="color: #a1a100;">import java.io.File;</span><br />
<span style="color: #a1a100;">import java.io.FileNotFoundException;</span><br />
<span style="color: #a1a100;">import java.io.FileOutputStream;</span><br />
<span style="color: #a1a100;">import java.io.OutputStream;</span><br />
<span style="color: #a1a100;">import java.util.ArrayList;</span><br />
<span style="color: #a1a100;">import java.util.List;</span></p>
<p><span style="color: #a1a100;">import javax.xml.namespace.QName;</span><br />
<span style="color: #a1a100;">import javax.xml.rpc.handler.Handler;</span><br />
<span style="color: #a1a100;">import javax.xml.rpc.handler.HandlerInfo;</span><br />
<span style="color: #a1a100;">import javax.xml.rpc.handler.MessageContext;</span><br />
<span style="color: #a1a100;">import javax.xml.rpc.handler.soap.SOAPMessageContext;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SoapLoggingHandler <span style="color: #000000; font-weight: bold;">implements</span> Handler<span style="color: #66cc66;">&#123;</span></p>
<p><span style="color: #000000; font-weight: bold;">private</span> HandlerInfo handlerInfo;<br />
<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AList+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">List</span></a> streams;</p>
<p><span style="color: #000000; font-weight: bold;">public</span> SoapLoggingHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
streams = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AArrayList+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">ArrayList</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">addOutputStreamLog</span><span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">addFileLog</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"soap.xml"</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> addOutputStreamLog<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">OutputStream</span></a> os<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">streams</span>.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>os<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> addFileLog<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">String</span></a> rute<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?q=allinurl%3AFileNotFoundException+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">FileNotFoundException</span></a> <span style="color: #66cc66;">&#123;</span><br />
<a href="http://www.google.com/search?q=allinurl%3AFileOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">FileOutputStream</span></a> fos = <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AFileOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">FileOutputStream</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AFile+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">File</span></a><span style="color: #66cc66;">&#40;</span>rute<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">addOutputStreamLog</span><span style="color: #66cc66;">&#40;</span>fos<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">boolean</span> handleRequest<span style="color: #66cc66;">&#40;</span>MessageContext arg0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
SOAPMessageContext messageContext = <span style="color: #66cc66;">&#40;</span>SOAPMessageContext<span style="color: #66cc66;">&#41;</span> arg0;<br />
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">OutputStream</span></a> os : streams<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
os.<span style="color: #006600;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&lt;!-- REQUEST --&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getBytes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
messageContext.<span style="color: #006600;">getMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">writeTo</span><span style="color: #66cc66;">&#40;</span>os<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">boolean</span> handleResponse<span style="color: #66cc66;">&#40;</span>MessageContext arg0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
SOAPMessageContext messageContext = <span style="color: #66cc66;">&#40;</span>SOAPMessageContext<span style="color: #66cc66;">&#41;</span> arg0;<br />
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">OutputStream</span></a> os : streams<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
os.<span style="color: #006600;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&lt;!-- RESPONSE --&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getBytes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
messageContext.<span style="color: #006600;">getMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">writeTo</span><span style="color: #66cc66;">&#40;</span>os<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">boolean</span> handleFault<span style="color: #66cc66;">&#40;</span>MessageContext arg0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
SOAPMessageContext messageContext = <span style="color: #66cc66;">&#40;</span>SOAPMessageContext<span style="color: #66cc66;">&#41;</span> arg0;<br />
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AOutputStream+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">OutputStream</span></a> os : streams<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
os.<span style="color: #006600;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&lt;!-- FAULT --&gt;<span style="color: #000099; font-weight: bold;">\n</span>"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getBytes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
messageContext.<span style="color: #006600;">getMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">writeTo</span><span style="color: #66cc66;">&#40;</span>os<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> init<span style="color: #66cc66;">&#40;</span>HandlerInfo arg0<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">handlerInfo</span> = arg0;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> destroy<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> QName<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> getHeaders<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">return</span> handlerInfo.<span style="color: #006600;">getHeaders</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p>
Esta clase implementa una serie de métodos extra aparte de los obligatorios definidos por el interface. Estos métodos permiten definir una lista de Streams por los que escribir el mensaje.<br />
Estos métodos de logging deben ser invocado desde el constructor, ya que al añadir el Handler a la cadena (como veremos más adelante) no se añade una instancia de un objeto, si no una clase, y es el framework axis el encargado de crear la instancia mediante el método Class.new Instance(), por lo que no es posible definir las formas de logging si no es en el constructor por defecto del handler.</p>
<p>Un a vez codificada la clase, vamos a proceder a añadirla a la cadena. Cada handler debe estar asociado<br />
Tomaremos como ejemplo un cliente WebService para Microsoft Exchange 2007, creado en <a href="http://seamcity.madeinxpain.com/archives/crear-un-cliente-java-de-web-services-para-exchange-2007" >un post anterior</a><br />
En primer lugar buscamos la clase que extiende de <em>org.apache.axis.client.Stub</em>, en nuestro caso  llamada ExchangeServiceBindingStub, y le añadimos dos campos para almacenar el <em>port</em> por el que se va a realizar la petición soap y el punto de destino.<br />
Estos campos se van a utilizar en el metodo createCall() a la hora de crear la petición soap.<br />
Por simplicidad crearemos los campos como públicos.</p>
<div class="syntax_hilite">
<div id="java-11">
<div class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExchangeServiceBindingStub <span style="color: #000000; font-weight: bold;">extends</span> org.<span style="color: #006600;">apache</span>.<span style="color: #006600;">axis</span>.<span style="color: #006600;">client</span>.<a href="http://www.google.com/search?q=allinurl%3AStub+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">Stub</span></a> <span style="color: #000000; font-weight: bold;">implements</span> com.<span style="color: #006600;">microsoft</span>.<span style="color: #006600;">schemas</span>.<span style="color: #006600;">exchange</span>.<span style="color: #006600;">services</span>._2006.<span style="color: #006600;">messages</span>.<span style="color: #006600;">ExchangeServicePortType</span> <span style="color: #66cc66;">&#123;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> javax.<span style="color: #006600;">xml</span>.<span style="color: #006600;">namespace</span>.<span style="color: #006600;">QName</span> portName;<br />
<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">String</span></a> endPoint;</p>
<p><span style="color: #808080; font-style: italic;">// resto del código original de la clase</span></p>
<p><span style="color: #808080; font-style: italic;">// metodo a modificar</span><br />
<span style="color: #000000; font-weight: bold;">protected</span> org.<span style="color: #006600;">apache</span>.<span style="color: #006600;">axis</span>.<span style="color: #006600;">client</span>.<span style="color: #006600;">Call</span> createCall<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> java.<span style="color: #006600;">rmi</span>.<a href="http://www.google.com/search?q=allinurl%3ARemoteException+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">RemoteException</span></a> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">// codigo anterior</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>super.<span style="color: #006600;">cachedPortName</span> != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
_call.<span style="color: #006600;">setPortName</span><span style="color: #66cc66;">&#40;</span>super.<span style="color: #006600;">cachedPortName</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #808080; font-style: italic;">// Tenemos que añadir estas dos lineas</span><br />
_call.<span style="color: #006600;">setPortName</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">portName</span><span style="color: #66cc66;">&#41;</span>;<br />
_call.<span style="color: #006600;">setTargetEndpointAddress</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">endPoint</span><span style="color: #66cc66;">&#41;</span>;</p>
<p><span style="color: #808080; font-style: italic;">// codigo posterior</span><br />
java.<span style="color: #006600;">util</span>.<a href="http://www.google.com/search?q=allinurl%3AEnumeration+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">Enumeration</span></a> keys = super.<span style="color: #006600;">cachedProperties</span>.<span style="color: #006600;">keys</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p><span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Cuando instanciamos el objeto <em>org.apache.axis.client.Stub</em> le añadimos el handler:</p>
<div class="syntax_hilite">
<div id="java-12">
<div class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExchangeWebServiceClient <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">private</span> ExchangeServiceBindingStub esb;<br />
<span style="color: #000000; font-weight: bold;">private</span> ExchangeServicesLocator locator;</p>
<p><span style="color: #000000; font-weight: bold;">public</span> ExchangeWebServiceClient<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">locator</span> = <span style="color: #000000; font-weight: bold;">new</span> ExchangeServicesLocator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">esb</span> = <span style="color: #66cc66;">&#40;</span>ExchangeServiceBindingStub<span style="color: #66cc66;">&#41;</span> locator.<span style="color: #006600;">getExchangeServicePort</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AURL+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">URL</span></a><span style="color: #66cc66;">&#40;</span>locator.<span style="color: #006600;">getExchangeServicePortAddress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p><span style="color: #808080; font-style: italic;">// Añadimos el handler</span><br />
QName portName = <span style="color: #000000; font-weight: bold;">new</span> QName<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"http://www.neodoo.es/"</span>, locator.<span style="color: #006600;">getExchangeServicePortWSDDServiceName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<a href="http://www.google.com/search?q=allinurl%3AList+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">List</span></a> list = locator.<span style="color: #006600;">getHandlerRegistry</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getHandlerChain</span><span style="color: #66cc66;">&#40;</span>portName<span style="color: #66cc66;">&#41;</span>;<br />
HandlerInfo handlerInfo = <span style="color: #000000; font-weight: bold;">new</span> HandlerInfo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
handlerInfo.<span style="color: #006600;">setHandlerClass</span><span style="color: #66cc66;">&#40;</span>com.<span style="color: #006600;">madeinxpain</span>.<span style="color: #006600;">seamcity</span>.<span style="color: #006600;">ws</span>.<span style="color: #006600;">SoapLoggingHandler</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #66cc66;">&#41;</span>;<br />
list.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>handlerInfo<span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">esb</span>.<span style="color: #006600;">portName</span> = portName;<br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">esb</span>.<span style="color: #006600;">endPoint</span> = locator.<span style="color: #006600;">getExchangeServicePortAddress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Y  con esto y un bizcocho, ya tenemos una forma de depurar las llamadas soap a un webservice desde un cliente hecho con axis.<br />
La optimización del código queda a cargo del desarrollador final <img src='http://seamcity.madeinxpain.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://seamcity.madeinxpain.com/archives/anadir-logging-a-un-cliente-soap-de-web-services/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crear un cliente java de Web Services para Exchange 2007</title>
		<link>http://seamcity.madeinxpain.com/archives/crear-un-cliente-java-de-web-services-para-exchange-2007</link>
		<comments>http://seamcity.madeinxpain.com/archives/crear-un-cliente-java-de-web-services-para-exchange-2007#comments</comments>
		<pubDate>Sun, 27 Apr 2008 16:53:44 +0000</pubDate>
		<dc:creator>Tes</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://seamcity.madeinxpain.com/archives/37</guid>
		<description><![CDATA[Para crear el cliente he usado el IDE eclipse-Red Hat Developer Studio, pero el procedimiento será similar para cualquier IDE.
Supondremos que la dirección del servidor es "my.exchange.com".
El primer paso es bajarse del servidor exchange estos 3 archivos y guardarlos en local:
* https://my.exchange.com/ews/Services.wsdl
* https://my.exchange.com/ews/messages.xsd
* https://my.exchange.com/ews/types.xsd
Después hay que modificar el archivo "Services.wsdl" para añadir el servicio y [...]]]></description>
			<content:encoded><![CDATA[<p>Para crear el cliente he usado el IDE eclipse-Red Hat Developer Studio, pero el procedimiento será similar para cualquier IDE.<br />
Supondremos que la dirección del servidor es "my.exchange.com".</p>
<p>El primer paso es bajarse del servidor exchange estos 3 archivos y guardarlos en local:<br />
* https://my.exchange.com/ews/Services.wsdl<br />
* https://my.exchange.com/ews/messages.xsd<br />
* https://my.exchange.com/ews/types.xsd<br />
Después hay que modificar el archivo "Services.wsdl" para añadir el servicio y su url.</p>
<p>Debes añadir al final del archivo (antes de cerrar la etiqueta &lt;wsdl:definitions&gt;) las siguientes lineas:</p>
<div class="syntax_hilite">
<div id="xml-17">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;wsdl</span> :service <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"ExchangeServices"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/wsdl<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;wsdl</span> :port <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"ExchangeServicePort"</span> <span style="color: #000066;">binding</span>=<span style="color: #ff0000;">"tns:ExchangeServiceBinding"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;soap</span> :address <span style="color: #000066;">location</span>=<span style="color: #ff0000;">"https://my.exchange.com/EWS/Exchange.asmx"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/wsdl<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p></p>
<p>Ahora tendrás que modificar los archivos "types.xsd" y "messages.xsd" para que maneje correctamente los arrays, mapeandolos a colecciones.<br />
Para cada tipo llamado "ArrayOf..." o "NonEmpyArrayOf..." tendrás que añadirle el atributo maxOccurs="unbounded"<br />
Ejemplo:</p>
<div class="syntax_hilite">
<div id="xml-18">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xs</span> :complexType <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"ArrayOfFoldersType"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xs<span style="font-weight: bold; color: black;">&gt;</span></span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xs</span> :choice <span style="color: #000066;">minOccurs</span>=<span style="color: #ff0000;">"0"</span> <span style="color: #000066;">maxOccurs</span>=<span style="color: #ff0000;">"unbounded"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xs</span> :element <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Folder"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"t:FolderType"</span> <span style="color: #000066;">maxOccurs</span>=<span style="color: #ff0000;">"unbounded"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xs</span> :element <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"CalendarFolder"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"t:CalendarFolderType"</span> <span style="color: #000066;">maxOccurs</span>=<span style="color: #ff0000;">"unbounded"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xs</span> :element <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"ContactsFolder"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"t:ContactsFolderType"</span> <span style="color: #000066;">maxOccurs</span>=<span style="color: #ff0000;">"unbounded"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xs</span> :element <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"SearchFolder"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"t:SearchFolderType"</span> <span style="color: #000066;">maxOccurs</span>=<span style="color: #ff0000;">"unbounded"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;xs</span> :element <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"TasksFolder"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"t:TasksFolderType"</span> <span style="color: #000066;">maxOccurs</span>=<span style="color: #ff0000;">"unbounded"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/xs<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p></p>
<p>Si ya has generado el cliente y sin haber cambiado esto, las clases "ArrayOf..." y "NonEmpyArrayOf..." y generadas serán incapaces de manejar arrays.<br />
Pero aún tiene solución. Deber añadir a cada clase un campo de tipo List (cualquier Collection vale), y en cada método setXXX añadir el objeto pasado como parámetro al array.<br />
Por ejemplo, en la clase ArrayOfRealItemsType:</p>
<div class="syntax_hilite">
<div id="java-19">
<div class="java"><span style="color: #808080; font-style: italic;">// declaras la lista:</span><br />
<span style="color: #000000; font-weight: bold;">private</span> List&amp;lt;ItemType&amp;gt; items = <span style="color: #000000; font-weight: bold;">new</span> ArrayList&amp;lt;ItemType&amp;gt;<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</p>
<p><span style="color: #808080; font-style: italic;">//sobreescribes los setters para añadir los parametros a la lista:</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setPostItem<span style="color: #66cc66;">&#40;</span>com.<span style="color: #006600;">microsoft</span>.<span style="color: #006600;">schemas</span>.<span style="color: #006600;">exchange</span>.<span style="color: #006600;">services</span>._2006.<span style="color: #006600;">types</span>.<span style="color: #006600;">PostItemType</span> postItem<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">items</span>.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>postItem<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">postItem</span> = postItem;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setMessage<span style="color: #66cc66;">&#40;</span>com.<span style="color: #006600;">microsoft</span>.<span style="color: #006600;">schemas</span>.<span style="color: #006600;">exchange</span>.<span style="color: #006600;">services</span>._2006.<span style="color: #006600;">types</span>.<span style="color: #006600;">MessageType</span> message<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">items</span>.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>message<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">message</span> = message;<br />
<span style="color: #66cc66;">&#125;</span></p>
<p><span style="color: #808080; font-style: italic;">// etc.. </span></div>
</div>
</div>
<p>
Una vez que has generado el cliente verás que te da algunos fallos de compilación.<br />
Esto es porque por algún motivo los constructores no se generan bien.<br />
Tras arreglar los fallos podemos continuar.</p>
<p>La clase principal para realizar las llamadas al Web Service es ExchangeServiceBindingStub.<br />
Creamos el objeto y le ponemos los parametros de usuario, password y servidor.</p>
<div class="syntax_hilite">
<div id="java-20">
<div class="java">ExchangeServiceBindingStub esb = <span style="color: #66cc66;">&#40;</span>ExchangeServiceBindingStub<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">new</span> ExchangeServicesLocator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getExchangeServicePort</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span>&nbsp; <a href="http://www.google.com/search?q=allinurl%3AURL+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">URL</span></a><span style="color: #66cc66;">&#40;</span>locator.<span style="color: #006600;">getExchangeServicePortAddress</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
esb.<span style="color: #006600;">setUsername</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"usuario"</span><span style="color: #66cc66;">&#41;</span>;<br />
esb.<span style="color: #006600;">setPassword</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"password"</span><span style="color: #66cc66;">&#41;</span>;<br />
esb._setProperty<span style="color: #66cc66;">&#40;</span>javax.<span style="color: #006600;">xml</span>.<span style="color: #006600;">rpc</span>.<a href="http://www.google.com/search?q=allinurl%3AStub+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">Stub</span></a>.<span style="color: #006600;">ENDPOINT_ADDRESS_PROPERTY</span>, <span style="color: #ff0000;">"https://my.exchange.com/EWS/Exchange.asmx"</span><span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>Antes de continuar debes asegurarte que el servidor tiene activada la autentificación básica, si no te saldrá un error HTTP 402.2 "acceso denegado debido a la configuración del servidor"</p>
<p>Ahora solo queda invocar al método del Web Service que quieras y rellenar los parámetros requeridos.</p>
]]></content:encoded>
			<wfw:commentRss>http://seamcity.madeinxpain.com/archives/crear-un-cliente-java-de-web-services-para-exchange-2007/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Problemas con Google Maps</title>
		<link>http://seamcity.madeinxpain.com/archives/problemas-con-google-maps</link>
		<comments>http://seamcity.madeinxpain.com/archives/problemas-con-google-maps#comments</comments>
		<pubDate>Wed, 19 Mar 2008 14:06:41 +0000</pubDate>
		<dc:creator>Tes</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[google-maps]]></category>

		<guid isPermaLink="false">http://seamcity.madeinxpain.com/archives/33</guid>
		<description><![CDATA[Como siempre que se desarrolla una aplicación, aparecen errores que nos dan multitud de quebraderos de cabeza.
Ahí van unos cuantos con los que me he enfrentado trabajando con Google Maps.

El fondo del mapa se ve totalmente en gris
Casi seguro es porque alguna propiedad css está interfiriendo con el mapa. Un caso en el que aparece [...]]]></description>
			<content:encoded><![CDATA[<p>Como siempre que se desarrolla una aplicación, aparecen errores que nos dan multitud de quebraderos de cabeza.<br />
Ahí van unos cuantos con los que me he enfrentado trabajando con Google Maps.</p>
<ul>
<li><strong>El fondo del mapa se ve totalmente en gris</strong><br />
Casi seguro es porque alguna propiedad css está interfiriendo con el mapa. Un caso en el que aparece es con la propiedada overflow:hidden.</li>
</ul>
<ul>
<li><strong>El fondo del mapa se ve parcialmente gris, y el centro se sitúa en la esquina superior izquierda</strong><br />
Esto ocurre porque cuando la api de google maps carga el mapa, el div contenedor que ha sido pasado como argumento al constructor GMap2 tiene tamaño cero. El trozo de mapa que se ve es realmente el trozos que queda fuera de los limites de visión pero es cargado para mejorar el rendimiento al desplazar el mapa.<br />
Que el div contendor tenga tamaño cero, suele ocurrir cuando está dentro de una tabla o tiene el tamaño especificado con porcentajes. Hasta que el DOM no se carga completamente, el div no adquiere un tamaño definido, y en el momento en el que se carga el mapa aun no tiene su tamaño final.<br />
Se puede solucionar especificando el ancho (width) y alto (height) del contendor sin porcentajes o especificando directamente el tamaño del mapa con un argumento en el constructor GMap2:</p>
<pre>new GMap2(container, {size:new GSize(width,  height)})</pre>
</li>
</ul>
<ul>
<li><strong>Object cannot be created in this context" code: "9"  ... (NS_ERROR_DOM_NOT_SUPPORTED_ERR)</strong><br />
Este error suele aparecer en firefox cuando el mapa se inserta en una pagina JSF con Facelets.Es debido a que el objeto 'document' de javascript creado por firefox cuando el mime type es 'application/xhtml+xml', no tiene el metodo write().<br />
Para solucionarlo tienes que establecer el content type de la pagina como text/html. Con JSF se puede hacer añadiendo el tag</p>
<pre>		&lt;f contenttype="text/html" /&gt;</pre>
<p>en la página que contenga el mapa (No afecta a facelets ni al funcionamiento de la pagina).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://seamcity.madeinxpain.com/archives/problemas-con-google-maps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

