You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by ja...@external.t-mobile.at on 2008/06/10 22:38:33 UTC

Antwort: how do I set an endpoint with different a protocol (https vs. http) and port than the client generated by wsdl2java? [Virus checked]

Hi,

i never tried https, but hopefullty it's the same.

first you need clientProxy in hand .. in my case it was
                                JaxWsProxyFactoryBean factory = new 
JaxWsProxyFactoryBean();
                                factory.setServiceClass(serviceInterface);
                                factory.setAddress(address);
                                factory.setWsdlLocation(wsdlLocation);
                                factory.setServiceName(QName.valueOf(
serviceName));
                                factory.setProperties(new HashMap<String, 
Object>());
                                factory.getProperties().put(Message.
SCHEMA_VALIDATION_ENABLED, new Boolean(schemaValidationEnabled));
                                factory.setEndpointName(QName.valueOf(
portName));
                                T port = (T) factory.create();

then if you want to change address, you can 
1) recreate client with new address
2) try to change it using following:
((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
address);

note that 2) didn't work correctly in 2.1, but it should work in 
2.1.1-snapshot ... i still didn't test it if it really works.

best regards
jano





Gary Weaver <ga...@duke.edu> 
06/10/2008 22:14
Bitte antworten an
users@cxf.apache.org


An
users@cxf.apache.org
Kopie

Thema
how do I set an endpoint with different a protocol (https vs. http) and 
port than the client generated by wsdl2java?  [Virus checked]






Hello,

I was struggling trying to figure out how to use Rampart 1.3 with Axis2 
1.3 (because I needed WS-Security), so I tried switching to using Apache 
CXF 2.1 today instead of Axis2. So far CXF has been easy to use and 
overall has much better documentation, so a big thanks to all involved 
with the project! :)

The background is that I'm using Maven 2 to build, and it is generating 
the client classes via the cxf-codegen-plugin v2.1 plugin.

However, I've run into an issue that I couldn't find any clear example 
or documentation about. Specifically, in Axis/Axis2 it was never 
difficult to set an different endpoint on a client generated from the 
wsdl, and it usually was just a matter or setting a single URL.

For example, in Axis2, even if the endpoint you are setting is HTTPS 
instead of HTTP and is listening on a different port, it is still very 
easy to change in the code:

MyServiceStub stub = new MyServiceStub();
EndpointReference endpointReference = new 
EndpointReference("https://my.new.host:1234/some/path/to/my/service");
stub._getServiceClient().getOptions().setTo(endpointReference);

However, in CXF, this is the best I could come up with so far, which I 
know to be wrong:

MyService service = new MyService();
MyServicePortType portType = service.getMyServicePort();
Client client = org.apache.cxf.frontend.ClientProxy.getClient(portType);
Endpoint endpoint = client.getEndpoint();
HTTPConduit conduit = (HTTPConduit) client.getConduit();
conduit.getClient().set
TLSClientParameters params = http.getTlsClientParameters();
if (params==null) {
    params = new TLSClientParameters();
    conduit.setTlsClientParameters(params);
}
params.setSecureSocketProtocol("SSL");
endpoint.getEndpointInfo().setAddress("
https://my.new.host:1234/some/path/to/my/service");

However, that doesn't work because I get:

Caused by: java.io.IOException: Illegal Protocol http for HTTPS 
URLConnection Factory.
        at 
org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(HttpsURLConnectionFactory.java:124)
        at 
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:480)
        at 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)

The workaround I used was to manually change the wsdl's endpoint address 
to have the correct protocol and port, but I thought I'd ask if anyone 
could recommend a way to change the protocol and port of the endpoint on 
the client.

Thanks!

Gary

-- 
Gary Weaver
Internet Framework Services
Office of Information Technology
Duke University





Re: Antwort: Re: Antwort: how do I set an endpoint with different a protocol (https vs. http) and port than the client generated by wsdl2java? [Virus checked]

Posted by Glen Mazza <gl...@gmail.com>.
Also shown here:
http://www.jroller.com/gmazza/entry/using_the_ebay_shopping_api1#clientcode

