You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rodriguez, José <Jo...@generali.ch> on 2009/04/07 12:09:06 UTC

WS-Security with SSL: Http error 415

Hi,

I have a cxf 2.0.10 client and I try to use a service with WS-Security and SSL. The service is based on the Microsoft implementation.

It works just fine with soapUI but using CXF I have the following exception:

7 avr. 2009 11:33:58 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
	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)
	at $Proxy40.test(Unknown Source)
	at ch.generali.test.ServiceFlexiServices.woot(ServiceFlexiServices.java:10)
	at ch.generali.test.ServiceFlexiServices.main(ServiceFlexiServices.java:26)
Caused by: java.io.IOException: Server returned HTTP response code: 415 for URL: https://xxxx/xxxxx.svc
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1225)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1219)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:906)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2097)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1987)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1912)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:179)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:611)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	... 9 more




Here is my applicationContext:

...

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

	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />

	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />


	<cxf:bus>
		<cxf:inInterceptors>
			<ref bean="logInbound" />
		</cxf:inInterceptors>
		<cxf:outInterceptors>
			<ref bean="logOutbound" />
		</cxf:outInterceptors>
		<cxf:inFaultInterceptors>
			<ref bean="logOutbound" />
		</cxf:inFaultInterceptors>
	</cxf:bus>


	<http:conduit name="*.http-conduit">
		<http:client ProxyServer="xxxxx" ProxyServerPort="xxxx" />
     
       
	</http:conduit>

	<bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
	<bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />

	<bean id="xxxxx" class="xxxxxxx">

		<property name="XXXX" ref="XXXX"></property>

	</bean>

	<jaxws:client id="XXXX" serviceClass="XXXX"
		address="https://xxxxx/xxxx.svc"
		wsdlLocation="classpath:META-INF/xxxxxx.wsdl" serviceName="s:xxxxxx"
		xmlns:s="http://xxxxxxxxx">
		<jaxws:outInterceptors>
			<!--
				SAAJ Interceptor needs to be explicitly declared only in CXF 2.0.x
			-->
			<bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />

			<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
				<constructor-arg>
					<map>
						<entry key="action" value="UsernameToken" />
						<entry key="user" value="xxxxxxxx" />
						<entry key="passwordType" value="PasswordDigest" />
						<entry>
							<key>
								<value>passwordCallbackRef</value>
							</key>
							<ref bean="passwordCallback" />
						</entry>
					</map>
				</constructor-arg>
			</bean>
		</jaxws:outInterceptors>

	</jaxws:client>

	<bean id="passwordCallback" class="XXX.PasswordCallbackHandler" />
</beans>
...


I also tried :
- CXF 2.2
- changing the content type to "text/xml; action='http://tempuri.org/IFlexicarService/Test'; charset=UTF-8" 
- <http:tlsClientParameters secureSocketProtocol="SSL"></http:tlsClientParameters>


Any ideas?

Regards
J.


Re: WS-Security with SSL: Http error 415

Posted by Ian Homer <ia...@gmail.com>.
Jose,

Not sure I understand when you say the WSDL specifies soap12, but the  
server only supports soap11.  If the WSDL specifies soap12 then I'd  
hope the server would support soap12.

If you want to pick up different soap endpoints in the WSDL we did it  
in GroovyWS in this way ...

     protected void configureClientParameters(Client client) {
         for (ServiceInfo sInfo :  
client.getEndpoint().getService().getServiceInfos()) {
             for (BindingInfo bInfo : sInfo.getBindings()) {
                 if (bInfo instanceof SoapBindingInfo) {
                     SoapBindingInfo sbi = (SoapBindingInfo)bInfo;

                     if (sbi.getSoapVersion().getVersion() ==  
this.preferredSoapVersion.value()) {
                         this.soapBindingInfo = sbi;
                     }
                 }
             }
         }
     }

see http://svn.codehaus.org/gmod/groovyws/trunk/src/main/java/groovyx/net/ws/cxf/SoapHelper.java 
.

