Ah, this dosn't work.
The thing is that sometimes I don't want to load the cxf.xml file.
See, the XML file configures HTTPS on a number of endpoints. HTTPS is
required to access these endpoints in the production environment (and
in staging), however, we don't have HTTPS in the test environmnet.
My component (that accesses these endpoints) will know which
environment it operates in, and will have to configure HTTPS
appropriately at runtime.
So, how can I do this? How can I replace the http:conduit element with
a set of API calls?
2007/9/5, Christian Vest Hansen <[EMAIL PROTECTED]>:
> Thanks!
>
> Renaming beans.xml to cxf.xml seams suitable to my situation :)
>
> 2007/9/5, Willem Jiang <[EMAIL PROTECTED]>:
> > Hi,
> >
> > You could name the beans.xml to cxf.xml and put it into the class path.
> > CXF will load it automatically.
> > You could also use -Dcxf.config.file=beans.xml load the configuration
> > file in the class path,
> > or you could use -Dcxf.config.file.url={beans.xml url} to load the
> > configuration file.
> >
> > Another option is you could load the bus with this beans.xml [1]
> > [1]http://www.nabble.com/Setting-the-timeout-on-the-client-side-tf4361130.html#a12429634
> >
> >
> > Willem.
> >
> > Christian Vest Hansen wrote:
> > > Hi,
> > >
> > > I have a beans.xml file containing:
> > >
> > > <http:conduit
> > >
> > > name="{http://ws.unwire.dk/ldap/MyService/v1}MyService1Staging.http-conduit">
> > > <http:tlsClientParameters secureSocketProtocol="SSL">
> > > </http:tlsClientParameters>
> > > </http:conduit>
> > >
> > > And a little test client that does this in it's main() method:
> > >
> > > ApplicationContext ac = new
> > > ClassPathXmlApplicationContext("beans.xml");
> > > MyService1_Service service = new MyService1_Service();
> > > MyService1 my = service.getMyService1Staging();
> > >
> > > Client c = ClientProxy.getClient(my);
> > > HTTPConduit conduit = (HTTPConduit) c.getConduit();
> > > TLSClientParameters tlsParams = new TLSClientParameters();
> > > conduit.setTlsClientParameters(tlsParams);
> > > System.out.println(my.someOperation());
> > >
> > > And that works and all is well.
> > >
> > > However, if I comment the creation of the ApplicationContext out, I
> > > get the following error:
> > >
> > > INFO: Creating Service
> > > {http://ws.unwire.dk/ldap/MyService/v1}MyService1 from WSDL:
> > > https://staging.unwire.dk/ldapservice/services/MyService1?wsdl
> > > Exception in thread "main" org.apache.cxf.interceptor.Fault: No
> > > conduit initiator was found for the namepsace
> > > http://schemas.xmlsoap.org/soap/http.
> > > at
> > > org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:89)
> > > at
> > > org.apache.cxf.endpoint.UpfrontConduitSelector.selectConduit(UpfrontConduitSelector.java:71)
> > > at
> > > org.apache.cxf.endpoint.ClientImpl.getConduit(ClientImpl.java:413)
> > > at
> > > dk.unwire.ws.ldap.myservice.v1.MyService1_Service.main(Main.java:95)
> > > Caused by: org.apache.cxf.BusException: No conduit initiator was found
> > > for the namepsace http://schemas.xmlsoap.org/soap/http.
> > > at
> > > org.apache.cxf.transport.ConduitInitiatorManagerImpl.getConduitInitiator(ConduitInitiatorManagerImpl.java:96)
> > > at
> > > org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:70)
> > > ... 3 more
> > >
> > >
> > > So, is it possible to perform the same configuration using the API as
> > > would otherwise have been done by the ApplicationContext and the
> > > http:conduit element?
> > >
> > > This whole thing is being used in a component intended for other
> > > projects to use, so I could simplify my public interface and
> > > configuration overhead if I could make all the default configurations
> > > built in.
> > >
> > >
> >
>
>
> --
> Venlig hilsen / Kind regards,
> Christian Vest Hansen.
>
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.