I think CXF may complain if you switch the protocol between https and http
(from what was originally in the WSDL), probably a CXF bug that can be fixed
by altering the protocol to https within the soap:address in the
wsdl:service section.  (I'm unsure if CXF still complains here, though.)

HTH,
Glen


jan.minaroviech wrote:
> 
> Hello,
> 
> try to cast the port you get from service stub implementation which is 
> generated from wsdl2java
> then apply following:
> ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
> address);
> 
> i never tried, but i believe that returned prot is also instance of 
> BindingProvider
> 
> best regards
> jano
> 
> 
> 
> 
> Gary Weaver <ga...@duke.edu> 
> 06/10/2008 23:05
> 
> An
> users@cxf.apache.org, jan.minaroviech@external.t-mobile.at
> Kopie
> 
> Thema
> Re: Antwort: how do I set an endpoint with different a protocol (https vs. 
> http) and port than the client generated by wsdl2java?  [Virus checked]
> 
> 
> 
> 
> 
> 
> Jano,
> 
> Thanks! I'm not sure how to use that with the wsdl2java generated client 
> classes, but I'll keep looking into it to see if I can understand how to 
> put that to use.
> 
> Gary
> 
> 
> jan.minaroviech@external.t-mobile.at wrote:
>> Hi,
>>
>> i never tried https, but hopefullty it's the same.
>>
>> first you need clientProxy in hand .. in my case it was
>>                                 JaxWsProxyFactoryBean factory = new 
>> JaxWsProxyFactoryBean();
>> factory.setServiceClass(serviceInterface);
>>                                 factory.setAddress(address);
>>                                 factory.setWsdlLocation(wsdlLocation);
>>                                 factory.setServiceName(QName.valueOf(
>> serviceName));
>>                                 factory.setProperties(new 
> HashMap<String, 
>> Object>());
>>                                 factory.getProperties().put(Message.
>> SCHEMA_VALIDATION_ENABLED, new Boolean(schemaValidationEnabled));
>>                                 factory.setEndpointName(QName.valueOf(
>> portName));
>>                                 T port = (T) factory.create();
>>
>> then if you want to change address, you can 
>> 1) recreate client with new address
>> 2) try to change it using following:
>> 
> ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
> 
>> address);
>>
>> note that 2) didn't work correctly in 2.1, but it should work in 
>> 2.1.1-snapshot ... i still didn't test it if it really works.
>>
>> best regards
>> jano
>>
>>
>>
>>
>>
>> Gary Weaver <ga...@duke.edu> 
>> 06/10/2008 22:14
>> Bitte antworten an
>> users@cxf.apache.org
>>
>>
>> An
>> users@cxf.apache.org
>> Kopie
>>
>> Thema
>> how do I set an endpoint with different a protocol (https vs. http) and 
>> port than the client generated by wsdl2java?  [Virus checked]
>>
>>
>>
>>
>>
>>
>> Hello,
>>
>> I was struggling trying to figure out how to use Rampart 1.3 with Axis2 
>> 1.3 (because I needed WS-Security), so I tried switching to using Apache 
> 
>> CXF 2.1 today instead of Axis2. So far CXF has been easy to use and 
>> overall has much better documentation, so a big thanks to all involved 
>> with the project! :)
>>
>> The background is that I'm using Maven 2 to build, and it is generating 
>> the client classes via the cxf-codegen-plugin v2.1 plugin.
>>
>> However, I've run into an issue that I couldn't find any clear example 
>> or documentation about. Specifically, in Axis/Axis2 it was never 
>> difficult to set an different endpoint on a client generated from the 
>> wsdl, and it usually was just a matter or setting a single URL.
>>
>> For example, in Axis2, even if the endpoint you are setting is HTTPS 
>> instead of HTTP and is listening on a different port, it is still very 
>> easy to change in the code:
>>
>> MyServiceStub stub = new MyServiceStub();
>> EndpointReference endpointReference = new 
>> EndpointReference("https://my.new.host:1234/some/path/to/my/service");
>> stub._getServiceClient().getOptions().setTo(endpointReference);
>>
>> However, in CXF, this is the best I could come up with so far, which I 
>> know to be wrong:
>>
>> MyService service = new MyService();
>> MyServicePortType portType = service.getMyServicePort();
>> Client client = org.apache.cxf.frontend.ClientProxy.getClient(portType);
>> Endpoint endpoint = client.getEndpoint();
>> HTTPConduit conduit = (HTTPConduit) client.getConduit();
>> conduit.getClient().set
>> TLSClientParameters params = http.getTlsClientParameters();
>> if (params==null) {
>>     params = new TLSClientParameters();
>>     conduit.setTlsClientParameters(params);
>> }
>> params.setSecureSocketProtocol("SSL");
>> endpoint.getEndpointInfo().setAddress("
>> https://my.new.host:1234/some/path/to/my/service");
>>
>> However, that doesn't work because I get:
>>
>> Caused by: java.io.IOException: Illegal Protocol http for HTTPS 
>> URLConnection Factory.
>>         at 
>> 
> org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(HttpsURLConnectionFactory.java:124)
>>         at 
>> org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:480)
>>         at 
>> 
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
>>
>> The workaround I used was to manually change the wsdl's endpoint address 
> 
>> to have the correct protocol and port, but I thought I'd ask if anyone 
>> could recommend a way to change the protocol and port of the endpoint on 
> 
>> the client.
>>
>> Thanks!
>>
>> Gary
>>
>> 
> 
> 
> -- 
> Gary Weaver
> Internet Framework Services
> Office of Information Technology
> Duke University
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-do-I-set-an-endpoint-with-different-a-protocol-%28https-vs.-http%29-and-port-than-the-client-generated-by-wsdl2java--tp17763775p17767057.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Antwort: Re: Antwort: how do I set an endpoint with different a protocol (https vs. http) and port than the client generated by wsdl2java? [Virus checked]