however I now tend to use explicit service and port settings on the  
client because I like the control, e.g.

		QName service = new QName("http://tempuri.org/", "CalculatorService");
		QName port = new QName("http://tempuri.org/", "SSLCalculatorA");

		Client client =  
DynamicClientFactory.newInstance().createClient(WSDL_URI_REMOTE,  
service,
				this.getClass().getClassLoader(), port);

Cheers,

Ian


On 7 Apr 2009, at 12:46, Rodriguez, José wrote:

> Hi Ian,
>
> Thanks so much.
>
> The problem is that the service WSDL specifies soap12 but the server  
> only supports soap 1.1 requests.
> SoapUI was using SOAP 1.1. When I changed it to 1.2 I had the same  
> error.
>
> Is there a way to force the cxf client to use soap 1.1 without  
> changing the wsdl file? I haven't found the answer in the CXF  
> documentation.
>
>
> Regards,
> Jose
>
> -----Message d'origine-----
> De : Ian Homer [mailto:ian.homer@gmail.com]
> Envoyé : mardi, 7. avril 2009 12:22
> À : users@cxf.apache.org
> Objet : Re: WS-Security with SSL: Http error 415
>
>
> You might be sending a SOAP 1.1 request to a SOAP 1.2 port.  I've seen
> a 415 thrown from WCF for this reason.  415 essentially means an
> unsupported media type - http://www.w3.org/2000/xp/Group/2/03/11/soap-1.2-conformance.html#http-415
>
> Cheers,
>
> Ian
>
> On 7 Apr 2009, at 11:09, Rodriguez, José wrote:
>
>> Hi,
>>
>> I have a cxf 2.0.10 client and I try to use a service with WS-
>> Security and SSL. The service is based on the Microsoft
>> implementation.
>>
>> It works just fine with soapUI but using CXF I have the following
>> exception:
>>
>> 7 avr. 2009 11:33:58 org.apache.cxf.phase.PhaseInterceptorChain
>> doIntercept
>> INFO: Interceptor has thrown exception, unwinding now
>> org.apache.cxf.interceptor.Fault: Could not send Message.
>> 	at org.apache.cxf.interceptor.MessageSenderInterceptor
>> $
>> MessageSenderEndingInterceptor
>> .handleMessage(MessageSenderInterceptor.java:64)
>> 	at
>> org
>> .apache
>> .cxf
>> .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
>> 236)
>> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
>> 	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)
>> 	at $Proxy40.test(Unknown Source)
>> 	at
>> ch.generali.test.ServiceFlexiServices.woot(ServiceFlexiServices.java:
>> 10)
>> 	at
>> ch.generali.test.ServiceFlexiServices.main(ServiceFlexiServices.java:
>> 26)
>> Caused by: java.io.IOException: Server returned HTTP response code:
>> 415 for URL: https://xxxx/xxxxx.svc
>> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>> 	at
>> sun
>> .reflect
>> .NativeConstructorAccessorImpl
>> .newInstance(NativeConstructorAccessorImpl.java:39)
>> 	at
>> sun
>> .reflect
>> .DelegatingConstructorAccessorImpl
>> .newInstance(DelegatingConstructorAccessorImpl.java:27)
>> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>> 	at sun.net.www.protocol.http.HttpURLConnection
>> $6.run(HttpURLConnection.java:1225)
>> 	at java.security.AccessController.doPrivileged(Native Method)
>> 	at
>> sun
>> .net
>> .www
>> .protocol
>> .http.HttpURLConnection.getChainedException(HttpURLConnection.java:
>> 1219)
>> 	at
>> sun
>> .net
>> .www
>> .protocol
>> .http.HttpURLConnection.getInputStream(HttpURLConnection.java:906)
>> 	at
>> sun
>> .net
>> .www
>> .protocol
>> .https
>> .HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:
>> 234)
>> 	at org.apache.cxf.transport.http.HTTPConduit
>> $WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2097)
>> 	at org.apache.cxf.transport.http.HTTPConduit
>> $WrappedOutputStream.handleResponse(HTTPConduit.java:1987)
>> 	at org.apache.cxf.transport.http.HTTPConduit
>> $WrappedOutputStream.close(HTTPConduit.java:1912)
>> 	at
>> org
>> .apache
>> .cxf
>> .io
>> .CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:
>> 47)
>> 	at
>> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:
>> 179)
>> 	at
>> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:
>> 66)
>> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:
>> 611)
>> 	at org.apache.cxf.interceptor.MessageSenderInterceptor
>> $
>> MessageSenderEndingInterceptor
>> .handleMessage(MessageSenderInterceptor.java:62)
>> 	... 9 more
>>
>>
>>
>>
>> Here is my applicationContext:
>>
>> ...
>>
>> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>>
>> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>>
>> 	<import resource="classpath:META-INF/cxf/cxf-extension-http-
>> jetty.xml" />
>>
>>
>> 	<cxf:bus>
>> 		<cxf:inInterceptors>
>> 			<ref bean="logInbound" />
>> 		</cxf:inInterceptors>
>> 		<cxf:outInterceptors>
>> 			<ref bean="logOutbound" />
>> 		</cxf:outInterceptors>
>> 		<cxf:inFaultInterceptors>
>> 			<ref bean="logOutbound" />
>> 		</cxf:inFaultInterceptors>
>> 	</cxf:bus>
>>
>>
>> 	<http:conduit name="*.http-conduit">
>> 		<http:client ProxyServer="xxxxx" ProxyServerPort="xxxx" />
>>
>>
>> 	</http:conduit>
>>
>> 	<bean id="logInbound"
>> class="org.apache.cxf.interceptor.LoggingInInterceptor" />
>> 	<bean id="logOutbound"
>> class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
>>
>> 	<bean id="xxxxx" class="xxxxxxx">
>>
>> 		<property name="XXXX" ref="XXXX"></property>
>>
>> 	</bean>
>>
>> 	<jaxws:client id="XXXX" serviceClass="XXXX"
>> 		address="https://xxxxx/xxxx.svc"
>> 		wsdlLocation="classpath:META-INF/xxxxxx.wsdl"  
>> serviceName="s:xxxxxx"
>> 		xmlns:s="http://xxxxxxxxx">
>> 		<jaxws:outInterceptors>
>> 			<!--
>> 				SAAJ Interceptor needs to be explicitly declared only in CXF  
>> 2.0.x
>> 			-->
>> 			<bean
>> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
>>
>> 			<bean  
>> class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
>> 				<constructor-arg>
>> 					<map>
>> 						<entry key="action" value="UsernameToken" />
>> 						<entry key="user" value="xxxxxxxx" />
>> 						<entry key="passwordType" value="PasswordDigest" />
>> 						<entry>
>> 							<key>
>> 								<value>passwordCallbackRef</value>
>> 							</key>
>> 							<ref bean="passwordCallback" />
>> 						</entry>
>> 					</map>
>> 				</constructor-arg>
>> 			</bean>
>> 		</jaxws:outInterceptors>
>>
>> 	</jaxws:client>
>>
>> 	<bean id="passwordCallback" class="XXX.PasswordCallbackHandler" />
>> </beans>
>> ...
>>
>>
>> I also tried :
>> - CXF 2.2
>> - changing the content type to "text/xml; action='http://tempuri.org/IFlexicarService/Test'
>> ; charset=UTF-8"
>> - <http:tlsClientParameters secureSocketProtocol="SSL"></
>> http:tlsClientParameters>
>>
>>
>> Any ideas?
>>
>> Regards
>> J.
>>
>
> -- 
> Ian Homer | http://blog.bemoko.com
>
>
>
>
>
>

