web services - JaxWS : Externalize Http Conduit name Attribute -
i have wsdl file soap webservice need invoke on http. using cxf wsdl2java plugin have created stub methods.
i have created webservice client using jaxws. webservice has basic authentication enabled. trying configure http conduit
application.properties -------------------------- webservices.http.auth.username=username webservices.http.auth.password=password fold.webservices.http.auth.authtype=basic webservices.http.conduit.property.name=https://fixed_deposits-test.co.in/fold-webservices/services.* fold.updateservice.soap.address=https://fixed_deposits-test.co.in/fold-webservices/services/updateservice ----------------------------
my spring context...
<?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/jaxws" xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <bean id="properties" class="org.apache.camel.spring.spi.bridgepropertyplaceholderconfigurer"> <property name="locations"> <util:list> <value>file:${config.dir}/application.properties</value> </util:list> </property> <property name="systempropertiesmodename" value="system_properties_mode_override" /> </bean> <jaxws:client id="updateserviceclient" serviceclass="com.fold.facade.v1.updateservice" address="${fold.updateservice.soap.address}" > <jaxws:ininterceptors> <bean id="loggingininterceptor" class="org.apache.cxf.interceptor.loggingininterceptor" > <property name="prettylogging" value="true" /> </bean> </jaxws:ininterceptors> <jaxws:outinterceptors> <bean id="loggingoutinterceptor" class="org.apache.cxf.interceptor.loggingoutinterceptor" > <property name="prettylogging" value="true" /> </bean> </jaxws:outinterceptors> </jaxws:client> <http-conf:conduit name="***?????????***"> <http-conf:authorization> <sec:username>${fold.webservices.http.auth.username}</sec:username> <sec:password>${fold.webservices.http.auth.password}</sec:password> <sec:authorizationtype>${fold.webservices.http.auth.authtype}</sec:authorizationtype> </http-conf:authorization> </http-conf:conduit>
i have done lot of searching online should valid value name attribute..
accouring cxf documentation should be...
{wsdl_endpoint_target_namespace}portname.http-conduit
my wsdl file has..
... targetnamespace="http://facade.fold.com/" , ... <wsdl:port binding="tns:updateserviceimplservicesoapbinding" name="updateserviceimplport"> <soap:address location="https://fixed_deposits-test.co.in/fold-webservices/services/updateservice" /> </wsdl:port>
so tried these..
<http-conf:conduit name="{http://facade.fold.com/}updateserviceimplport.http_conduit"> or <http-conf:conduit name="*updateserviceimplport.http_conduit"> or <http-conf:conduit name="{http://facade.fold.com/}*.http_conduit">
but none of them work 401 unauthorized exception..
org.apache.cxf.transport.http.httpexception: http response '401: unauthorized' when communicating https://fixed_deposits-test.co.in/fold-webservices/services/updateservice
there couple of ways got work
a) <http-conf:conduit name="*.http_conduit">
but don't want way...
b) <http-conf:conduit name="https://fixed_deposits-test.co.in/fold-webservices/services/updateservice">
this hardcoding soap service url... don't want looking externalizing url soap url's different different environment..(dev /test /prod etc)
below best shot @ externalization, failed 401 unauthorized exception...
properties replaced in other instances in spring context, not http-conf:conduit name attribute :(
<http-conf:conduit name="${webservices.http.conduit.property.name}">
as workaround using regex approach works..
<http-conf:conduit name="*.*/fold-webservices/services/updateservice">
but want figure out if possible externalize , read properties file. , want spring configuration way. please me !!!
i had same problem...
in case following 2 changes helped:
1) add "port" postfix port name, despite not defined in wsdl was
e.g wsdl: <wsdl:port name="xxxsoap">
will "xxxsoapport" in conduit definition
2) remove "\" @ end of target namespace name
==> therefore try
<http-conf:conduit name="{http://facade.fold.com}updateserviceimplport.http_conduit"> or <http-conf:conduit name="{http://facade.fold.com}updateserviceimplportport.http_conduit">
Comments
Post a Comment