You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by danop <da...@hotmail.com> on 2007/03/07 21:45:32 UTC

Re: [axis2] Axis2 Https Client


Saminda,

Thanks for you reply and the link you included.  However, I have spent the
last 2 days reading sslguide.html and trying to apply the information on
that page while still using the client stub classes that the Axis2 Wsdl2Java
tool created.    I cannot seem to find any of the socket logic in the client
stubs, as they are all hidden.

Could you please show an example of how to use the information from the
sslguide and apply it to the auto axis2 generated client stubs?  (Below is a
section of the Axis2 generated client stub)

		try {
 			org.apache.axis2.client.OperationClient _operationClient =
_serviceClient
					.createClient(_operations[6].getName());
			_operationClient.getOptions().setAction(
					"SomeService.Signon");
			_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
					true);
		
			Options opt = _operationClient.getOptions();
			
			// create SOAP envelope with that payload
			org.apache.axiom.soap.SOAPEnvelope env = null;

			// Style is Doc.

			env = toEnvelope(
					getFactory(_operationClient.getOptions()
							.getSoapVersionURI()),
					param12,
					optimizeContent(new javax.xml.namespace.QName("", "Signon")));

			// adding SOAP headers
			_serviceClient.addHeadersToEnvelope(env);
			// create message context with that soap envelope
			org.apache.axis2.context.MessageContext _messageContext = new
org.apache.axis2.context.MessageContext();
			_messageContext.setEnvelope(env);

			// add the message contxt to the operation client
			_operationClient.addMessageContext(_messageContext);

			// execute the operation client
			_operationClient.execute(true);  // <----- It Brakes Here



Many Thanks.



Saminda Abeyruwan-3 wrote:
> 
> Hope these will help
> 
> http://jakarta.apache.org/commons/httpclient/sslguide.html
> 
> Thank you
> 
> Saminda
> 
> On 3/5/07, danop <da...@hotmail.com> wrote:
>>
>>
>> Hello,
>>
>> Am hoping someone can help me with an issue that I have encountered.  I
>> created an axis2 client stub using the WSDL2Java tool against a wsdl from
>> a
>> dot net https url.   However, when I try to run the new axis2 client
>> against
>> the https soap url, I receive an exception indicating that there is no
>> trusted certificate found.
>>
>> sun.security.validator.ValidatorException: No trusted certificate found
>>
>> Since, the https url does not have any issued certificates, I have no
>> idea
>> how to prevent the axis2 client stub excecution from trying to resolve
>> the
>> certificate.  I've spent 4 days reading this forum extensively, trying
>> various things, and yet I am no closer to a completing successful soap
>> call
>> to the https url.
>>
>> Is there any way to disable the axis2 client from trying to find a
>> trusted
>> certificate when making the https soap call?
>>
>>     If so, could someone please show me an example how?
>>
>>     If not, could someone please show me an example of how to get around
>> this exception?
>>
>> Many thanks,
>> danop
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Axis2-Https-Client-tf3350210.html#a9315754
>> Sent from the Axis - Dev mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-dev-help@ws.apache.org
>>
>>
> 
> 
> -- 
> Saminda Abeyruwan
> 
> Software Engineer
> WSO2 Inc. - www.wso2.org
> 
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 

-- 
View this message in context: http://www.nabble.com/Axis2-Https-Client-tf3350210.html#a9361752
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: Axis2 Https Client

Posted by stevewu <st...@primavera.com>.
Hi Saminda,
I am having problem using HTTPS with Axis2 1.3. I follow the steps in your
doc and setup the certificates.
Also I modified Tomcat's(5.5.25) server.xml to use HTTPS transport. Before I
invoked WebService method, I setup system properties as you stated below.
When I invoke WebService method I am getting the following exception:

org.apache.axis2.AxisFault: unknown
	at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
	at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
	at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
	at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
	at
com.primavera.ws.client.AuthenticationServiceStub.login(AuthenticationServiceStub.java:150)
	at
com.primavera.wsclient.AuthenticationServiceXmlbeanClient.testLogin(AuthenticationServiceXmlbeanClient.java:34)
	at
com.primavera.wsclient.AuthenticationServiceXmlbeanClient.main(AuthenticationServiceXmlbeanClient.java:90)

What am I missing?

Thanks
Steve


