You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by lucas <lp...@etra.es> on 2001/08/02 16:12:04 UTC

problem with URLConnection

My code receives data from external data sources. I get this data with the
URLConnection class, everything works fine in Tomcat 1.3.1. I can Post the
parameters and receive the results of the external cgi. I have a servlet
which makes it (probed).

.... but (always there is a but :) ) I have problems integrating this
servlet into the cocoon pipeline, (both cocoon and tomcat runs in the same
machine, of course). it fails in the <generate ..> step, and I get a
IOException message.
I can connect to the Internet with or without a proxy (we are still
migrating to dsl).
Can any of you help me ?.
thank in advance, and merry chrismas for all of us, cocoon bunch


Lucas Pons Bayarri
Etra I+D
Valencia, Spain
+34 96 330 40 82


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: problem with URLConnection

Posted by lucas <lp...@etra.es>.
thanks for the help, tomorrow i'll try it
bye

-----Mensaje original-----
De: Reinhard Pötz [mailto:reinhard_poetz@gmx.net]
Enviado el: miércoles, 02 de enero de 2002 17:39
Para: cocoon-users@xml.apache.org
Asunto: AW: problem with URLConnection


I can't offer you a concret solution - but you may try this:

Try the HTMLGenerator.

<map:generate type="html"
src="http://portet:8080/cocoon/wh@m/GenerateItinerary">
	<map:parameter name="copy-parameters" value="true"/>
</map:generate>

Regards,
Reinhard

 > -----Ursprüngliche Nachricht-----
 > Von: lucas [mailto:lpons.etra-id@etra.es]
 > Gesendet: Donnerstag, 02. August 2001 16:51
 > An: cocoon-users@xml.apache.org
 > Betreff: RE: problem with URLConnection
 >
 >
 >
 > this is the fragment of the Servlet where the URL is accesed:
 >
 > 		.....
 > 		String XML = buf.toString();
 > 	      try{
 >
 > 	         	URL miurl = new
 > URL("http://www.whatever.es/cgi-bin/XMLprocess");
 > 	         	URLConnection con = miurl.openConnection();
 >
 > 	         	con.setDoOutput(true);
 >
 > 	         	PrintWriter escritor = new
 > PrintWriter(con.getOutputStream());
 >
 > 	         	escritor.println("XML=" + URLEncoder.encode(XML));
 > 	         	escritor.close();
 >
 > 			out.println("i arrive here");
 > 	         	BufferedReader in = new BufferedReader(new
 > InputStreamReader(con.getInputStream()));
 > 			out.println("i don't arrive here");
 >
 > 			.....
 >
 >                 }catch (IOException ee ){
 >                 	out.println("IOException:  " +
 > ee.getLocalizedMessage());
 >                 }
 > 		...
 >
 > it is very simple and it works when is directly called as:
 >
 > http://portet:8080/cocoon/generateItinerary
 >
 > this address does not match any pipeline in the sitemap.
 >
 > I try to integrate this servlet in the next way:
 >
 > 	<map:match pattern="wh@m/exec/GenerateItinerary">
 >         <map:act type="request">
 >           <map:parameter name="parameters" value="true"/>
 >           <map:generate
 > src="http://portet:8080/cocoon/wh@m/GenerateItinerary?Orig={Orig}
 > &amp;Dest={
 > Dest}&amp;CodOrig=
 > {CodOrig}&amp;CodDest={CodDest}&amp;modo={modo}&amp;criterio={cri
 > terio}&amp;
 > Fecha={Fecha}&amp;Hora={Hora}"/>
 >         </map:act>
 >         <map:select>
 >           <map:when test="wap">
 >             <map:transform src="wh@m/styles/Itinerary2wml.xsl"/>
 >             <map:serialize type="wap"/>
 >           </map:when>
 >           <map:otherwise>
 >             <map:transform src="wh@m/styles/Itinerary2html.xsl"/>
 >             <map:serialize type="html"/>
 >           </map:otherwise>
 >         </map:select>
 >         <map:serialize type="html"/>
 >       </map:match>
 >
 > The output I receive is the next:
 >
 > ...
 > 	IOException: http://www.whatever.es/cgi-bin/XMLprocess
 > ...
 >
 > Not very descriptive :(
 >
 > I think, my problem is related to the internet conection. we have changed
 > the internet conection settings in the out net, so no proxy
 > server is need
 > any more. Shall I rebuild Cocoon?
 > I also managed to change the proxy settings in the java plug-in control
 > panel, seting and removing the proxy parameter, but I haven't
 > succed at all.
 >
 > -----Mensaje original-----
 > De: Reinhard Pötz [mailto:reinhard_poetz@gmx.net]
 > Enviado el: miércoles, 02 de enero de 2002 16:27
 > Para: cocoon-users@xml.apache.org
 > Asunto: AW: problem with URLConnection
 >
 >
 > Hi lucas,
 >
 > Could you give me further details (your goals, pipeline, error
 > message ...).
 >
 > Regards,
 > Reinhard
 >
 >  > -----Ursprüngliche Nachricht-----
 >  > Von: lucas [mailto:lpons.etra-id@etra.es]
 >  > Gesendet: Donnerstag, 02. August 2001 16:12
 >  > An: COCOON
 >  > Betreff: problem with URLConnection
 >  >
 >  >
 >  > My code receives data from external data sources. I get this
 >  > data with the
 >  > URLConnection class, everything works fine in Tomcat 1.3.1. I
 >  > can Post the
 >  > parameters and receive the results of the external cgi. I
 > have a servlet
 >  > which makes it (probed).
 >  >
 >  > .... but (always there is a but :) ) I have problems integrating this
 >  > servlet into the cocoon pipeline, (both cocoon and tomcat runs
 >  > in the same
 >  > machine, of course). it fails in the <generate ..> step, and I get a
 >  > IOException message.
 >  > I can connect to the Internet with or without a proxy (we are still
 >  > migrating to dsl).
 >  > Can any of you help me ?.
 >  > thank in advance, and merry chrismas for all of us, cocoon bunch
 >  >
 >  >
 >  > Lucas Pons Bayarri
 >  > Etra I+D
 >  > Valencia, Spain
 >  > +34 96 330 40 82
 >  >
 >  >
 >  > ---------------------------------------------------------------------
 >  > Please check that your question has not already been answered in the
 >  > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >  >
 >  > To unsubscribe, e-mail: <co...@xml.apache.org>
 >  > For additional commands, e-mail: <co...@xml.apache.org>
 >  >
 >
 >
 > ---------------------------------------------------------------------
 > Please check that your question has not already been answered in the
 > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >
 > To unsubscribe, e-mail: <co...@xml.apache.org>
 > For additional commands, e-mail: <co...@xml.apache.org>
 >
 >
 >
 >
 > ---------------------------------------------------------------------
 > Please check that your question has not already been answered in the
 > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >
 > To unsubscribe, e-mail: <co...@xml.apache.org>
 > For additional commands, e-mail: <co...@xml.apache.org>
 >


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