Posted by Gary Weaver <ga...@duke.edu>.
Jano,

Awesome! That worked!

MyService service = new MyService();
MyServicePortType portType = service.getMyServicePort();
((BindingProvider)portType).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
"https://my.new.host:1234/some/path/to/my/service");

Thanks!

Gary


jan.minaroviech@external.t-mobile.at wrote:
>
> Hello,
>
> try to cast the port you get from service stub implementation which is 
> generated from wsdl2java
> then apply following:
> ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
> address);
>
> i never tried, but i believe that returned prot is also instance of 
> BindingProvider
>
> best regards
> jano
>
>
>
> *Gary Weaver <ga...@duke.edu>*
>
> 06/10/2008 23:05
>
> 	
> An
> 	users@cxf.apache.org, jan.minaroviech@external.t-mobile.at
> Kopie
> 	
> Thema
> 	Re: Antwort: how do I set an endpoint with different a protocol 
> (https vs. http) and port than the client generated by wsdl2java? 
>  [Virus checked]
>
>
>
> 	
>
>
>
>
>
> Jano,
>
> Thanks! I'm not sure how to use that with the wsdl2java generated client
> classes, but I'll keep looking into it to see if I can understand how to
> put that to use.
>
> Gary
>
>
> jan.minaroviech@external.t-mobile.at wrote:
> > Hi,
> >
> > i never tried https, but hopefullty it's the same.
> >
> > first you need clientProxy in hand .. in my case it was
> >                                 JaxWsProxyFactoryBean factory = new
> > JaxWsProxyFactoryBean();
> >                                 
> factory.setServiceClass(serviceInterface);
> >                                 factory.setAddress(address);
> >                                 factory.setWsdlLocation(wsdlLocation);
> >                                 factory.setServiceName(QName.valueOf(
> > serviceName));
> >                                 factory.setProperties(new 
> HashMap<String,
> > Object>());
> >                                 factory.getProperties().put(Message.
> > SCHEMA_VALIDATION_ENABLED, new Boolean(schemaValidationEnabled));
> >                                 factory.setEndpointName(QName.valueOf(
> > portName));
> >                                 T port = (T) factory.create();
> >
> > then if you want to change address, you can
> > 1) recreate client with new address
> > 2) try to change it using following:
> > 
> ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
>
> > address);
> >
> > note that 2) didn't work correctly in 2.1, but it should work in
> > 2.1.1-snapshot ... i still didn't test it if it really works.
> >
> > best regards
> > jano
> >
> >
> >
> >
> >
> > Gary Weaver <ga...@duke.edu>
> > 06/10/2008 22:14
> > Bitte antworten an
> > users@cxf.apache.org
> >
> >
> > An
> > users@cxf.apache.org
> > Kopie
> >
> > Thema
> > how do I set an endpoint with different a protocol (https vs. http) and
> > port than the client generated by wsdl2java?  [Virus checked]
> >
> >
> >
> >
> >
> >
> > Hello,
> >
> > I was struggling trying to figure out how to use Rampart 1.3 with Axis2
> > 1.3 (because I needed WS-Security), so I tried switching to using 
> Apache
> > CXF 2.1 today instead of Axis2. So far CXF has been easy to use and
> > overall has much better documentation, so a big thanks to all involved
> > with the project! :)
> >
> > The background is that I'm using Maven 2 to build, and it is generating
> > the client classes via the cxf-codegen-plugin v2.1 plugin.
> >
> > However, I've run into an issue that I couldn't find any clear example
> > or documentation about. Specifically, in Axis/Axis2 it was never
> > difficult to set an different endpoint on a client generated from the
> > wsdl, and it usually was just a matter or setting a single URL.
> >
> > For example, in Axis2, even if the endpoint you are setting is HTTPS
> > instead of HTTP and is listening on a different port, it is still very
> > easy to change in the code:
> >
> > MyServiceStub stub = new MyServiceStub();
> > EndpointReference endpointReference = new
> > EndpointReference("https://my.new.host:1234/some/path/to/my/service");
> > stub._getServiceClient().getOptions().setTo(endpointReference);
> >
> > However, in CXF, this is the best I could come up with so far, which I
> > know to be wrong:
> >
> > MyService service = new MyService();
> > MyServicePortType portType = service.getMyServicePort();
> > Client client = org.apache.cxf.frontend.ClientProxy.getClient(portType);
> > Endpoint endpoint = client.getEndpoint();
> > HTTPConduit conduit = (HTTPConduit) client.getConduit();
> > conduit.getClient().set
> > TLSClientParameters params = http.getTlsClientParameters();
> > if (params==null) {
> >     params = new TLSClientParameters();
> >     conduit.setTlsClientParameters(params);
> > }
> > params.setSecureSocketProtocol("SSL");
> > endpoint.getEndpointInfo().setAddress("
> > https://my.new.host:1234/some/path/to/my/service");
> >
> > However, that doesn't work because I get:
> >
> > Caused by: java.io.IOException: Illegal Protocol http for HTTPS
> > URLConnection Factory.
> >         at
> > 
> org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(HttpsURLConnectionFactory.java:124)
> >         at
> > org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:480)
> >         at
> > 
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
> >
> > The workaround I used was to manually change the wsdl's endpoint 
> address
> > to have the correct protocol and port, but I thought I'd ask if anyone
> > could recommend a way to change the protocol and port of the 
> endpoint on
> > the client.
> >
> > Thanks!
> >
> > Gary
> >
> >  
>
>
> -- 
> Gary Weaver
> Internet Framework Services
> Office of Information Technology
> Duke University
>
>
>
>