-- 
Ian Homer | http://blog.bemoko.com







RE: WS-Security with SSL: Http error 415

Posted by Rodriguez, José <Jo...@generali.ch>.
Hi Ian,

Thanks so much. 

The problem is that the service WSDL specifies soap12 but the server only supports soap 1.1 requests.
SoapUI was using SOAP 1.1. When I changed it to 1.2 I had the same error.

Is there a way to force the cxf client to use soap 1.1 without changing the wsdl file? I haven't found the answer in the CXF documentation.


Regards,
Jose

-----Message d'origine-----
De : Ian Homer [mailto:ian.homer@gmail.com]
Envoyé : mardi, 7. avril 2009 12:22
À : users@cxf.apache.org
Objet : Re: WS-Security with SSL: Http error 415


You might be sending a SOAP 1.1 request to a SOAP 1.2 port.  I've seen  
a 415 thrown from WCF for this reason.  415 essentially means an  
unsupported media type - http://www.w3.org/2000/xp/Group/2/03/11/soap-1.2-conformance.html#http-415

Cheers,

Ian

On 7 Apr 2009, at 11:09, Rodriguez, José wrote:

> Hi,
>
> I have a cxf 2.0.10 client and I try to use a service with WS- 
> Security and SSL. The service is based on the Microsoft  
> implementation.
>
> It works just fine with soapUI but using CXF I have the following  
> exception:
>
> 7 avr. 2009 11:33:58 org.apache.cxf.phase.PhaseInterceptorChain  
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor 
> $ 
> MessageSenderEndingInterceptor 
> .handleMessage(MessageSenderInterceptor.java:64)
> 	at  
> org 
> .apache 
> .cxf 
> .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java: 
> 236)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
> 	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)
> 	at $Proxy40.test(Unknown Source)
> 	at  
> ch.generali.test.ServiceFlexiServices.woot(ServiceFlexiServices.java: 
> 10)
> 	at  
> ch.generali.test.ServiceFlexiServices.main(ServiceFlexiServices.java: 
> 26)
> Caused by: java.io.IOException: Server returned HTTP response code:  
> 415 for URL: https://xxxx/xxxxx.svc
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native  
> Method)
> 	at  
> sun 
> .reflect 
> .NativeConstructorAccessorImpl 
> .newInstance(NativeConstructorAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingConstructorAccessorImpl 
> .newInstance(DelegatingConstructorAccessorImpl.java:27)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> 	at sun.net.www.protocol.http.HttpURLConnection 
> $6.run(HttpURLConnection.java:1225)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at  
> sun 
> .net 
> .www 
> .protocol 
> .http.HttpURLConnection.getChainedException(HttpURLConnection.java: 
> 1219)
> 	at  
> sun 
> .net 
> .www 
> .protocol 
> .http.HttpURLConnection.getInputStream(HttpURLConnection.java:906)
> 	at  
> sun 
> .net 
> .www 
> .protocol 
> .https 
> .HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java: 
> 234)
> 	at org.apache.cxf.transport.http.HTTPConduit 
> $WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2097)
> 	at org.apache.cxf.transport.http.HTTPConduit 
> $WrappedOutputStream.handleResponse(HTTPConduit.java:1987)
> 	at org.apache.cxf.transport.http.HTTPConduit 
> $WrappedOutputStream.close(HTTPConduit.java:1912)
> 	at  
> org 
> .apache 
> .cxf 
> .io 
> .CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java: 
> 47)
> 	at  
> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java: 
> 179)
> 	at  
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java: 
> 66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java: 
> 611)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor 
> $ 
> MessageSenderEndingInterceptor 
> .handleMessage(MessageSenderInterceptor.java:62)
> 	... 9 more
>
>
>
>
> Here is my applicationContext:
>
> ...
>
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>
> 	<import resource="classpath:META-INF/cxf/cxf-extension-http- 
> jetty.xml" />
>
>
> 	<cxf:bus>
> 		<cxf:inInterceptors>
> 			<ref bean="logInbound" />
> 		</cxf:inInterceptors>
> 		<cxf:outInterceptors>
> 			<ref bean="logOutbound" />
> 		</cxf:outInterceptors>
> 		<cxf:inFaultInterceptors>
> 			<ref bean="logOutbound" />
> 		</cxf:inFaultInterceptors>
> 	</cxf:bus>
>
>
> 	<http:conduit name="*.http-conduit">
> 		<http:client ProxyServer="xxxxx" ProxyServerPort="xxxx" />
>
>
> 	</http:conduit>
>
> 	<bean id="logInbound"  
> class="org.apache.cxf.interceptor.LoggingInInterceptor" />
> 	<bean id="logOutbound"  
> class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
>
> 	<bean id="xxxxx" class="xxxxxxx">
>
> 		<property name="XXXX" ref="XXXX"></property>
>
> 	</bean>
>
> 	<jaxws:client id="XXXX" serviceClass="XXXX"
> 		address="https://xxxxx/xxxx.svc"
> 		wsdlLocation="classpath:META-INF/xxxxxx.wsdl" serviceName="s:xxxxxx"
> 		xmlns:s="http://xxxxxxxxx">
> 		<jaxws:outInterceptors>
> 			<!--
> 				SAAJ Interceptor needs to be explicitly declared only in CXF 2.0.x
> 			-->
> 			<bean  
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
>
> 			<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
> 				<constructor-arg>
> 					<map>
> 						<entry key="action" value="UsernameToken" />
> 						<entry key="user" value="xxxxxxxx" />
> 						<entry key="passwordType" value="PasswordDigest" />
> 						<entry>
> 							<key>
> 								<value>passwordCallbackRef</value>
> 							</key>
> 							<ref bean="passwordCallback" />
> 						</entry>
> 					</map>
> 				</constructor-arg>
> 			</bean>
> 		</jaxws:outInterceptors>
>
> 	</jaxws:client>
>
> 	<bean id="passwordCallback" class="XXX.PasswordCallbackHandler" />
> </beans>
> ...
>
>
> I also tried :
> - CXF 2.2
> - changing the content type to "text/xml; action='http://tempuri.org/IFlexicarService/Test' 
> ; charset=UTF-8"
> - <http:tlsClientParameters secureSocketProtocol="SSL"></ 
> http:tlsClientParameters>
>
>
> Any ideas?
>
> Regards
> J.
>