Saminda Abeyruwan-3 wrote:
> 
> Hi,
> 
> You don't have to dug deep in to stub code to enable ssl. The underline
> transport sender, httpclient provides full support for HTTP over Secure
> Sockets Layer (SSL) or IETF Transport Layer Security (TLS) protocols by
> leveraging the Java Secure Socket Extension
> (JSSE).<http://java.sun.com/products/jsse/index.html>
> 
> ex: Assume your client code has FooStub.
> 
> ========================================
> FooStub fooStub = new FooStub("https://www.cnn.com");
> 
> // Enabel SSL via JSSE
>  System.setProperty("javax.net.ssl.trustStore",
>                         "path to client trust store");
> System.setProperty("javax.net.ssl.trustStorePassword","your password");
> 
> fooStub.invokeWebServiceMethod();
> =========================================
> 
> That's the only thing you have to do. invokeWebServiceMethod() contains
> the
> stub logic, which you mightn't have to worry about.
> 
> But you have to properly setup the client trust store. Attached article
> will
> be help in this aspect.
> 
> Thank you
> 
> Saminda
> 
> 
> 
> On 3/8/07, danop <da...@hotmail.com> wrote:
>>
>>
>>
>> Saminda,
>>
>> Thanks for you reply and the link you included.  However, I have spent
>> the
>> last 2 days reading sslguide.html and trying to apply the information on
>> that page while still using the client stub classes that the Axis2
>> Wsdl2Java
>> tool created.    I cannot seem to find any of the socket logic in the
>> client
>> stubs, as they are all hidden.
>>
>> Could you please show an example of how to use the information from the
>> sslguide and apply it to the auto axis2 generated client stubs?  (Below
>> is
>> a
>> section of the Axis2 generated client stub)
>>
>>                 try {
>>                        
>> org.apache.axis2.client.OperationClient_operationClient =
>> _serviceClient
>>
>>                                        
>> .createClient(_operations[6].getName());
>>                         _operationClient.getOptions().setAction(
>>                                         "SomeService.Signon");
>>
>>                        
>> _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
>>                                         true);
>>
>>                         Options opt = _operationClient.getOptions();
>>
>>                         // create SOAP envelope with that payload
>>                         org.apache.axiom.soap.SOAPEnvelope env = null;
>>
>>                         // Style is Doc.
>>
>>                         env = toEnvelope(
>>
>>                                        
>> getFactory(_operationClient.getOptions()
>>
>>                                                        
>> .getSoapVersionURI()),
>>                                         param12,
>>                                         optimizeContent(new
>> javax.xml.namespace.QName("", "Signon")));
>>
>>                         // adding SOAP headers
>>                         _serviceClient.addHeadersToEnvelope(env);
>>                         // create message context with that soap envelope
>>                        
>> org.apache.axis2.context.MessageContext_messageContext = new
>> org.apache.axis2.context.MessageContext();
>>                         _messageContext.setEnvelope(env);
>>
>>                         // add the message contxt to the operation client
>>
>>                        
>> _operationClient.addMessageContext(_messageContext);
>>
>>                         // execute the operation client
>>                         _operationClient.execute(true);  // <----- It
>> Brakes Here
>>
>>
>>
>> Many Thanks.
>>
>>
>>
>> Saminda Abeyruwan-3 wrote:
>> >
>> > Hope these will help
>> >
>> > http://jakarta.apache.org/commons/httpclient/sslguide.html
>> >
>> > Thank you
>> >
>> > Saminda
>> >
>> > On 3/5/07, danop <da...@hotmail.com> wrote:
>> >>
>> >>
>> >> Hello,
>> >>
>> >> Am hoping someone can help me with an issue that I have encountered. 
>> I
>> >> created an axis2 client stub using the WSDL2Java tool against a wsdl
>> from
>> >> a
>> >> dot net https url.   However, when I try to run the new axis2 client
>> >> against
>> >> the https soap url, I receive an exception indicating that there is no
>> >> trusted certificate found.
>> >>
>> >> sun.security.validator.ValidatorException: No trusted certificate
>> found
>> >>
>> >> Since, the https url does not have any issued certificates, I have no
>> >> idea
>> >> how to prevent the axis2 client stub excecution from trying to resolve
>> >> the
>> >> certificate.  I've spent 4 days reading this forum extensively, trying
>> >> various things, and yet I am no closer to a completing successful soap
>> >> call
>> >> to the https url.
>> >>
>> >> Is there any way to disable the axis2 client from trying to find a
>> >> trusted
>> >> certificate when making the https soap call?
>> >>
>> >>     If so, could someone please show me an example how?
>> >>
>> >>     If not, could someone please show me an example of how to get
>> around
>> >> this exception?
>> >>
>> >> Many thanks,
>> >> danop
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Axis2-Https-Client-tf3350210.html#a9315754
>> >> Sent from the Axis - Dev mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-dev-help@ws.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Saminda Abeyruwan
>> >
>> > Software Engineer
>> > WSO2 Inc. - www.wso2.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>> > For additional commands, e-mail: axis-dev-help@ws.apache.org
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Axis2-Https-Client-tf3350210.html#a9361752
>> Sent from the Axis - Dev mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-dev-help@ws.apache.org
>>
>>
> 
> 
> -- 
> Saminda Abeyruwan
> 
> Software Engineer
> WSO2 Inc. - www.wso2.org
> 
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 

-- 
View this message in context: http://www.nabble.com/Axis2-Https-Client-tf3350210.html#a13976704
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [axis2] Axis2 Https Client