Antwort: Re: Antwort: how do I set an endpoint with different a protocol (https vs. http) and port than the client generated by wsdl2java? [Virus checked]

Posted by ja...@external.t-mobile.at.
Hello,

try to cast the port you get from service stub implementation which is 
generated from wsdl2java
then apply following:
((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
address);

i never tried, but i believe that returned prot is also instance of 
BindingProvider

best regards
jano




Gary Weaver <ga...@duke.edu> 
06/10/2008 23:05

An
users@cxf.apache.org, jan.minaroviech@external.t-mobile.at
Kopie

Thema
Re: Antwort: how do I set an endpoint with different a protocol (https vs. 
http) and port than the client generated by wsdl2java?  [Virus checked]






Jano,

Thanks! I'm not sure how to use that with the wsdl2java generated client 
classes, but I'll keep looking into it to see if I can understand how to 
put that to use.

Gary


jan.minaroviech@external.t-mobile.at wrote:
> Hi,
>
> i never tried https, but hopefullty it's the same.
>
> first you need clientProxy in hand .. in my case it was
>                                 JaxWsProxyFactoryBean factory = new 
> JaxWsProxyFactoryBean();
> factory.setServiceClass(serviceInterface);
>                                 factory.setAddress(address);
>                                 factory.setWsdlLocation(wsdlLocation);
>                                 factory.setServiceName(QName.valueOf(
> serviceName));
>                                 factory.setProperties(new 
HashMap<String, 
> Object>());
>                                 factory.getProperties().put(Message.
> SCHEMA_VALIDATION_ENABLED, new Boolean(schemaValidationEnabled));
>                                 factory.setEndpointName(QName.valueOf(
> portName));
>                                 T port = (T) factory.create();
>
> then if you want to change address, you can 
> 1) recreate client with new address
> 2) try to change it using following:
> 
((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 

> address);
>
> note that 2) didn't work correctly in 2.1, but it should work in 
> 2.1.1-snapshot ... i still didn't test it if it really works.
>
> best regards
> jano
>
>
>
>
>
> Gary Weaver <ga...@duke.edu> 
> 06/10/2008 22:14
> Bitte antworten an
> users@cxf.apache.org
>
>
> An
> users@cxf.apache.org
> Kopie
>
> Thema
> how do I set an endpoint with different a protocol (https vs. http) and 
> port than the client generated by wsdl2java?  [Virus checked]
>
>
>
>
>
>
> Hello,
>
> I was struggling trying to figure out how to use Rampart 1.3 with Axis2 
> 1.3 (because I needed WS-Security), so I tried switching to using Apache 