-- 
Ian Homer | http://blog.bemoko.com







Re: WS-Security with SSL: Http error 415

Posted by Ian Homer <ia...@gmail.com>.
You might be sending a SOAP 1.1 request to a SOAP 1.2 port.  I've seen  
a 415 thrown from WCF for this reason.  415 essentially means an  
unsupported media type - http://www.w3.org/2000/xp/Group/2/03/11/soap-1.2-conformance.html#http-415

Cheers,

Ian

On 7 Apr 2009, at 11:09, Rodriguez, José wrote:

> Hi,
>
> I have a cxf 2.0.10 client and I try to use a service with WS- 
> Security and SSL. The service is based on the Microsoft  
> implementation.
>
> It works just fine with soapUI but using CXF I have the following  
> exception:
>
> 7 avr. 2009 11:33:58 org.apache.cxf.phase.PhaseInterceptorChain  
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor 
> $ 
> MessageSenderEndingInterceptor 
> .handleMessage(MessageSenderInterceptor.java:64)
> 	at  
> org 
> .apache 
> .cxf 
> .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java: 
> 236)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
> 	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)
> 	at $Proxy40.test(Unknown Source)
> 	at  
> ch.generali.test.ServiceFlexiServices.woot(ServiceFlexiServices.java: 
> 10)
> 	at  
> ch.generali.test.ServiceFlexiServices.main(ServiceFlexiServices.java: 
> 26)
> Caused by: java.io.IOException: Server returned HTTP response code:  
> 415 for URL: https://xxxx/xxxxx.svc
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native  
> Method)
> 	at  
> sun 
> .reflect 
> .NativeConstructorAccessorImpl 
> .newInstance(NativeConstructorAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingConstructorAccessorImpl 
> .newInstance(DelegatingConstructorAccessorImpl.java:27)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> 	at sun.net.www.protocol.http.HttpURLConnection 
> $6.run(HttpURLConnection.java:1225)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at  
> sun 
> .net 
> .www 
> .protocol 
> .http.HttpURLConnection.getChainedException(HttpURLConnection.java: 
> 1219)
> 	at  
> sun 
> .net 
> .www 
> .protocol 
> .http.HttpURLConnection.getInputStream(HttpURLConnection.java:906)
> 	at  
> sun 
> .net 
> .www 
> .protocol 
> .https 
> .HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java: 
> 234)
> 	at org.apache.cxf.transport.http.HTTPConduit 
> $WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2097)
> 	at org.apache.cxf.transport.http.HTTPConduit 
> $WrappedOutputStream.handleResponse(HTTPConduit.java:1987)
> 	at org.apache.cxf.transport.http.HTTPConduit 
> $WrappedOutputStream.close(HTTPConduit.java:1912)
> 	at  
> org 
> .apache 
> .cxf 
> .io 
> .CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java: 
> 47)
> 	at  
> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java: 
> 179)
> 	at  
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java: 
> 66)
> 	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java: 
> 611)
> 	at org.apache.cxf.interceptor.MessageSenderInterceptor 
> $ 
> MessageSenderEndingInterceptor 
> .handleMessage(MessageSenderInterceptor.java:62)
> 	... 9 more
>
>
>
>
> Here is my applicationContext:
>
> ...
>
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
>
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>
> 	<import resource="classpath:META-INF/cxf/cxf-extension-http- 
> jetty.xml" />
>
>
> 	<cxf:bus>
> 		<cxf:inInterceptors>
> 			<ref bean="logInbound" />
> 		</cxf:inInterceptors>
> 		<cxf:outInterceptors>
> 			<ref bean="logOutbound" />
> 		</cxf:outInterceptors>
> 		<cxf:inFaultInterceptors>
> 			<ref bean="logOutbound" />
> 		</cxf:inFaultInterceptors>
> 	</cxf:bus>
>
>
> 	<http:conduit name="*.http-conduit">
> 		<http:client ProxyServer="xxxxx" ProxyServerPort="xxxx" />
>
>
> 	</http:conduit>
>
> 	<bean id="logInbound"  
> class="org.apache.cxf.interceptor.LoggingInInterceptor" />
> 	<bean id="logOutbound"  
> class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
>
> 	<bean id="xxxxx" class="xxxxxxx">
>
> 		<property name="XXXX" ref="XXXX"></property>
>
> 	</bean>
>
> 	<jaxws:client id="XXXX" serviceClass="XXXX"
> 		address="https://xxxxx/xxxx.svc"
> 		wsdlLocation="classpath:META-INF/xxxxxx.wsdl" serviceName="s:xxxxxx"
> 		xmlns:s="http://xxxxxxxxx">
> 		<jaxws:outInterceptors>
> 			<!--
> 				SAAJ Interceptor needs to be explicitly declared only in CXF 2.0.x
> 			-->
> 			<bean  
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
>
> 			<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
> 				<constructor-arg>
> 					<map>
> 						<entry key="action" value="UsernameToken" />
> 						<entry key="user" value="xxxxxxxx" />
> 						<entry key="passwordType" value="PasswordDigest" />
> 						<entry>
> 							<key>
> 								<value>passwordCallbackRef</value>
> 							</key>
> 							<ref bean="passwordCallback" />
> 						</entry>
> 					</map>
> 				</constructor-arg>
> 			</bean>
> 		</jaxws:outInterceptors>
>
> 	</jaxws:client>
>
> 	<bean id="passwordCallback" class="XXX.PasswordCallbackHandler" />
> </beans>
> ...
>
>
> I also tried :
> - CXF 2.2
> - changing the content type to "text/xml; action='http://tempuri.org/IFlexicarService/Test' 
> ; charset=UTF-8"
> - <http:tlsClientParameters secureSocketProtocol="SSL"></ 
> http:tlsClientParameters>
>
>
> Any ideas?
>
> Regards
> J.
>

-- 
Ian Homer | http://blog.bemoko.com