AW: problem with URLConnection

Posted by Reinhard Pötz <re...@gmx.net>.
I can't offer you a concret solution - but you may try this:

Try the HTMLGenerator.

<map:generate type="html"
src="http://portet:8080/cocoon/wh@m/GenerateItinerary">
	<map:parameter name="copy-parameters" value="true"/>
</map:generate>

Regards,
Reinhard

 > -----Ursprüngliche Nachricht-----
 > Von: lucas [mailto:lpons.etra-id@etra.es]
 > Gesendet: Donnerstag, 02. August 2001 16:51
 > An: cocoon-users@xml.apache.org
 > Betreff: RE: problem with URLConnection
 >
 >
 >
 > this is the fragment of the Servlet where the URL is accesed:
 >
 > 		.....
 > 		String XML = buf.toString();
 > 	      try{
 >
 > 	         	URL miurl = new
 > URL("http://www.whatever.es/cgi-bin/XMLprocess");
 > 	         	URLConnection con = miurl.openConnection();
 >
 > 	         	con.setDoOutput(true);
 >
 > 	         	PrintWriter escritor = new
 > PrintWriter(con.getOutputStream());
 >
 > 	         	escritor.println("XML=" + URLEncoder.encode(XML));
 > 	         	escritor.close();
 >
 > 			out.println("i arrive here");
 > 	         	BufferedReader in = new BufferedReader(new
 > InputStreamReader(con.getInputStream()));
 > 			out.println("i don't arrive here");
 >
 > 			.....
 >
 >                 }catch (IOException ee ){
 >                 	out.println("IOException:  " +
 > ee.getLocalizedMessage());
 >                 }
 > 		...
 >
 > it is very simple and it works when is directly called as:
 >
 > http://portet:8080/cocoon/generateItinerary
 >
 > this address does not match any pipeline in the sitemap.
 >
 > I try to integrate this servlet in the next way:
 >
 > 	<map:match pattern="wh@m/exec/GenerateItinerary">
 >         <map:act type="request">
 >           <map:parameter name="parameters" value="true"/>
 >           <map:generate
 > src="http://portet:8080/cocoon/wh@m/GenerateItinerary?Orig={Orig}
 > &amp;Dest={
 > Dest}&amp;CodOrig=
 > {CodOrig}&amp;CodDest={CodDest}&amp;modo={modo}&amp;criterio={cri
 > terio}&amp;
 > Fecha={Fecha}&amp;Hora={Hora}"/>
 >         </map:act>
 >         <map:select>
 >           <map:when test="wap">
 >             <map:transform src="wh@m/styles/Itinerary2wml.xsl"/>
 >             <map:serialize type="wap"/>
 >           </map:when>
 >           <map:otherwise>
 >             <map:transform src="wh@m/styles/Itinerary2html.xsl"/>
 >             <map:serialize type="html"/>
 >           </map:otherwise>
 >         </map:select>
 >         <map:serialize type="html"/>
 >       </map:match>
 >
 > The output I receive is the next:
 >
 > ...
 > 	IOException: http://www.whatever.es/cgi-bin/XMLprocess
 > ...
 >
 > Not very descriptive :(
 >
 > I think, my problem is related to the internet conection. we have changed
 > the internet conection settings in the out net, so no proxy
 > server is need
 > any more. Shall I rebuild Cocoon?
 > I also managed to change the proxy settings in the java plug-in control
 > panel, seting and removing the proxy parameter, but I haven't
 > succed at all.
 >
 > -----Mensaje original-----
 > De: Reinhard Pötz [mailto:reinhard_poetz@gmx.net]
 > Enviado el: miércoles, 02 de enero de 2002 16:27
 > Para: cocoon-users@xml.apache.org
 > Asunto: AW: problem with URLConnection
 >
 >
 > Hi lucas,
 >
 > Could you give me further details (your goals, pipeline, error
 > message ...).
 >
 > Regards,
 > Reinhard
 >
 >  > -----Ursprüngliche Nachricht-----
 >  > Von: lucas [mailto:lpons.etra-id@etra.es]
 >  > Gesendet: Donnerstag, 02. August 2001 16:12
 >  > An: COCOON
 >  > Betreff: problem with URLConnection
 >  >
 >  >
 >  > My code receives data from external data sources. I get this
 >  > data with the
 >  > URLConnection class, everything works fine in Tomcat 1.3.1. I
 >  > can Post the
 >  > parameters and receive the results of the external cgi. I
 > have a servlet
 >  > which makes it (probed).
 >  >
 >  > .... but (always there is a but :) ) I have problems integrating this
 >  > servlet into the cocoon pipeline, (both cocoon and tomcat runs
 >  > in the same
 >  > machine, of course). it fails in the <generate ..> step, and I get a
 >  > IOException message.
 >  > I can connect to the Internet with or without a proxy (we are still
 >  > migrating to dsl).
 >  > Can any of you help me ?.
 >  > thank in advance, and merry chrismas for all of us, cocoon bunch
 >  >
 >  >
 >  > Lucas Pons Bayarri
 >  > Etra I+D
 >  > Valencia, Spain
 >  > +34 96 330 40 82
 >  >
 >  >
 >  > ---------------------------------------------------------------------
 >  > Please check that your question has not already been answered in the
 >  > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >  >
 >  > To unsubscribe, e-mail: <co...@xml.apache.org>
 >  > For additional commands, e-mail: <co...@xml.apache.org>
 >  >
 >
 >
 > ---------------------------------------------------------------------
 > Please check that your question has not already been answered in the
 > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >
 > To unsubscribe, e-mail: <co...@xml.apache.org>
 > For additional commands, e-mail: <co...@xml.apache.org>
 >
 >
 >
 >
 > ---------------------------------------------------------------------
 > Please check that your question has not already been answered in the
 > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >
 > To unsubscribe, e-mail: <co...@xml.apache.org>
 > For additional commands, e-mail: <co...@xml.apache.org>
 >


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: problem with URLConnection