> CXF 2.1 today instead of Axis2. So far CXF has been easy to use and 
> overall has much better documentation, so a big thanks to all involved 
> with the project! :)
>
> The background is that I'm using Maven 2 to build, and it is generating 
> the client classes via the cxf-codegen-plugin v2.1 plugin.
>
> However, I've run into an issue that I couldn't find any clear example 
> or documentation about. Specifically, in Axis/Axis2 it was never 
> difficult to set an different endpoint on a client generated from the 
> wsdl, and it usually was just a matter or setting a single URL.
>
> For example, in Axis2, even if the endpoint you are setting is HTTPS 
> instead of HTTP and is listening on a different port, it is still very 
> easy to change in the code:
>
> MyServiceStub stub = new MyServiceStub();
> EndpointReference endpointReference = new 
> EndpointReference("https://my.new.host:1234/some/path/to/my/service");
> stub._getServiceClient().getOptions().setTo(endpointReference);
>
> However, in CXF, this is the best I could come up with so far, which I 
> know to be wrong:
>
> MyService service = new MyService();
> MyServicePortType portType = service.getMyServicePort();
> Client client = org.apache.cxf.frontend.ClientProxy.getClient(portType);
> Endpoint endpoint = client.getEndpoint();
> HTTPConduit conduit = (HTTPConduit) client.getConduit();
> conduit.getClient().set
> TLSClientParameters params = http.getTlsClientParameters();
> if (params==null) {
>     params = new TLSClientParameters();
>     conduit.setTlsClientParameters(params);
> }
> params.setSecureSocketProtocol("SSL");
> endpoint.getEndpointInfo().setAddress("
> https://my.new.host:1234/some/path/to/my/service");
>
> However, that doesn't work because I get:
>
> Caused by: java.io.IOException: Illegal Protocol http for HTTPS 
> URLConnection Factory.
>         at 
> 
org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(HttpsURLConnectionFactory.java:124)
>         at 
> org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:480)
>         at 
> 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
>
> The workaround I used was to manually change the wsdl's endpoint address 

> to have the correct protocol and port, but I thought I'd ask if anyone 
> could recommend a way to change the protocol and port of the endpoint on 

> the client.
>
> Thanks!
>
> Gary
>
> 


-- 
Gary Weaver
Internet Framework Services
Office of Information Technology
Duke University





Re: Antwort: how do I set an endpoint with different a protocol (https vs. http) and port than the client generated by wsdl2java? [Virus checked]

Posted by Gary Weaver <ga...@duke.edu>.
Jano,

