0 Replies Latest reply on Aug 4, 2016 6:29 AM by beena kumari

    Expose Webservice via https

    beena kumari Newbie

      #############################    camel-route.xml      #####################################

       

      <?xml version="1.0" encoding="UTF-8"?>

      <beans xmlns="http://www.springframework.org/schema/beans"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws

            xmlns:cxf="http://cxf.apache.org/core"

            xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"

            xmlns:sec="http://cxf.apache.org/configuration/security"

            xmlns:camel="http://camel.apache.org/schema/spring"

            xsi:schemaLocation="

            http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd 

            http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd 

            http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd

            http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd

            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

            http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd ">

       

        <import resource="classpath:META-INF/spring/camel-cxf.xml" />

       

        <bean id="SocketConnectorId" class="org.eclipse.jetty.server.bio.SocketConnector">

              <property name = "port" value="9000" />

         </bean>

       

        <bean id="DefaultHandlerId" class="org.eclipse.jetty.server.handler.DefaultHandler"></bean>

                      

        <cxf:bus>

              <cxf:features>

                 <!--  <httpj:identifiedTLSServerParameters id="secure">

                      <httpj:tlsServerParameters>

                          <sec:keyManagers keyPassword="123456">

                              <sec:keyStore type="JKS" password="123456"

                                            file="/users/kumabe/keystore.jks"/>

                          </sec:keyManagers>

                      </httpj:tlsServerParameters>

                  </httpj:identifiedTLSServerParameters>   -->

       

                  <httpj:engine port="9000">   

                      <log message="Got 11"/>

                      <httpj:tlsServerParametersRef id="sslContextParameters" ></httpj:tlsServerParametersRef>

                      <httpj:threadingParameters minThreads="5"  maxThreads="15" />

                       <log message="Got 11"/>

                      <httpj:connector >

                     <!-- <beans:bean class="org.eclipse.jetty.server.bio.SocketConnector">

                              <beans:property name = "port" value="9000" />

                          </beans:bean>  -->

                      <ref bean="SocketConnectoId"/>

                        <!--  <beans:ref bean="SocketConnectoId"></beans:ref>   -->

                      </httpj:connector>

                      <httpj:handlers>

                          <!-- <beans:ref bean="DefaultHandlerId"></beans:ref> -->

                           <ref bean="DefaultHandlerId"/>

                          <!-- <beans:bean class="org.eclipse.jetty.server.handler.DefaultHandler"> </beans:bean> -->

                      </httpj:handlers>

                      <httpj:sessionSupport>true</httpj:sessionSupport>

                  </httpj:engine>                      

              </cxf:features>

          </cxf:bus>

             

           <camel:camelContext>

                    <camel:route>

                           <camel:from uri="cxf:bean:orderEndpoint" >

                             </camel:from>

                                    <camel:to uri="updateCustomer"></camel:to>

                               

                                   </camel:route>

                              

                                   <camel:route>

                                    <camel:from uri="jetty:https://localhost:9000/MCSServices-service/?sslContextParametersRef=sslContextParameters" >

                                    </camel:from>

                                    <camel:to uri="jetty:http://localhost:9000/MCSServices-service/?bridgeEndpoint=true"></camel:to>

                               

                                   </camel:route>

                                   </camel:camelContext>

                                                  

         <camel:sslContextParameters id="sslContextParameters">

          <camel:keyManagers keyPassword="123456">

            <camel:keyStore resource="src/main/resources/wsdl/keystore.jks" password="123456"/>

          </camel:keyManagers>

        </camel:sslContextParameters>

       

      </beans>

       

       

      ##############################    camel-cxf.xml  ###########################################################

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!--

          Licensed to the Apache Software Foundation (ASF) under one or more

          contributor license agreements.  See the NOTICE file distributed with

          this work for additional information regarding copyright ownership.

          The ASF licenses this file to You under the Apache License, Version 2.0

          (the "License"); you may not use this file except in compliance with

          the License.  You may obtain a copy of the License at

       

       

          http://www.apache.org/licenses/LICENSE-2.0

       

       

          Unless required by applicable law or agreed to in writing, software

          distributed under the License is distributed on an "AS IS" BASIS,

          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

          See the License for the specific language governing permissions and

          limitations under the License.

      -->

       

       

      <beans xmlns="http://www.springframework.org/schema/beans"

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xmlns:cxf="http://camel.apache.org/schema/cxf"

             xsi:schemaLocation="

               http://www.springframework.org/schema/beans

               http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

               http://camel.apache.org/schema/cxf

               http://camel.apache.org/schema/cxf/camel-cxf.xsd">

      <bean id="loggingOutInterceptor" class="au.com.ee.services.EELogger" />

        <cxf:cxfEndpoint id="orderEndpoint"

                         address="https://localhost:9000/MCSServices-service/"

                         serviceClass="com.example.xmlns._1233276639344.PortType"

                         wsdlURL="wsdl/IE31.wsdl">

                          <cxf:inInterceptors>

                          <ref bean="loggingOutInterceptor"/>

                         </cxf:inInterceptors>

                         </cxf:cxfEndpoint>

      </beans>

       

      I want to expose webservice with https

      but getting error as

       

      java.lang.reflect.InvocationTargetException

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:606)

              at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:488)

              at java.lang.Thread.run(Thread.java:745)

      Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [C:\work\Beena_Workspace\cam

      7\cxf\contract_first\target\classes\META-INF\spring\camel-route.xml]; nested exception is java.lang.NullPointerException

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)

              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:252)

              at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)

              at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)

              at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)

              at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:452)

              at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

              at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)

              at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:216)

              at org.apache.camel.spring.Main.doStart(Main.java:156)

              at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)

              at org.apache.camel.main.MainSupport.run(MainSupport.java:150)

              at org.apache.camel.main.MainSupport.run(MainSupport.java:354)

              at org.apache.camel.spring.Main.main(Main.java:89)

              ... 6 more

      Caused by: java.lang.NullPointerException

              at org.apache.cxf.transport.http_jetty.spring.JettyHTTPServerEngineBeanDefinitionParser.doParse(JettyHTTPServerEngineBeanDefinitionParser.java:98)

              at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)

              at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:61)

              at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)

              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1427)

              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseNestedCustomElement(BeanDefinitionParserDelegate.java:1480)

              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parsePropertySubElement(BeanDefinitionParserDelegate.java:1034)

              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCollectionElements(BeanDefinitionParserDelegate.java:1218)

              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseListElement(BeanDefinitionParserDelegate.java:1194)

              at org.apache.cxf.bus.spring.BusDefinitionParser.mapElement(BusDefinitionParser.java:118)

              at org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser.parseChildElements(AbstractBeanDefinitionParser.java:144)

              at org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser.doParse(AbstractBeanDefinitionParser.java:78)