Posted by lucas <lp...@etra.es>.
this is the fragment of the Servlet where the URL is accesed:

		.....
		String XML = buf.toString();
	      try{

	         	URL miurl = new URL("http://www.whatever.es/cgi-bin/XMLprocess");
	         	URLConnection con = miurl.openConnection();

	         	con.setDoOutput(true);

	         	PrintWriter escritor = new PrintWriter(con.getOutputStream());

	         	escritor.println("XML=" + URLEncoder.encode(XML));
	         	escritor.close();

			out.println("i arrive here");
	         	BufferedReader in = new BufferedReader(new
InputStreamReader(con.getInputStream()));
			out.println("i don't arrive here");

			.....

                }catch (IOException ee ){
                	out.println("IOException:  " + ee.getLocalizedMessage());
                }
		...

it is very simple and it works when is directly called as:

http://portet:8080/cocoon/generateItinerary

this address does not match any pipeline in the sitemap.

I try to integrate this servlet in the next way:

	<map:match pattern="wh@m/exec/GenerateItinerary">
        <map:act type="request">
          <map:parameter name="parameters" value="true"/>
          <map:generate
src="http://portet:8080/cocoon/wh@m/GenerateItinerary?Orig={Orig}&amp;Dest={
Dest}&amp;CodOrig=
{CodOrig}&amp;CodDest={CodDest}&amp;modo={modo}&amp;criterio={criterio}&amp;
Fecha={Fecha}&amp;Hora={Hora}"/>
        </map:act>
        <map:select>
          <map:when test="wap">
            <map:transform src="wh@m/styles/Itinerary2wml.xsl"/>
            <map:serialize type="wap"/>
          </map:when>
          <map:otherwise>
            <map:transform src="wh@m/styles/Itinerary2html.xsl"/>
            <map:serialize type="html"/>
          </map:otherwise>
        </map:select>
        <map:serialize type="html"/>
      </map:match>

