i thought the same, i tried with camel-http , camel-http4, jetty, with
setting bridgeEndpoint=true
<http://realserverhostname:8090/webservice?wsdl&bridgeEndpoint=true&throwExceptionOnFailure=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] <ml+s465427n5832524...@n5.nabble.com>
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 <wyan...@gmail.com>


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&node=5832524&i=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
>
>
>   <route>
>     <from uri="servlet:myapp?matchOnUriPrefix=true"/>
>     <to uri="
http://realserverhostname:8090/webservice?wsdl&amp;bridgeEndpoint=true&amp;throwExceptionOnFailure=false
<http://realserverhostname:8090/webservice?wsdl&bridgeEndpoint=true&throwExceptionOnFailure=false>"/>

>   </route>
>
>
>
> 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
>  <html><body><p>Mocked Interfaces in project </p><ul><li><a
> href="/xxx?WSDL&interface=xxx">xxx</a></li><li><a
> href="/xxx?WSDL&interfacexxx">xxx</a></li></ul></p></body></html>
>
>
> 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&node=5832511&code=d3lhbmJveEBnbWFpbC5jb218NTgzMjUxMXwxMTU1MzAzODM=>
.
NAML
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

Reply via email to