Thanks! I'm not sure how to use that with the wsdl2java generated client 
classes, but I'll keep looking into it to see if I can understand how to 
put that to use.

Gary


jan.minaroviech@external.t-mobile.at wrote:
> Hi,
>
> i never tried https, but hopefullty it's the same.
>
> first you need clientProxy in hand .. in my case it was
>                                 JaxWsProxyFactoryBean factory = new 
> JaxWsProxyFactoryBean();
>                                 factory.setServiceClass(serviceInterface);
>                                 factory.setAddress(address);
>                                 factory.setWsdlLocation(wsdlLocation);
>                                 factory.setServiceName(QName.valueOf(
> serviceName));
>                                 factory.setProperties(new HashMap<String, 
> Object>());
>                                 factory.getProperties().put(Message.
> SCHEMA_VALIDATION_ENABLED, new Boolean(schemaValidationEnabled));
>                                 factory.setEndpointName(QName.valueOf(
> portName));
>                                 T port = (T) factory.create();
>
> then if you want to change address, you can 
> 1) recreate client with new address
> 2) try to change it using following:
> ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
> address);
>
> note that 2) didn't work correctly in 2.1, but it should work in 
> 2.1.1-snapshot ... i still didn't test it if it really works.
>
> best regards
> jano
>
>
>
>
>
> Gary Weaver <ga...@duke.edu> 
> 06/10/2008 22:14
> Bitte antworten an
> users@cxf.apache.org
>
>
> An
> users@cxf.apache.org
> Kopie
>
> Thema
> how do I set an endpoint with different a protocol (https vs. http) and 
> port than the client generated by wsdl2java?  [Virus checked]
>
>
>
>
>
>
> Hello,
>
> I was struggling trying to figure out how to use Rampart 1.3 with Axis2 
> 1.3 (because I needed WS-Security), so I tried switching to using Apache 
> CXF 2.1 today instead of Axis2. So far CXF has been easy to use and 
> overall has much better documentation, so a big thanks to all involved 
> with the project! :)
>
> The background is that I'm using Maven 2 to build, and it is generating 
> the client classes via the cxf-codegen-plugin v2.1 plugin.
>
> However, I've run into an issue that I couldn't find any clear example 
> or documentation about. Specifically, in Axis/Axis2 it was never 
> difficult to set an different endpoint on a client generated from the 
> wsdl, and it usually was just a matter or setting a single URL.
>
> For example, in Axis2, even if the endpoint you are setting is HTTPS 
> instead of HTTP and is listening on a different port, it is still very 
> easy to change in the code:
>
> MyServiceStub stub = new MyServiceStub();
> EndpointReference endpointReference = new 
> EndpointReference("https://my.new.host:1234/some/path/to/my/service");
> stub._getServiceClient().getOptions().setTo(endpointReference);
>
> However, in CXF, this is the best I could come up with so far, which I 
> know to be wrong:
>
> MyService service = new MyService();
> MyServicePortType portType = service.getMyServicePort();
> Client client = org.apache.cxf.frontend.ClientProxy.getClient(portType);
> Endpoint endpoint = client.getEndpoint();
> HTTPConduit conduit = (HTTPConduit) client.getConduit();
> conduit.getClient().set
> TLSClientParameters params = http.getTlsClientParameters();
> if (params==null) {
>     params = new TLSClientParameters();
>     conduit.setTlsClientParameters(params);
> }
> params.setSecureSocketProtocol("SSL");
> endpoint.getEndpointInfo().setAddress("
> https://my.new.host:1234/some/path/to/my/service");
>
> However, that doesn't work because I get:
>
> Caused by: java.io.IOException: Illegal Protocol http for HTTPS 
> URLConnection Factory.
>         at 
> org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(HttpsURLConnectionFactory.java:124)
>         at 
> org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:480)
>         at 
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
>
> The workaround I used was to manually change the wsdl's endpoint address 
> to have the correct protocol and port, but I thought I'd ask if anyone 
> could recommend a way to change the protocol and port of the endpoint on 
> the client.
>
> Thanks!
>
> Gary
>
>   


-- 
Gary Weaver
Internet Framework Services
Office of Information Technology
Duke University