The output I receive is the next:

...
	IOException: http://www.whatever.es/cgi-bin/XMLprocess
...

Not very descriptive :(

I think, my problem is related to the internet conection. we have changed
the internet conection settings in the out net, so no proxy server is need
any more. Shall I rebuild Cocoon?
I also managed to change the proxy settings in the java plug-in control
panel, seting and removing the proxy parameter, but I haven't succed at all.

-----Mensaje original-----
De: Reinhard Pötz [mailto:reinhard_poetz@gmx.net]
Enviado el: miércoles, 02 de enero de 2002 16:27
Para: cocoon-users@xml.apache.org
Asunto: AW: problem with URLConnection


Hi lucas,

Could you give me further details (your goals, pipeline, error message ...).

Regards,
Reinhard

 > -----Ursprüngliche Nachricht-----
 > Von: lucas [mailto:lpons.etra-id@etra.es]
 > Gesendet: Donnerstag, 02. August 2001 16:12
 > An: COCOON
 > Betreff: problem with URLConnection
 >
 >
 > My code receives data from external data sources. I get this
 > data with the
 > URLConnection class, everything works fine in Tomcat 1.3.1. I
 > can Post the
 > parameters and receive the results of the external cgi. I have a servlet
 > which makes it (probed).
 >
 > .... but (always there is a but :) ) I have problems integrating this
 > servlet into the cocoon pipeline, (both cocoon and tomcat runs
 > in the same
 > machine, of course). it fails in the <generate ..> step, and I get a
 > IOException message.
 > I can connect to the Internet with or without a proxy (we are still
 > migrating to dsl).
 > Can any of you help me ?.
 > thank in advance, and merry chrismas for all of us, cocoon bunch
 >
 >
 > Lucas Pons Bayarri
 > Etra I+D
 > Valencia, Spain
 > +34 96 330 40 82
 >
 >
 > ---------------------------------------------------------------------
 > Please check that your question has not already been answered in the
 > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >
 > To unsubscribe, e-mail: <co...@xml.apache.org>
 > For additional commands, e-mail: <co...@xml.apache.org>
 >


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


AW: problem with URLConnection

Posted by Reinhard Pötz <re...@gmx.net>.
Hi lucas,

Could you give me further details (your goals, pipeline, error message ...).

Regards,
Reinhard

 > -----Ursprüngliche Nachricht-----
 > Von: lucas [mailto:lpons.etra-id@etra.es]
 > Gesendet: Donnerstag, 02. August 2001 16:12
 > An: COCOON
 > Betreff: problem with URLConnection
 >
 >
 > My code receives data from external data sources. I get this
 > data with the
 > URLConnection class, everything works fine in Tomcat 1.3.1. I
 > can Post the
 > parameters and receive the results of the external cgi. I have a servlet
 > which makes it (probed).
 >
 > .... but (always there is a but :) ) I have problems integrating this
 > servlet into the cocoon pipeline, (both cocoon and tomcat runs
 > in the same
 > machine, of course). it fails in the <generate ..> step, and I get a
 > IOException message.
 > I can connect to the Internet with or without a proxy (we are still
 > migrating to dsl).
 > Can any of you help me ?.
 > thank in advance, and merry chrismas for all of us, cocoon bunch
 >
 >
 > Lucas Pons Bayarri
 > Etra I+D
 > Valencia, Spain
 > +34 96 330 40 82
 >
 >
 > ---------------------------------------------------------------------
 > Please check that your question has not already been answered in the
 > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
 >
 > To unsubscribe, e-mail: <co...@xml.apache.org>
 > For additional commands, e-mail: <co...@xml.apache.org>
 >


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>