Posted by Saminda Abeyruwan <sa...@gmail.com>.
Hi,

You don't have to dug deep in to stub code to enable ssl. The underline
transport sender, httpclient provides full support for HTTP over Secure
Sockets Layer (SSL) or IETF Transport Layer Security (TLS) protocols by
leveraging the Java Secure Socket Extension
(JSSE).<http://java.sun.com/products/jsse/index.html>

ex: Assume your client code has FooStub.

========================================
FooStub fooStub = new FooStub("https://www.cnn.com");

// Enabel SSL via JSSE
 System.setProperty("javax.net.ssl.trustStore",
                        "path to client trust store");
System.setProperty("javax.net.ssl.trustStorePassword","your password");

fooStub.invokeWebServiceMethod();
=========================================

That's the only thing you have to do. invokeWebServiceMethod() contains the
stub logic, which you mightn't have to worry about.

But you have to properly setup the client trust store. Attached article will
be help in this aspect.

Thank you

Saminda



On 3/8/07, danop <da...@hotmail.com> wrote:
>
>
>
> Saminda,
>
> Thanks for you reply and the link you included.  However, I have spent the
> last 2 days reading sslguide.html and trying to apply the information on
> that page while still using the client stub classes that the Axis2
> Wsdl2Java
> tool created.    I cannot seem to find any of the socket logic in the
> client
> stubs, as they are all hidden.
>
> Could you please show an example of how to use the information from the
> sslguide and apply it to the auto axis2 generated client stubs?  (Below is
> a
> section of the Axis2 generated client stub)
>
>                 try {
>                         org.apache.axis2.client.OperationClient_operationClient =
> _serviceClient
>
>                                         .createClient(_operations[6].getName());
>                         _operationClient.getOptions().setAction(
>                                         "SomeService.Signon");
>
>                         _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
>                                         true);
>
>                         Options opt = _operationClient.getOptions();
>
>                         // create SOAP envelope with that payload
>                         org.apache.axiom.soap.SOAPEnvelope env = null;
>
>                         // Style is Doc.
>
>                         env = toEnvelope(
>
>                                         getFactory(_operationClient.getOptions()
>
>                                                         .getSoapVersionURI()),
>                                         param12,
>                                         optimizeContent(new
> javax.xml.namespace.QName("", "Signon")));
>
>                         // adding SOAP headers
>                         _serviceClient.addHeadersToEnvelope(env);
>                         // create message context with that soap envelope
>                         org.apache.axis2.context.MessageContext_messageContext = new
> org.apache.axis2.context.MessageContext();
>                         _messageContext.setEnvelope(env);
>
>                         // add the message contxt to the operation client
>
>                         _operationClient.addMessageContext(_messageContext);
>
>                         // execute the operation client
>                         _operationClient.execute(true);  // <----- It
> Brakes Here
>
>
>
> Many Thanks.
>
>
>
> Saminda Abeyruwan-3 wrote:
> >
> > Hope these will help
> >
> > http://jakarta.apache.org/commons/httpclient/sslguide.html
> >
> > Thank you
> >
> > Saminda
> >
> > On 3/5/07, danop <da...@hotmail.com> wrote:
> >>
> >>
> >> Hello,
> >>
> >> Am hoping someone can help me with an issue that I have encountered.  I
> >> created an axis2 client stub using the WSDL2Java tool against a wsdl
> from
> >> a
> >> dot net https url.   However, when I try to run the new axis2 client
> >> against
> >> the https soap url, I receive an exception indicating that there is no
> >> trusted certificate found.
> >>
> >> sun.security.validator.ValidatorException: No trusted certificate found
> >>
> >> Since, the https url does not have any issued certificates, I have no
> >> idea
> >> how to prevent the axis2 client stub excecution from trying to resolve
> >> the
> >> certificate.  I've spent 4 days reading this forum extensively, trying
> >> various things, and yet I am no closer to a completing successful soap
> >> call
> >> to the https url.
> >>
> >> Is there any way to disable the axis2 client from trying to find a
> >> trusted
> >> certificate when making the https soap call?
> >>
> >>     If so, could someone please show me an example how?
> >>
> >>     If not, could someone please show me an example of how to get
> around
> >> this exception?
> >>
> >> Many thanks,
> >> danop
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Axis2-Https-Client-tf3350210.html#a9315754
> >> Sent from the Axis - Dev mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-dev-help@ws.apache.org
> >>
> >>
> >
> >
> > --
> > Saminda Abeyruwan
> >
> > Software Engineer
> > WSO2 Inc. - www.wso2.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-dev-help@ws.apache.org
> >
>
> --
> View this message in context:
> http://www.nabble.com/Axis2-Https-Client-tf3350210.html#a9361752
> Sent from the Axis - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
Saminda Abeyruwan

Software Engineer
WSO2 Inc. - www.wso2.org