Re: using camel as proxy to download wsdl file from remote webservice

2019-03-30 Thread Willem Jiang
Can you use sniffer tool to check http request? Maybe something is
wrong with the http header.

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Sat, Mar 30, 2019 at 6:04 PM Wang Yan  wrote:
>
> i thought the same, i tried with camel-http , camel-http4, jetty, with
> setting bridgeEndpoint=true
> <http://realserverhostname:8090/webservice?wsdl=true=false>
> ,
> set Basic Authorization in header
> but it does not work with my remote wsdl , no idea why.
> -- Forwarded message -
> From: Willem.Jiang [via Camel] 
> Date: Sat, Mar 30, 2019 at 10:46 AM
> Subject: Re: using camel as proxy to download wsdl file from remote
> webservice
> To: W.Y 
>
>
> Hi,
>
>
> It looks like you just want to proxy the request? using camel-http
> component with bridgeEndpoint option is true should do the trick.
> Not sure if it relates to basic authentication on the remote host.
>
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Sat, Mar 30, 2019 at 2:05 PM Wang Yan <[hidden email]
> <http:///user/SendEmail.jtp?type=node=5832524=0>> wrote:
>
> >
> > I found the solution. it works for me, if you have better way, feel free
> to
> > share 
> >
> > private String proxy(String url) throws IOException {
> > CredentialsProvider provider = new BasicCredentialsProvider();
> > UsernamePasswordCredentials credentials = new
> > UsernamePasswordCredentials("USERNAME", "PASSWORD");
> > provider.setCredentials(AuthScope.ANY, credentials);
> > try (CloseableHttpClient httpClient =
> > HttpClientBuilder.create().setDefaultCredentialsProvider(provider)
> > .build();) {
> > HttpGet request = new HttpGet(url);
> > HttpResponse response = httpClient.execute(request);
> > BufferedReader rd = new BufferedReader(new
> > InputStreamReader(response.getEntity().getContent()));
> > StringBuffer body = new StringBuffer();
> > String line = "";
> > while ((line = rd.readLine()) != null) {
> > body.append(line + System.lineSeparator());
> > }
> > return body.toString();
> > }
> > }
> >
> >
> > @Override
> > public void configure() throws Exception {
> > from("jetty:http://0.0.0.0:8080/myapp?matchOnUriPrefix=true
> > ").routeId("webserviceproxyroute")
> > .process(exchange -> {
> > exchange.getOut()
> > .setBody(proxy("http://remotehost/webservice?wsdl;));
> > }).log(LoggingLevel.INFO, "Response  \n ${body}");
> > }
> >
> >
> > I used below code as proxy to download wsdl file from remote webservice,
> > but it does not work. only get html back instead of wsdl file
> >
> >
> >   
> > 
> > http://realserverhostname:8090/webservice?wsdlbridgeEndpoint=truethrowExceptionOnFailure=false
> <http://realserverhostname:8090/webservice?wsdl=true=false>"/>
>
> >   
> >
> >
> >
> > Ps:
> >
> >
> >
> > Of couse using browser I am able to open
> > http://realserverhostname:8090/webservice?wsdl as wsdl file
> >
> > via camel route It only got something like below
> >  Mocked Interfaces in project  > href="/xxx?WSDL=xxx">xxx > href="/xxx?WSDL">xxx
> >
> >
> > Any hints or ideas?
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/using-camel-as-proxy-to-download-wsdl-file-from-remote-webservice-tp5832511p5832524.html
> To unsubscribe from using camel as proxy to download wsdl file from remote
> webservice, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=5832511=d3lhbmJveEBnbWFpbC5jb218NTgzMjUxMXwxMTU1MzAzODM=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


Fwd: using camel as proxy to download wsdl file from remote webservice

2019-03-30 Thread Wang Yan
i thought the same, i tried with camel-http , camel-http4, jetty, with
setting bridgeEndpoint=true
<http://realserverhostname:8090/webservice?wsdl=true=false>
,
set Basic Authorization in header
but it does not work with my remote wsdl , no idea why.
-- Forwarded message -
From: Willem.Jiang [via Camel] 
Date: Sat, Mar 30, 2019 at 10:46 AM
Subject: Re: using camel as proxy to download wsdl file from remote
webservice
To: W.Y 


Hi,


It looks like you just want to proxy the request? using camel-http
component with bridgeEndpoint option is true should do the trick.
Not sure if it relates to basic authentication on the remote host.


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Sat, Mar 30, 2019 at 2:05 PM Wang Yan <[hidden email]
<http:///user/SendEmail.jtp?type=node=5832524=0>> wrote:

>
> I found the solution. it works for me, if you have better way, feel free
to
> share 
>
> private String proxy(String url) throws IOException {
> CredentialsProvider provider = new BasicCredentialsProvider();
> UsernamePasswordCredentials credentials = new
> UsernamePasswordCredentials("USERNAME", "PASSWORD");
> provider.setCredentials(AuthScope.ANY, credentials);
> try (CloseableHttpClient httpClient =
> HttpClientBuilder.create().setDefaultCredentialsProvider(provider)
> .build();) {
> HttpGet request = new HttpGet(url);
> HttpResponse response = httpClient.execute(request);
> BufferedReader rd = new BufferedReader(new
> InputStreamReader(response.getEntity().getContent()));
> StringBuffer body = new StringBuffer();
> String line = "";
> while ((line = rd.readLine()) != null) {
> body.append(line + System.lineSeparator());
> }
> return body.toString();
> }
> }
>
>
> @Override
> public void configure() throws Exception {
> from("jetty:http://0.0.0.0:8080/myapp?matchOnUriPrefix=true
> ").routeId("webserviceproxyroute")
> .process(exchange -> {
> exchange.getOut()
> .setBody(proxy("http://remotehost/webservice?wsdl;));
> }).log(LoggingLevel.INFO, "Response  \n ${body}");
> }
>
>
> I used below code as proxy to download wsdl file from remote webservice,
> but it does not work. only get html back instead of wsdl file
>
>
>   
> 
> http://realserverhostname:8090/webservice?wsdlbridgeEndpoint=truethrowExceptionOnFailure=false
<http://realserverhostname:8090/webservice?wsdl=true=false>"/>

>   
>
>
>
> Ps:
>
>
>
> Of couse using browser I am able to open
> http://realserverhostname:8090/webservice?wsdl as wsdl file
>
> via camel route It only got something like below
>  Mocked Interfaces in project  href="/xxx?WSDL=xxx">xxx href="/xxx?WSDL">xxx
>
>
> Any hints or ideas?


------
If you reply to this email, your message will be added to the discussion
below:
http://camel.465427.n5.nabble.com/using-camel-as-proxy-to-download-wsdl-file-from-remote-webservice-tp5832511p5832524.html
To unsubscribe from using camel as proxy to download wsdl file from remote
webservice, click here
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=5832511=d3lhbmJveEBnbWFpbC5jb218NTgzMjUxMXwxMTU1MzAzODM=>
.
NAML
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


Re: using camel as proxy to download wsdl file from remote webservice

2019-03-30 Thread Willem Jiang
Hi,


It looks like you just want to proxy the request? using camel-http
component with bridgeEndpoint option is true should do the trick.
Not sure if it relates to basic authentication on the remote host.


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Sat, Mar 30, 2019 at 2:05 PM Wang Yan  wrote:
>
> I found the solution. it works for me, if you have better way, feel free to
> share 
>
> private String proxy(String url) throws IOException {
> CredentialsProvider provider = new BasicCredentialsProvider();
> UsernamePasswordCredentials credentials = new
> UsernamePasswordCredentials("USERNAME", "PASSWORD");
> provider.setCredentials(AuthScope.ANY, credentials);
> try (CloseableHttpClient httpClient =
> HttpClientBuilder.create().setDefaultCredentialsProvider(provider)
> .build();) {
> HttpGet request = new HttpGet(url);
> HttpResponse response = httpClient.execute(request);
> BufferedReader rd = new BufferedReader(new
> InputStreamReader(response.getEntity().getContent()));
> StringBuffer body = new StringBuffer();
> String line = "";
> while ((line = rd.readLine()) != null) {
> body.append(line + System.lineSeparator());
> }
> return body.toString();
> }
> }
>
>
> @Override
> public void configure() throws Exception {
> from("jetty:http://0.0.0.0:8080/myapp?matchOnUriPrefix=true
> ").routeId("webserviceproxyroute")
> .process(exchange -> {
> exchange.getOut()
> .setBody(proxy("http://remotehost/webservice?wsdl;));
> }).log(LoggingLevel.INFO, "Response  \n ${body}");
> }
>
>
> I used below code as proxy to download wsdl file from remote webservice,
> but it does not work. only get html back instead of wsdl file
>
>
>   
> 
>  uri="http://realserverhostname:8090/webservice?wsdlbridgeEndpoint=truethrowExceptionOnFailure=false"/>
>   
>
>
>
> Ps:
>
>
>
> Of couse using browser I am able to open
> http://realserverhostname:8090/webservice?wsdl as wsdl file
>
> via camel route It only got something like below
>  Mocked Interfaces in project  href="/xxx?WSDL=xxx">xxx href="/xxx?WSDL">xxx
>
>
> Any hints or ideas?


Fwd: using camel as proxy to download wsdl file from remote webservice

2019-03-30 Thread Wang Yan
I found the solution. it works for me, if you have better way, feel free to
share 

private String proxy(String url) throws IOException {
CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials = new
UsernamePasswordCredentials("USERNAME", "PASSWORD");
provider.setCredentials(AuthScope.ANY, credentials);
try (CloseableHttpClient httpClient =
HttpClientBuilder.create().setDefaultCredentialsProvider(provider)
.build();) {
HttpGet request = new HttpGet(url);
HttpResponse response = httpClient.execute(request);
BufferedReader rd = new BufferedReader(new
InputStreamReader(response.getEntity().getContent()));
StringBuffer body = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
body.append(line + System.lineSeparator());
}
return body.toString();
}
}


@Override
public void configure() throws Exception {
from("jetty:http://0.0.0.0:8080/myapp?matchOnUriPrefix=true
").routeId("webserviceproxyroute")
.process(exchange -> {
exchange.getOut()
.setBody(proxy("http://remotehost/webservice?wsdl;));
}).log(LoggingLevel.INFO, "Response  \n ${body}");
}


I used below code as proxy to download wsdl file from remote webservice,
but it does not work. only get html back instead of wsdl file


  

http://realserverhostname:8090/webservice?wsdlbridgeEndpoint=truethrowExceptionOnFailure=false"/>
  



Ps:



Of couse using browser I am able to open
http://realserverhostname:8090/webservice?wsdl as wsdl file

via camel route It only got something like below
 Mocked Interfaces in project xx


Any hints or ideas?


using camel as proxy to download wsdl file from remote webservice

2019-03-29 Thread Wang Yan
I used below code as proxy to download wsdl file from remote webservice,
but it does not work. only get html back instead of wsdl file


  

http://realserverhostname:8090/webservice?wsdlbridgeEndpoint=truethrowExceptionOnFailure=false"/>
  



Ps:



Of couse using browser I am able to open
http://realserverhostname:8090/webservice?wsdl as wsdl file

via camel route It only got something like below
 Mocked Interfaces in project xx


Any hints or ideas?