In case there's isn't (hopefully others can help you out here), you'll almost certainly want to use XSLT[1] to change the URLs from https:// to http:// or vice-versa. Learning how to do this is time well spent, as such ability can be used in many other circumstances.
Glen [1] http://www-128.ibm.com/developerworks/edu/wa-autoxml1-i.html Christopher Cheng wrote: > > In the production environment, we use http through VPN (which is better > than > https and without VPN) and in the development environment, we use https > only. There are over 100 wsdl in my project so changing all default URLs > is > a real pain. > Is there a less painful way to fix this mess? > > On Sat, Jan 3, 2009 at 3:59 AM, Glen Mazza <[email protected]> wrote: > >> >> Just a guess...if you look at your SessionCreateRQService.java file, >> you'll >> see that it hardcodes a WSDL file, almost certainly the WSDL you used to >> create the class. >> >> Anyway, if you modify *that* WSDL (i.e., go into that WSDL's >> wsdl:service/port and modify the default URL there), and change the URL >> there from https to http, your problem below should get fixed (as a >> matter >> of fact, you can even switch the WSDL completely to the actual URL you >> want >> to use and not need to set the endpoint address below.) IIRC setting the >> ENDPOINT_ADDRESS_PROPERTY works with CXF if you're going https<-->https, >> or >> http<-->http, but between the two protocols this error tends to occur. >> Probably a bug, but just as well I would say, in case you accidentally >> downgraded from https to http without realizing it. >> >> Glen >> >> >> Christopher Cheng wrote: >> > >> > It doesn't seem to work... Any idea? >> > >> > SessionCreateRQService service = new SessionCreateRQService(); >> > SessionCreatePortType port = >> service.getSessionCreatePortType(); >> > >> > Client c = ClientProxy.getClient(port); >> > HTTPConduit conduit = (HTTPConduit) c.getConduit(); >> > conduit.setTlsClientParameters(null); >> > >> > String endpointAddress = >> "http://webservices.mydomain.com/websrc >> "; >> > Map<String, Object> requestContext = >> > ((BindingProvider)port).getRequestContext(); >> > requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, >> > endpointAddress); >> > >> > >> > It returns >> > >> > javax.xml.ws.soap.SOAPFaultException: Could not send Message. >> > at >> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145) >> > at $Proxy47.sessionCreateRQ(Unknown Source) >> > at test.SessionCreateTest.getSession(SessionCreateTest.java:87) >> > at test.SessionCreateTest.main(SessionCreateTest.java:30) >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> > at >> > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> > at >> > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> > at java.lang.reflect.Method.invoke(Method.java:597) >> > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) >> > Caused by: org.apache.cxf.interceptor.Fault: Could not send Message. >> > at >> > >> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:48) >> > at >> > >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) >> > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466) >> > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299) >> > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251) >> > at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) >> > at >> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) >> > ... 8 more >> > 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:482) >> > at >> > >> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46) >> > ... 14 more >> > >> > >> >>You'll probably need to do: >> >>Client cl = ClientProxy.getClient(port); >> > (HttpConduit)cl.getConduit()).setTlsClientParameters(null); >> >>to make sure the TLS stuff is all reset to nothing and force >> > re-initializing the conduit as a non-tls conduit. >> >>Dan >> > >> > >> > >> > On Tuesday 16 December 2008 10:38:52 am Christopher Cheng wrote: >> > >> >> I was trying to change the endpoint address from a https address to >> > >> >> http address >> > >> >> >> > >> >> endpointAddress = >> >> *http://webservices.mydomain.com/websrc*< >> http://webservices.mydomain.com/websrc> >> > ; >> > >> >> SessionCreateRQService service = new SessionCreateRQService(); >> > >> >> SessionCreatePortType port = service.getSessionCreatePortType(); >> > >> >> Map<String, Object> requestContext = >> > >> >> ((BindingProvider)port).getRequestContext(); >> > >> >> requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, >> > >> >> endpointAddress); >> > >> >> >> > >> >> >> > >> >> CXF produces an error like this. What am I missing? >> > >> >> >> > >> >> Caused by: java.io.IOException: Illegal Protocol http for HTTPS >> > >> >>URLConnection Factory. >> > >> >> at >> > >> >> >> > >> >>org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnecti >> > >> >>on(H >> > >> >>ttpsURLConnectionFactory.java:124) at >> > >> >> >> > >> >>org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:482) >> > >> >>at >> > >> >>org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Messa >> > >> >>geSe >> > >> >>nderInterceptor.java:46) ... 14 more >> > >> > >> > >> > >> > >> > -- >> > >> > Daniel Kulp >> > >> > [email protected] >> > >> > *http://dankulp.com/blog* <http://dankulp.com/blog> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Re%3A-Re%3A-problem-changing-endpoint-address-from-https-to-http-tp21254391p21256811.html >> Sent from the cxf-user mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Re%3A-Re%3A-problem-changing-endpoint-address-from-https-to-http-tp21254391p21297901.html Sent from the cxf-user mailing list archive at Nabble.com.
