hot to add Basic Authentication to my service
Hey there, I'd like to deploy a service and require clients to use basic authentication. I found an email [1] from Paul saying that axis2 does not have native support for it, that ws-security is the way to go. But in my case it would be overkilled. His answer is dated from 2006 so I'd like to know if it is still not possible ? Thanks in advance for your answers, good luck to axis2 dev team for the impending release. Alexis [1] http://markmail.org/thread/w2anpwbxbum4x3fb
Axis2 Wsdl2Java basic authentication
How do you specify username and password via command line wsdl2java (called from soapUI gui or directly) when trying to generate code for a WSDL accessible through basic validation? The Axis 1.x wsdl2java had -U and -P commandline params but these do not seem to exist with 2.x. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: wsdl2java and basic authentication
Report has been created: https://issues.apache.org/jira/browse/AXIS2-4060 From: keith chapman [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 9:25 PM To: axis-user@ws.apache.org Subject: Re: wsdl2java and basic authentication Could you please file a JIRA please so that we will be able to fix this for the next release. Thanks, Keith. On Tue, Sep 30, 2008 at 8:51 PM, Jorge Medina <[EMAIL PROTECTED]> wrote: I got it. There is a bug in version 1.4 The same line works fine in version 1.3 From: Jorge Medina [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:15 AM To: axis-user@ws.apache.org Subject: RE: wsdl2java and basic authentication No, I have the two computers in the same network, no firewall between them. The error wouldn't be 401 if the issue was a firewall, right? Nevertheless, I will repeat my test directly at the server. -Jorge From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:09 AM To: Jorge Medina Subject: RE: wsdl2java and basic authentication appears you're behind a proxy server so you'll either need to specify WSDL2Java proxy settings e.g. --http-proxy-hostProxy host address if you are behind a firewall --http-proxy-portProxy prot address if you are behind a firewall or d/l the wsdl to an accessible file or webserver and use that Saludos Cordiales desde Mass Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Subject: wsdl2java and basic authentication Date: Tue, 30 Sep 2008 10:57:40 -0400 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Hi, I have a Tomcat server (6.0.16) using basic authentication through a JDBC connection to a database. The server runs in port 8080. I am trying to run wsdl2java against this server, > wsdl2java -uri http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl -s <http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl-s > -uw -u but I get HTTP error 401: Retrieving document at 'http://ssmith:[EMAIL PROTECTED]:8080/company -webservices/mywsdl.wsdl'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:156) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unabl e to resolve imported document at 'http://ssmith:[EMAIL PROTECTED]:8 080/webservices/mywsdl.wsdl'.: java.io.IOException: Server retu rned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED] m:8080/webservices/mywsdl.wsdl at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:111) ... 2 more Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED]:8080/webservices/mailingCru dWsdl.wsdl at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1241) at java.net.URL.openStream(URL.java:1009) at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 6 more The same URL works perfectly fine in a browser. Is there any other way to specify the user and password required to get the WSDL when running wsdl2java? -Jorge Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie. Learn Now <http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-c ns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008> -- Keith Chapman Senior Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org
Re: wsdl2java and basic authentication
Could you please file a JIRA please so that we will be able to fix this for the next release. Thanks, Keith. On Tue, Sep 30, 2008 at 8:51 PM, Jorge Medina <[EMAIL PROTECTED]> wrote: > I got it. There is a bug in version 1.4 > > > > The same line works fine in version 1.3 > > > > > -- > > *From:* Jorge Medina [mailto:[EMAIL PROTECTED] > *Sent:* Tuesday, September 30, 2008 11:15 AM > *To:* axis-user@ws.apache.org > *Subject:* RE: wsdl2java and basic authentication > > > > No, I have the two computers in the same network, no firewall between them. > > > The error wouldn't be 401 if the issue was a firewall, right? > > > > Nevertheless, I will repeat my test directly at the server. > > > > > > -Jorge > > > -- > > *From:* Martin Gainty [mailto:[EMAIL PROTECTED] > *Sent:* Tuesday, September 30, 2008 11:09 AM > *To:* Jorge Medina > *Subject:* RE: wsdl2java and basic authentication > > > > appears you're behind a proxy server so > you'll either need to specify WSDL2Java proxy settings e.g. > --http-proxy-hostProxy host address if you are behind a firewall > --http-proxy-portProxy prot address if you are behind a firewall > > or d/l the wsdl to an accessible file or webserver and use that > > Saludos Cordiales desde Mass > Martin > __ > Disclaimer and confidentiality note > Everything in this e-mail and any attachments relates to the official > business of Sender. This transmission is of a confidential nature and Sender > does not endorse distribution to any party other than intended recipient. > Sender does not necessarily endorse content contained within this > transmission. > -- > > Subject: wsdl2java and basic authentication > Date: Tue, 30 Sep 2008 10:57:40 -0400 > From: [EMAIL PROTECTED] > To: axis-user@ws.apache.org > > Hi, > > I have a Tomcat server (6.0.16) using basic authentication through a JDBC > connection to a database. > > The server runs in port 8080. > > > >I am trying to run wsdl2java against this server, > > > >> wsdl2java –uri http://ssmith:[EMAIL > PROTECTED]:8080/webservices/mywsdl.wsdl > -s<http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl-s>-uw -u > > > > but I get HTTP error 401: > > > > Retrieving document at ' > http://ssmith:[EMAIL PROTECTED]:8080/company > > -webservices/mywsdl.wsdl'. > > Exception in thread "main" > org.apache.axis2.wsdl.codegen.CodeGenerationException > > : Error parsing WSDL > > at > org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat > > ionEngine.java:156) > > at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) > > at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) > > Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: > Unabl > > e to resolve imported document at ' > http://ssmith:[EMAIL PROTECTED]:8 > > 080/webservices/mywsdl.wsdl'.: java.io.IOException: Server retu > > rned HTTP response code: 401 for URL: > http://ssmith:[EMAIL PROTECTED] > > m:8080/webservices/mywsdl.wsdl > > at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) > > at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) > > at > org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( > > CodeGenerationEngine.java:288) > > at > org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat > > ionEngine.java:111) > > ... 2 more > > Caused by: java.io.IOException: Server returned HTTP response code: 401 for > URL: > > http://ssmith:[EMAIL PROTECTED]:8080/webservices/mailingCru > > dWsdl.wsdl > > at > sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon > > nection.java:1241) > > at java.net.URL.openStream(URL.java:1009) > > at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown > Source) > > > > ... 6 more > > > > > > The same URL works perfectly fine in a browser. > > Is there any other way to specify the user and password required to get the > WSDL when running wsdl2java? > > > > -Jorge > > > > > > > -- > > Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie. Learn > Now<http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008> > -- Keith Chapman Senior Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org
RE: wsdl2java and basic authentication
Actually, I only tested with version 1.4.1 and version 1.3 Version 1.3 works fine From: Jorge Medina [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:22 AM To: axis-user@ws.apache.org Subject: RE: wsdl2java and basic authentication I got it. There is a bug in version 1.4 The same line works fine in version 1.3 From: Jorge Medina [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:15 AM To: axis-user@ws.apache.org Subject: RE: wsdl2java and basic authentication No, I have the two computers in the same network, no firewall between them. The error wouldn't be 401 if the issue was a firewall, right? Nevertheless, I will repeat my test directly at the server. -Jorge From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:09 AM To: Jorge Medina Subject: RE: wsdl2java and basic authentication appears you're behind a proxy server so you'll either need to specify WSDL2Java proxy settings e.g. --http-proxy-hostProxy host address if you are behind a firewall --http-proxy-portProxy prot address if you are behind a firewall or d/l the wsdl to an accessible file or webserver and use that Saludos Cordiales desde Mass Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Subject: wsdl2java and basic authentication Date: Tue, 30 Sep 2008 10:57:40 -0400 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Hi, I have a Tomcat server (6.0.16) using basic authentication through a JDBC connection to a database. The server runs in port 8080. I am trying to run wsdl2java against this server, > wsdl2java -uri http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl -s -uw -u but I get HTTP error 401: Retrieving document at 'http://ssmith:[EMAIL PROTECTED]:8080/company -webservices/mywsdl.wsdl'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:156) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unabl e to resolve imported document at 'http://ssmith:[EMAIL PROTECTED]:8 080/webservices/mywsdl.wsdl'.: java.io.IOException: Server retu rned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED] m:8080/webservices/mywsdl.wsdl at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:111) ... 2 more Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED]:8080/webservices/mailingCru dWsdl.wsdl at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1241) at java.net.URL.openStream(URL.java:1009) at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 6 more The same URL works perfectly fine in a browser. Is there any other way to specify the user and password required to get the WSDL when running wsdl2java? -Jorge Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie. Learn Now <http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-c ns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008>
RE: wsdl2java and basic authentication
it seems you have found a malicious bug..please let us know how to remove thanks Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Subject: RE: wsdl2java and basic authentication Date: Tue, 30 Sep 2008 11:21:31 -0400 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org I got it. There is a bug in version 1.4 The same line works fine in version 1.3 From: Jorge Medina [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:15 AM To: axis-user@ws.apache.org Subject: RE: wsdl2java and basic authentication No, I have the two computers in the same network, no firewall between them. The error wouldn’t be 401 if the issue was a firewall, right? Nevertheless, I will repeat my test directly at the server. -Jorge From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:09 AM To: Jorge Medina Subject: RE: wsdl2java and basic authentication appears you're behind a proxy server so you'll either need to specify WSDL2Java proxy settings e.g. --http-proxy-hostProxy host address if you are behind a firewall --http-proxy-portProxy prot address if you are behind a firewall or d/l the wsdl to an accessible file or webserver and use that Saludos Cordiales desde Mass Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Subject: wsdl2java and basic authentication Date: Tue, 30 Sep 2008 10:57:40 -0400 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Hi, I have a Tomcat server (6.0.16) using basic authentication through a JDBC connection to a database. The server runs in port 8080. I am trying to run wsdl2java against this server, > wsdl2java –uri http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl -s -uw -u but I get HTTP error 401: Retrieving document at 'http://ssmith:[EMAIL PROTECTED]:8080/company -webservices/mywsdl.wsdl'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:156) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unabl e to resolve imported document at 'http://ssmith:[EMAIL PROTECTED]:8 080/webservices/mywsdl.wsdl'.: java.io.IOException: Server retu rned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED] m:8080/webservices/mywsdl.wsdl at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:111) ... 2 more Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED]:8080/webservices/mailingCru dWsdl.wsdl at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1241) at java.net.URL.openStream(URL.java:1009) at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 6 more The same URL works perfectly fine in a browser. Is there any other way to specify the user and password required to get the WSDL when running wsdl2java? -Jorge Want to do more with Windows Live? Learn “10 hidden secrets” from Jamie. Learn Now _ Stay up to date on your PC, the Web, and your mobile phone with Windows Live. http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/
RE: wsdl2java and basic authentication
I got it. There is a bug in version 1.4 The same line works fine in version 1.3 From: Jorge Medina [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:15 AM To: axis-user@ws.apache.org Subject: RE: wsdl2java and basic authentication No, I have the two computers in the same network, no firewall between them. The error wouldn't be 401 if the issue was a firewall, right? Nevertheless, I will repeat my test directly at the server. -Jorge From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:09 AM To: Jorge Medina Subject: RE: wsdl2java and basic authentication appears you're behind a proxy server so you'll either need to specify WSDL2Java proxy settings e.g. --http-proxy-hostProxy host address if you are behind a firewall --http-proxy-portProxy prot address if you are behind a firewall or d/l the wsdl to an accessible file or webserver and use that Saludos Cordiales desde Mass Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Subject: wsdl2java and basic authentication Date: Tue, 30 Sep 2008 10:57:40 -0400 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Hi, I have a Tomcat server (6.0.16) using basic authentication through a JDBC connection to a database. The server runs in port 8080. I am trying to run wsdl2java against this server, > wsdl2java -uri http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl -s -uw -u but I get HTTP error 401: Retrieving document at 'http://ssmith:[EMAIL PROTECTED]:8080/company -webservices/mywsdl.wsdl'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:156) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unabl e to resolve imported document at 'http://ssmith:[EMAIL PROTECTED]:8 080/webservices/mywsdl.wsdl'.: java.io.IOException: Server retu rned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED] m:8080/webservices/mywsdl.wsdl at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:111) ... 2 more Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED]:8080/webservices/mailingCru dWsdl.wsdl at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1241) at java.net.URL.openStream(URL.java:1009) at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 6 more The same URL works perfectly fine in a browser. Is there any other way to specify the user and password required to get the WSDL when running wsdl2java? -Jorge Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie. Learn Now <http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-c ns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008>
RE: wsdl2java and basic authentication
No, I have the two computers in the same network, no firewall between them. The error wouldn't be 401 if the issue was a firewall, right? Nevertheless, I will repeat my test directly at the server. -Jorge From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 11:09 AM To: Jorge Medina Subject: RE: wsdl2java and basic authentication appears you're behind a proxy server so you'll either need to specify WSDL2Java proxy settings e.g. --http-proxy-hostProxy host address if you are behind a firewall --http-proxy-portProxy prot address if you are behind a firewall or d/l the wsdl to an accessible file or webserver and use that Saludos Cordiales desde Mass Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Subject: wsdl2java and basic authentication Date: Tue, 30 Sep 2008 10:57:40 -0400 From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Hi, I have a Tomcat server (6.0.16) using basic authentication through a JDBC connection to a database. The server runs in port 8080. I am trying to run wsdl2java against this server, > wsdl2java -uri http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl -s -uw -u but I get HTTP error 401: Retrieving document at 'http://ssmith:[EMAIL PROTECTED]:8080/company -webservices/mywsdl.wsdl'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:156) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unabl e to resolve imported document at 'http://ssmith:[EMAIL PROTECTED]:8 080/webservices/mywsdl.wsdl'.: java.io.IOException: Server retu rned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED] m:8080/webservices/mywsdl.wsdl at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:111) ... 2 more Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED]:8080/webservices/mailingCru dWsdl.wsdl at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1241) at java.net.URL.openStream(URL.java:1009) at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 6 more The same URL works perfectly fine in a browser. Is there any other way to specify the user and password required to get the WSDL when running wsdl2java? -Jorge Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie. Learn Now <http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-c ns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008>
wsdl2java and basic authentication
Hi, I have a Tomcat server (6.0.16) using basic authentication through a JDBC connection to a database. The server runs in port 8080. I am trying to run wsdl2java against this server, > wsdl2java -uri http://ssmith:[EMAIL PROTECTED]:8080/webservices/mywsdl.wsdl -s -uw -u but I get HTTP error 401: Retrieving document at 'http://ssmith:[EMAIL PROTECTED]:8080/company -webservices/mywsdl.wsdl'. Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException : Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:156) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unabl e to resolve imported document at 'http://ssmith:[EMAIL PROTECTED]:8 080/webservices/mywsdl.wsdl'.: java.io.IOException: Server retu rned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED] m:8080/webservices/mywsdl.wsdl at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( CodeGenerationEngine.java:288) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerat ionEngine.java:111) ... 2 more Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://ssmith:[EMAIL PROTECTED]:8080/webservices/mailingCru dWsdl.wsdl at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1241) at java.net.URL.openStream(URL.java:1009) at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source) ... 6 more The same URL works perfectly fine in a browser. Is there any other way to specify the user and password required to get the WSDL when running wsdl2java? -Jorge
Re: Axis2 SOAP-client and HTTPS-based server using basic authentication
Thanks! You're absolutely right. It seems the following line is redundant: options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, https); - Kenneth keith chapman wrote: > > Noticed that you had > > auth.setPassword(userName); > auth.setUsername(password); > > in your code. A mistake probably that caused the issue? > > Thanks, > Keith. > > On Thu, Jul 3, 2008 at 8:07 PM, Odd Kenneth Oden > <[EMAIL PROTECTED]> > wrote: > >> >> Hello, >> >> I have been unable to successfully execute my WSDL-generated Axis2 1.4 >> client against a web service that uses HTTPS and basic authentication. >> >> After some extensive search on the Internet, I found some suggestions >> which >> I have tried to implement. I've managed to successfully do a HTTP get >> against the service's WSDL-file using plain HTTPClient, but when I try to >> implement what should basically be the same parameters on the service >> stub, >> I receive a "Transport error: 401 Error: Unauthorized" error message. >> >> I've included the source code for the successful HTTPClient code and the >> not-so-successfull service stub: >> >>ProtocolSocketFactory protocolSocketFactory = new >> EasySSLProtocolSocketFactory(); >>//ProtocolSocketFactory protocolSocketFactory = new >> SSLProtocolSocketFactory(); >>Protocol https = new Protocol("https", protocolSocketFactory, >> 443); >> >>HttpState state = new HttpState(); >>state.setCredentials(new AuthScope(host, 443), new >> UsernamePasswordCredentials(userName, password)); >> >>HttpClient httpclient = new HttpClient(); >>httpclient.setState(state); >> >>httpclient.getHostConfiguration().setHost(host, 443, https); >>GetMethod httpget = new GetMethod(wsdlPath); >>try { >> httpclient.executeMethod(httpget); >> System.out.println(httpget.getStatusLine()); >>} finally { >> httpget.releaseConnection(); >>} >> >>HttpTransportProperties.Authenticator auth = new >> HttpTransportProperties.Authenticator(); >>auth.setPassword(userName); >>auth.setUsername(password); >>auth.setHost(host); >>auth.setPort(443); >> >>SmsServiceStub service = new SmsServiceStub(endPoint); >>Options options = service._getServiceClient().getOptions(); >>options.setProperty(HTTPConstants.AUTHENTICATE, auth); >> options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, >> https); >>options.setTimeOutInMilliSeconds(60 * 1000); //1 minute >> >>SmsServiceStub.SubmitRsp resp = service.Submit(req); >> >> And the log: >> >> Running com.telenor.nwnsms.SmsServiceTest >> 03.jul.2008 16:11:29 >> org.apache.commons.httpclient.auth.AuthChallengeProcessor >> selectAuthScheme >> INFO: basic authentication scheme selected >> HTTP/1.1 200 OK >> 03.jul.2008 16:11:30 org.apache.axis2.deployment.ModuleDeployer deploy >> INFO: Deploying module: addressing-1.4 >> 03.jul.2008 16:11:31 >> org.apache.commons.httpclient.auth.AuthChallengeProcessor >> selectAuthScheme >> INFO: basic authentication scheme selected >> 03.jul.2008 16:11:31 org.apache.commons.httpclient.HttpMethodDirector >> processWWWAuthChallenge >> INFO: Failure authenticating with BASIC ''@:443 >> 03.jul.2008 16:11:31 org.apache.axis2.transport.http.HTTPSender >> sendViaPost >> INFO: Unable to sendViaPost to url[https://] >> org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized >>at >> >> org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:298) >>at >> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:192) >>at >> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77) >>at >> >> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327) >>at >> >> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206) >>at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396) >>at >> >> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374) >>at >> >
Re: Axis2 SOAP-client and HTTPS-based server using basic authentication
Noticed that you had auth.setPassword(userName); auth.setUsername(password); in your code. A mistake probably that caused the issue? Thanks, Keith. On Thu, Jul 3, 2008 at 8:07 PM, Odd Kenneth Oden <[EMAIL PROTECTED]> wrote: > > Hello, > > I have been unable to successfully execute my WSDL-generated Axis2 1.4 > client against a web service that uses HTTPS and basic authentication. > > After some extensive search on the Internet, I found some suggestions which > I have tried to implement. I've managed to successfully do a HTTP get > against the service's WSDL-file using plain HTTPClient, but when I try to > implement what should basically be the same parameters on the service stub, > I receive a "Transport error: 401 Error: Unauthorized" error message. > > I've included the source code for the successful HTTPClient code and the > not-so-successfull service stub: > >ProtocolSocketFactory protocolSocketFactory = new > EasySSLProtocolSocketFactory(); >//ProtocolSocketFactory protocolSocketFactory = new > SSLProtocolSocketFactory(); >Protocol https = new Protocol("https", protocolSocketFactory, > 443); > >HttpState state = new HttpState(); >state.setCredentials(new AuthScope(host, 443), new > UsernamePasswordCredentials(userName, password)); > >HttpClient httpclient = new HttpClient(); >httpclient.setState(state); > >httpclient.getHostConfiguration().setHost(host, 443, https); >GetMethod httpget = new GetMethod(wsdlPath); >try { > httpclient.executeMethod(httpget); > System.out.println(httpget.getStatusLine()); >} finally { > httpget.releaseConnection(); >} > >HttpTransportProperties.Authenticator auth = new > HttpTransportProperties.Authenticator(); >auth.setPassword(userName); >auth.setUsername(password); >auth.setHost(host); >auth.setPort(443); > >SmsServiceStub service = new SmsServiceStub(endPoint); >Options options = service._getServiceClient().getOptions(); >options.setProperty(HTTPConstants.AUTHENTICATE, auth); >options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, > https); >options.setTimeOutInMilliSeconds(60 * 1000); //1 minute > >SmsServiceStub.SubmitRsp resp = service.Submit(req); > > And the log: > > Running com.telenor.nwnsms.SmsServiceTest > 03.jul.2008 16:11:29 > org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme > INFO: basic authentication scheme selected > HTTP/1.1 200 OK > 03.jul.2008 16:11:30 org.apache.axis2.deployment.ModuleDeployer deploy > INFO: Deploying module: addressing-1.4 > 03.jul.2008 16:11:31 > org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme > INFO: basic authentication scheme selected > 03.jul.2008 16:11:31 org.apache.commons.httpclient.HttpMethodDirector > processWWWAuthChallenge > INFO: Failure authenticating with BASIC ''@:443 > 03.jul.2008 16:11:31 org.apache.axis2.transport.http.HTTPSender sendViaPost > INFO: Unable to sendViaPost to url[https://] > org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized >at > > org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:298) >at > org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:192) >at > org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77) >at > > org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327) >at > > org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206) >at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396) >at > > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374) >at > > org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) >at > org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) >at > com.telenor.mr2.channel.nwn.SmsServiceStub.Submit(SmsServiceStub.java:207) >at com.telenor.nwnsms.SmsServiceTest.testApp(SmsServiceTest.java:95) >at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >
Axis2 SOAP-client and HTTPS-based server using basic authentication
Hello, I have been unable to successfully execute my WSDL-generated Axis2 1.4 client against a web service that uses HTTPS and basic authentication. After some extensive search on the Internet, I found some suggestions which I have tried to implement. I've managed to successfully do a HTTP get against the service's WSDL-file using plain HTTPClient, but when I try to implement what should basically be the same parameters on the service stub, I receive a "Transport error: 401 Error: Unauthorized" error message. I've included the source code for the successful HTTPClient code and the not-so-successfull service stub: ProtocolSocketFactory protocolSocketFactory = new EasySSLProtocolSocketFactory(); //ProtocolSocketFactory protocolSocketFactory = new SSLProtocolSocketFactory(); Protocol https = new Protocol("https", protocolSocketFactory, 443); HttpState state = new HttpState(); state.setCredentials(new AuthScope(host, 443), new UsernamePasswordCredentials(userName, password)); HttpClient httpclient = new HttpClient(); httpclient.setState(state); httpclient.getHostConfiguration().setHost(host, 443, https); GetMethod httpget = new GetMethod(wsdlPath); try { httpclient.executeMethod(httpget); System.out.println(httpget.getStatusLine()); } finally { httpget.releaseConnection(); } HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator(); auth.setPassword(userName); auth.setUsername(password); auth.setHost(host); auth.setPort(443); SmsServiceStub service = new SmsServiceStub(endPoint); Options options = service._getServiceClient().getOptions(); options.setProperty(HTTPConstants.AUTHENTICATE, auth); options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, https); options.setTimeOutInMilliSeconds(60 * 1000); //1 minute SmsServiceStub.SubmitRsp resp = service.Submit(req); And the log: Running com.telenor.nwnsms.SmsServiceTest 03.jul.2008 16:11:29 org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme INFO: basic authentication scheme selected HTTP/1.1 200 OK 03.jul.2008 16:11:30 org.apache.axis2.deployment.ModuleDeployer deploy INFO: Deploying module: addressing-1.4 03.jul.2008 16:11:31 org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme INFO: basic authentication scheme selected 03.jul.2008 16:11:31 org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge INFO: Failure authenticating with BASIC ''@:443 03.jul.2008 16:11:31 org.apache.axis2.transport.http.HTTPSender sendViaPost INFO: Unable to sendViaPost to url[https://] org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:298) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:192) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at com.telenor.mr2.channel.nwn.SmsServiceStub.Submit(SmsServiceStub.java:207) at com.telenor.nwnsms.SmsServiceTest.testApp(SmsServiceTest.java:95) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke
Axis 1.4 - Force Basic Authentication & Prevent Two Requests
Dear All, I have tried various means to force Axis to send a basic auth header with its first request, is this possible? I know what the service I am connecting to requires the authentication header, and using the CommonsHTTPSender I can see the same request being sent twice first without, then with basic auth after recieving a 401 response from the service. I have no idea why this behaviour would be desirable, if I am explicitly setting a username & password on my call object I would expect it to be used. Any pointers appreciated. Cheers Jon Freedman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using rampart policy for basic authentication
Hi Jason, > Is it possible to implement the rampart sample/basic/sample02 with > policy? Even though this is not recommended ( sending the UT in plain text over HTTP), this is possible with Rampart. Policy for your scenario is http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"; xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";> http://ws.apache.org/rampart/policy";> username PWCallback > If it is possible, how can I find out in my business method who the > authenticated user is? For example, the Servlet API has a method > HttpServletRequest.getRemoteUser(). Is such a similar API in rampart? This tutorial describes how you can do this [1]. thanks, /nandana [1] - http://wso2.org/library/169 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using rampart policy for basic authentication
Hi, Martin The BasicPolicy is not what I am looking for. In your example, the AlgorithmSuite is Basic128Rsa15. It is inside a SymmetricBinding. Symmetric binding implies that the message is encrypted using a symmetric algorithm. I just want username and password passed to server in Soap header as is defined in Web Services Security UsernameToken Profile 1.0. The message is clear http message. thanks -jason Martin Gainty wrote: you can define a BasicPolicy in your services.xml an example is: "http://schemas.xmlsoap.org/ws/2004/09/policy"> "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> Is this what you're looking for? Martin- - Original Message - From: "jason zhang" <[EMAIL PROTECTED]> To: Sent: Saturday, March 29, 2008 6:07 AM Subject: Using rampart policy for basic authentication Hi, All Is it possible to implement the rampart sample/basic/sample02 with policy? What I want to do just basic username/password authentication with policy. All the examples in policy directory involve encryption or signature. If it is possible, how can I find out in my business method who the authenticated user is? For example, the Servlet API has a method HttpServletRequest.getRemoteUser(). Is such a similar API in rampart? Thanks -jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using rampart policy for basic authentication
you can define a BasicPolicy in your services.xml an example is: http://schemas.xmlsoap.org/ws/2004/09/policy";> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";> Is this what you're looking for? Martin- - Original Message - From: "jason zhang" <[EMAIL PROTECTED]> To: Sent: Saturday, March 29, 2008 6:07 AM Subject: Using rampart policy for basic authentication > Hi, All > Is it possible to implement the rampart sample/basic/sample02 with > policy? What I want to do just basic username/password authentication > with policy. All the examples in policy directory involve encryption or > signature. > > If it is possible, how can I find out in my business method who the > authenticated user is? For example, the Servlet API has a method > HttpServletRequest.getRemoteUser(). Is such a similar API in rampart? > > Thanks > > -jason > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using rampart policy for basic authentication
Hi, All Is it possible to implement the rampart sample/basic/sample02 with policy? What I want to do just basic username/password authentication with policy. All the examples in policy directory involve encryption or signature. If it is possible, how can I find out in my business method who the authenticated user is? For example, the Servlet API has a method HttpServletRequest.getRemoteUser(). Is such a similar API in rampart? Thanks -jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wsdl2java with Basic Authentication
Thanks Upul ! it worked to me !! thanks again !!! Quino On 10/5/07, Upul Godage <[EMAIL PROTECTED]> wrote: > > Hi Quino, > > You can try giving username and password in the url. > > ./wsdljava.sh -uri http://username:[EMAIL PROTECTED]:port/path/service?WSDL > > > Upul > > > > On 10/5/07, Leo Stevens <[EMAIL PROTECTED]> wrote: > > > > Thanks Upul > > but my problem is that I can´t generate the clases because the wsdl2java > > throws an exception because the server need user and password and I can´t > > give it. when wsdl2java.class invoke the server. > > > > Thanks again. > > Quino. > > > > > > > > On 10/1/07, Upul Godage < [EMAIL PROTECTED]> wrote: > > > > > > After you generate the classes, you can do something like this when > > > using the stub. > > > > > > HttpTransportProperties.Authenticator authenticator = new > > > HttpTransportProperties.Authenticator(); > > > authenticator.setPreemptiveAuthentication (true); > > > authenticator.setAuthSchemes(Arrays.asList(new String[]{ > > > HttpTransportProperties.Authenticator.BASIC})); > > > authenticator.setUsername(username); > > > authenticator.setPassword(password); > > > stub._getServiceClient().getOptions().setProperty( > > > HTTPConstants.AUTHENTICATE,authenticator); > > > > > > Upul > > > > > > > > > On 10/2/07, Leo Stevens <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi ! > > > > I have to invok a ws with Basic Authentication (user and pass), but > > > > first I need to create the java classes so I need run > > > > WSDL2JAVA.class with user and pass, so my question: Is it posible > > > > to set a java env param with username and password. > > > > > > > > Thanks . > > > > Quino. > > > > > > > > > > > > >
转发: "Unable to determine binding from message element",when invoke webservice under basic authentication
主题: "Unable to determine binding from message element",when invoke webservice under basic authentication Hi, The web service client was built with RPCServiceClient -- serviceClient = new RPCServiceClient(); EndpointReference targetEPR = new EndpointReference(service_address); serviceClient.getOptions().setTo(targetEPR); -- I had set the authentication info as follows: -- HttpTransportProperties.Authenticator basicAuthentication = new HttpTransportProperties.Authenticator(); basicAuthentication.setUsername(username); basicAuthentication.setPassword(password); basicAuthentication.setPreemptiveAuthentication(true); serviceClient.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuthentication); -- Invoke like below: Object[] results = serviceClient.invokeBlocking( qName, args, new Class[] { returnType }); -- When invoke , the following appears: Caused by: org.apache.axis2.AxisFault: Unable to determine binding from message element: getCustInfoByName 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 org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508) at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:101) -- If I fill the username or the password wrong , it will return 401 not authorized. The same web service , I invoke it with XFire framework , it is fine. But with Axis2 ... I can't find any related content on the web. Pls help me with that. thanks. Looking forward your replay. Thanks & Best Regards Li Wei - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wsdl2java with Basic Authentication
Hi Quino, You can try giving username and password in the url. ./wsdljava.sh -uri http://username:[EMAIL PROTECTED]:port/path/service?WSDL Upul On 10/5/07, Leo Stevens <[EMAIL PROTECTED]> wrote: > > Thanks Upul > but my problem is that I can´t generate the clases because the wsdl2java > throws an exception because the server need user and password and I can´t > give it. when wsdl2java.class invoke the server. > > Thanks again. > Quino. > > > > On 10/1/07, Upul Godage <[EMAIL PROTECTED]> wrote: > > > > After you generate the classes, you can do something like this when > > using the stub. > > > > HttpTransportProperties.Authenticator authenticator = new > > HttpTransportProperties.Authenticator(); > > authenticator.setPreemptiveAuthentication (true); > > authenticator.setAuthSchemes(Arrays.asList(new String[]{ > > HttpTransportProperties.Authenticator.BASIC})); > > authenticator.setUsername(username); > > authenticator.setPassword(password); > > stub._getServiceClient().getOptions().setProperty( > > HTTPConstants.AUTHENTICATE,authenticator); > > > > Upul > > > > > > On 10/2/07, Leo Stevens <[EMAIL PROTECTED]> wrote: > > > > > > Hi ! > > > I have to invok a ws with Basic Authentication (user and pass), but > > > first I need to create the java classes so I need run WSDL2JAVA.classwith > > > user and pass, so my question: Is it posible to set a java env param > > > with username and password. > > > > > > Thanks . > > > Quino. > > > > > > > >
Re: wsdl2java with Basic Authentication
Thanks Upul but my problem is that I can´t generate the clases because the wsdl2java throws an exception because the server need user and password and I can´t give it. when wsdl2java.class invoke the server. Thanks again. Quino. On 10/1/07, Upul Godage <[EMAIL PROTECTED]> wrote: > > After you generate the classes, you can do something like this when using > the stub. > > HttpTransportProperties.Authenticator authenticator = new > HttpTransportProperties.Authenticator(); > authenticator.setPreemptiveAuthentication (true); > authenticator.setAuthSchemes(Arrays.asList(new String[]{ > HttpTransportProperties.Authenticator.BASIC})); > authenticator.setUsername(username); > authenticator.setPassword(password); > stub._getServiceClient().getOptions().setProperty( > HTTPConstants.AUTHENTICATE,authenticator); > > Upul > > > On 10/2/07, Leo Stevens <[EMAIL PROTECTED]> wrote: > > > > Hi ! > > I have to invok a ws with Basic Authentication (user and pass), but > > first I need to create the java classes so I need run WSDL2JAVA.classwith > > user and pass, so my question: Is it posible to set a java env param > > with username and password. > > > > Thanks . > > Quino. > > > >
Re: wsdl2java with Basic Authentication
After you generate the classes, you can do something like this when using the stub. HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator(); authenticator.setPreemptiveAuthentication(true); authenticator.setAuthSchemes(Arrays.asList(new String[]{ HttpTransportProperties.Authenticator.BASIC})); authenticator.setUsername(username); authenticator.setPassword(password); stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE ,authenticator); Upul On 10/2/07, Leo Stevens <[EMAIL PROTECTED]> wrote: > > Hi ! > I have to invok a ws with Basic Authentication (user and pass), but first > I need to create the java classes so I need run WSDL2JAVA.class with user > and pass, so my question: Is it posible to set a java env param with > username and password. > > Thanks . > Quino. >
wsdl2java with Basic Authentication
Hi ! I have to invok a ws with Basic Authentication (user and pass), but first I need to create the java classes so I need run WSDL2JAVA.class with user and pass, so my question: Is it posible to set a java env param with username and password. Thanks . Quino.
Re: [axis2] Basic authentication (client side)
Hi Jarek Please see below it worked for me. HttpTransportProperties.Authenticator.DIGEST can be replaced with HttpTransportProperties.Authenticator.BASIC if you want I. Hope this helps. Regards Stefan. <--Start--> /* * Setup the Authentication */ List authSchemes = new ArrayList(); authSchemes.add(HttpTransportProperties.Authenticator.DIGEST); HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator(); auth.setPreemptiveAuthentication(true); auth.setAuthSchemes(authSchemes); auth.setUsername("username"); auth.setPassword("password"); /* * Set the EndpointReference */ EndpointReference epr = new EndpointReference("http://127.0.0.1/";); /* * Set the http options */ Options httpOptions = new Options(); httpOptions.setTo(epr); httpOptions.setProperty(HTTPConstants.AUTHENTICATE, auth); httpOptions.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE); httpOptions.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,Boolean.FALSE); httpOptions.setProperty(Constants.Configuration.ENABLE_SWA,Constants.VALUE_TRUE); httpOptions.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_FALSE); httpOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP); httpOptions.setTimeOutInMilliSeconds(10); httpOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); /* To set the SOAPAction header to SOAPAction: "" */ httpOptions.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, epr); /* * ServiceCleint */ ServiceClient serviceClient = new ServiceClient(null, null); serviceClient.setOptions(httpOptions); /** * OperationClient */ OperationClient mepClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); mepClient.addMessageContext(msgCtx); <--End--> On Thu, 2007-02-15 at 13:26 +0100, Jarek Kucypera wrote: > Can somebody please show me a working example of client > side basic authentication with axis2 1.1.1 ? > Below is my current code (xmlbeans client) which does not work: > > HttpTransportProperties.Authenticator auth = new > HttpTransportProperties.Authenticator(); > auth.setUsername("test_user"); > auth.setPassword("test_password"); > stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth); > > > stub.ping(); // here a remote method is called, but the Autorization > http header is not sent > > // J.K. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[axis2] Basic authentication (client side)
Can somebody please show me a working example of client side basic authentication with axis2 1.1.1 ? Below is my current code (xmlbeans client) which does not work: HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator(); auth.setUsername("test_user"); auth.setPassword("test_password"); stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth); stub.ping(); // here a remote method is called, but the Autorization http header is not sent // J.K. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] How to Basic Authentication in client
Thanks I run it well 2006/12/11, Dimuthu Leelarathne <[EMAIL PROTECTED]>: Hi Tony, We have renamed the BasicAuthentication calss to the following. public static class Authenticator{ The following works. HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator(); basicAuth.setUsername("admin"); basicAuth.setPassword("admin"); Rgds, Dimuthu. - Original Message From: Tony Fang <[EMAIL PROTECTED]> To: axis-user@ws.apache.org Sent: Tuesday, December 12, 2006 10:20:03 AM Subject: [Axis2] How to Basic Authentication in client Hi, there I found many users are using following to do the basic authentication: // Add basic authentication HttpTransportProperties.BasicAuthentication basicAuth = new HttpTransportProperties().new BasicAuthentication(); basicAuth.setUsername("admin"); basicAuth.setPassword("admin"); options.setProperty(HTTPConstants.BASIC_AUTHENTICATION, basicAuth); I can find the HttpTransportProperties class, but I can't find the nest class BasicAuthentication, I am using axis2 1.0 and axis2 1.1, both haven't this nested class. Can some one help me to figure out why 1.0 and 1.1 haven't this class? -- Regards Tony -- Check out the all-new Yahoo! Mail beta<http://us.rd.yahoo.com/evt=43257/*http://advision.webevents.yahoo.com/mailbeta>- Fire up a more powerful email and get things done faster. -- Regards Tony
Re: [Axis2] How to Basic Authentication in client
Hi Tony, We have renamed the BasicAuthentication calss to the following. public static class Authenticator{ The following works. HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator(); basicAuth.setUsername("admin"); basicAuth.setPassword("admin"); Rgds, Dimuthu. - Original Message From: Tony Fang <[EMAIL PROTECTED]> To: axis-user@ws.apache.org Sent: Tuesday, December 12, 2006 10:20:03 AM Subject: [Axis2] How to Basic Authentication in client Hi, there I found many users are using following to do the basic authentication: // Add basic authentication HttpTransportProperties.BasicAuthentication basicAuth = new HttpTransportProperties().new BasicAuthentication(); basicAuth.setUsername("admin"); basicAuth.setPassword("admin"); options.setProperty(HTTPConstants.BASIC_AUTHENTICATION, basicAuth); I can find the HttpTransportProperties class, but I can't find the nest class BasicAuthentication, I am using axis2 1.0 and axis2 1.1, both haven't this nested class. Can some one help me to figure out why 1.0 and 1.1 haven't this class? -- Regards Tony Want to start your own business? Learn how on Yahoo! Small Business. http://smallbusiness.yahoo.com/r-index
[Axis2] How to Basic Authentication in client
Hi, there I found many users are using following to do the basic authentication: // Add basic authentication HttpTransportProperties.BasicAuthentication basicAuth = new HttpTransportProperties().new BasicAuthentication(); basicAuth.setUsername("admin"); basicAuth.setPassword("admin"); options.setProperty(HTTPConstants.BASIC_AUTHENTICATION, basicAuth); I can find the HttpTransportProperties class, but I can't find the nest class BasicAuthentication, I am using axis2 1.0 and axis2 1.1, both haven't this nested class. Can some one help me to figure out why 1.0 and 1.1 haven't this class? -- Regards Tony
Re: wsdl2java ant task and http basic Authentication
yes, I can do that, but I want to automate this action with an ant task (wsdl2java) VF wrote: Hi Olivier, Isnt it possible to download this wsdl file on local disc and then generate stubs etc from local file? -Original Message- From: Olivier Mocquais RD-BIZZ [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 26, 2006 2:11 PM To: axis-user@ws.apache.org Subject: wsdl2java ant task and http basic Authentication Hello, I want to use the wsdl2java ant task to generate stubs and beans in order to write a client to a web service. But the wsdl is protected by the http basic Authentication mecanism.(I know the username and password) and I can't access to the wsdl file with the wsdljava ant task. url="${wsdl.url}"> How can I specifiy the username and password in the ant task ? Thanks. Olivier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: wsdl2java ant task and http basic Authentication
Hi Olivier, Isnt it possible to download this wsdl file on local disc and then generate stubs etc from local file? -Original Message- From: Olivier Mocquais RD-BIZZ [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 26, 2006 2:11 PM To: axis-user@ws.apache.org Subject: wsdl2java ant task and http basic Authentication Hello, I want to use the wsdl2java ant task to generate stubs and beans in order to write a client to a web service. But the wsdl is protected by the http basic Authentication mecanism.(I know the username and password) and I can't access to the wsdl file with the wsdljava ant task. How can I specifiy the username and password in the ant task ? Thanks. Olivier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
wsdl2java ant task and http basic Authentication
Hello, I want to use the wsdl2java ant task to generate stubs and beans in order to write a client to a web service. But the wsdl is protected by the http basic Authentication mecanism.(I know the username and password) and I can't access to the wsdl file with the wsdljava ant task. url="${wsdl.url}"> How can I specifiy the username and password in the ant task ? Thanks. Olivier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: axis 1.4 overriding BASIC authentication
On Monday 04 September 2006 20:55, Paul McMahon wrote: > Is it possible to override the class that handles BASIC HTTP > authentication? > > I want to forget tomcat_users.xml and hook into some proprietary > authentication code which stores users and passwords. In tomcat custom authentication can be achieved by implementing your own realm. Although I would first check if any of the built-in tomcat realms (DataSourceRealm, JDBCRealm, ...) could be used. See http://tomcat.apache.org/tomcat-5.0-doc/realm-howto.html (depending on your tomcat version) for more detail. Manuel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
axis 1.4 overriding BASIC authentication
Is it possible to override the class that handles BASIC HTTP authentication? I want to forget tomcat_users.xml and hook into some proprietary authentication code which stores users and passwords. -- -Paul McMahon -01763 261 466 ext 569 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Axis deployment error for WS with basic authentication in tomcat
Hi I want to include authentication in my web service thru SSL.I passed the username and password to locator class and assigned it to stub property using _stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, username); _stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, password);Also I had setup basic authentication with JDBC REALM in tomcat container.So that whenever I access my service using browser it asks me for user credentials and verify it with my database user table(which has username and password ).When i tried to deploy my deploy.wsdd, I had something like...Exception: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate foundSo I disabled ssl in tomcat and tried to deploy the service. But this time I got Exception: AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (401)UnauthorizedI tried to search for some solution in axis mailing-list, Couldn't find a solution.Am I missing something or doing something wrong .Help me to resolve this.I need to access my webservice using https and authenticate using userid and password from my database.ThanksKavithaa
Re: Axis2 Basic Authentication By the Service
Brian Usually the approach taken is to add in the WSSecurity module Rampart. If you want to do security yourself, you could get access to the MessageContext, find the HTTP Username/Password headers, do the base64 decode, and then you would have the UID/PWD. Rampart does all that, as well as more. In return you have to give it a callback where it asks you whether a given UID/PWD is correct. Paul On 8/2/06, C. Brian Cox <[EMAIL PROTECTED]> wrote: Hello, I have been looking for an Axis2 service level authentication example, but have been unable to find any examples. I found several recent examples (all of which are similar) of how to implement Basic HTTP Authentication programmatically using the setUsername/setPassword in the client but none for the service. I am sure I am missing something basic, but the fact is I am missing it. I would like to make use of the standard wsdl2java generated skeleton and obtain the Basic Authentication username and password. Once I have the authentication parameters available in the generated service skeleton I will programmatically authenticate and proceed or raise the access denied exception. It sounds like it should be do-able to me. The reason for the service authentication is to prevent the username and password from being contained in an unencrypted text file. Thank you in advance for the help. Brian -- Paul Fremantle VP/Technology, WSO2 and OASIS WS-RX TC Co-chair http://bloglines.com/blog/paulfremantle [EMAIL PROTECTED] "Oxygenating the Web Service Platform", www.wso2.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Axis2 Basic Authentication By the Service
Hello, I have been looking for an Axis2 service level authentication example, but have been unable to find any examples. I found several recent examples (all of which are similar) of how to implement Basic HTTP Authentication programmatically using the setUsername/setPassword in the client but none for the service. I am sure I am missing something basic, but the fact is I am missing it. I would like to make use of the standard wsdl2java generated skeleton and obtain the Basic Authentication username and password. Once I have the authentication parameters available in the generated service skeleton I will programmatically authenticate and proceed or raise the access denied exception. It sounds like it should be do-able to me. The reason for the service authentication is to prevent the username and password from being contained in an unencrypted text file. Thank you in advance for the help. Brian
Axis2 Basic Authentication By the Service
Hello, I have been looking for an Axis2 service level authentication example, but have been unable to find any examples. I found several recent examples (all of which are similar) of how to implement Basic HTTP Authentication programmatically using the setUsername/setPassword in the client but none for the service. I am sure I am missing something basic, but the fact is I am missing it. I would like to make use of the standard wsdl2java generated skeleton and obtain the Basic Authentication username and password. Once I have the authentication parameters available in the generated service skeleton I will programmatically authenticate and proceed or raise the access denied exception. It sounds like it should be do-able to me. The reason for the service authentication is to prevent the username and password from being contained in an unencrypted text file. Thank you in advance for the help. Brian
Re: [Axis v1.4] deploying with Basic Authentication turned on?
can you please explain why you want to use j2ee declarative security tomcat instead of webservices context security? you must specify the http header authorization in the http-request? otherwise add the handler to the wsdd type="java:org.apache.axis.handlers.SimpleAuthenticationHandler" /> ... ... and set the usename and password properties in the client side SOAP call I can't give any more informaiton because you haven't really described in any detail what you are doing, what you have done and what you expect to happen? Why do you expect it to return HTTP 200 OK? Warren. Artur Kraft wrote: Is this a common issue or am I doing something basically wrong? On the axis-user mailinglist (also checked axis-dev and tomcat-user) I found a few other posts with suggestions, but none really apply to me. Shouldn't this be fixed quite simple or do I have to code something to get it to work? kind regards Artur Artur Kraft wrote: Hello, in Tomcat I turned on BASIC Authentication to protect the use of all axis services. Since then I always get a HTTP-Error 401/Unauthorized. How can I provide username and password to deploy again to axis? I tried the -uUserName -wPassword parameters, but they seem to belong rather to the axis-file "user.lst" than providing the tomcat access user data. Any suggestions? My environment: Axis v1.4 Tomcat v5.5.17 Java v1.5.0_06 WinXP kind regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis v1.4] deploying with Basic Authentication turned on?
Is this a common issue or am I doing something basically wrong? On the axis-user mailinglist (also checked axis-dev and tomcat-user) I found a few other posts with suggestions, but none really apply to me. Shouldn't this be fixed quite simple or do I have to code something to get it to work? kind regards Artur Artur Kraft wrote: Hello, in Tomcat I turned on BASIC Authentication to protect the use of all axis services. Since then I always get a HTTP-Error 401/Unauthorized. How can I provide username and password to deploy again to axis? I tried the -uUserName -wPassword parameters, but they seem to belong rather to the axis-file "user.lst" than providing the tomcat access user data. Any suggestions? My environment: Axis v1.4 Tomcat v5.5.17 Java v1.5.0_06 WinXP kind regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Axis v1.4] deploying with Basic Authentication turned on?
Hello, in Tomcat I turned on BASIC Authentication to protect the use of all axis services. Since then I always get a HTTP-Error 401/Unauthorized. How can I provide username and password to deploy again to axis? I tried the -uUserName -wPassword parameters, but they seem to belong rather to the axis-file "user.lst" than providing the tomcat access user data. Any suggestions? My environment: Axis v1.4 Tomcat v5.5.17 Java v1.5.0_06 WinXP kind regards, Artur - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Basic Authentication Issues
Hello all, I am having some issues getting Basic Authentication to work with Axis2. I generated my client skeketon classes using WSDL2Java. The TestStub class has a method that actually invokes the service. Note that my service is NOT an AXIS2 hosted service, but I want to use AXIS2 for the Client. I keep getting the following error: org.apache.axis2.AxisFault: Axis2 transport error : Unauthorized; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Unauthorized; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Unauthorized; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Unauthorized at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:223) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:589) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:328) at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:279) at com.test.TestStub.CreateTest(TestStub.java:224) at com.test.AddTest.main(AddTest.java:125)Caused by: org.apache.axis2.AxisFault: Axis2 transport error : Unauthorized; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Unauthorized at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:305) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:207) ... 5 moreCaused by: org.apache.axis2.AxisFault: Axis2 transport error : Unauthorized at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:117) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:299) ... 6 more- basic authentication scheme selected- No credentials available for BASIC 'CASM'@localhost:13080 Here is a snippet of the code: TestStub stub = new TestStub (null, "http://localhost:13080/ws"); ServiceClient sc = stub._getServiceClient(); Options options = sc.getOptions();//new Options(); options.setTo(new EndpointReference("http://localhost:13080/ws")); HttpTransportProperties.ProxyProperties proxy = new HttpTransportProperties().new ProxyProperties(); proxy.setProxyName("localhost"); proxy.setProxyPort(13080); proxy.setDomain(""); proxy.setUserName("username"); proxy.setPassWord(""); options.setProperty(org.apache.axis2.transport.http.HTTPConstants.PROXY,proxy); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); sc.setOptions(options); stub._setServiceClient(sc); // invokes the Web service. TestResponseDocument resDoc = stub.CreateTest(reqDoc); Any thought are appreciated. Thanks Joe
Re: [Axis2] Http Basic Authentication
Hi Saminda, I am trying to set proxy for an Axis2 client. The code snippet is as follows: HttpTransportProperties htp = new HttpTransportProperties(); httpProxyProperties = htp.new ProxyProperties(); httpProxyProperties.setProxyName(httpProxyHost); httpProxyProperties.setProxyPort(Integer.parseInt(httpProxyPort)); httpProxyProperties.setUserName(httpProxyUsername); httpProxyProperties.setPassWord (httpProxyPassword); httpProxyProperties.setDomain(httpProxyDomain); MessageContext mc = new MessageContext(); mc.setServiceContext(serviceContext); mc.setEnvelope(request); mc.setTo(toEPR); mc.setSoapAction(soapAction); OperationClient mepClient = outOnlyOperation.createClient( serviceContext, options); mepClient.addMessageContext(mc); // TODO: Add the call back handler mepClient.execute(true); Where the httpProxyUsername, httpProxyPassword, and httpProxyDomain are "anonymous". When i ran the client, I get the following exception. java.rmi.RemoteException: EJB Exception:; nested exception is: java.rmi.RemoteException: Axis2 transport error : Not Implemented; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Not Implemented; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Not Implemented; nested exception is: Caused by: java.rmi.RemoteException: Axis2 transport error : Not Implemented; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Not Implemented; nested exception is: org.apache.axis2.AxisFault: Axis2 transport error : Not Implemented; nested exception is: I have tried to find other log messages but there is no other error message. Could you give me some idea why this error happens and what I have missed out? Regards, Xinjun On 5/8/06, Saminda Abeyruwan <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE-Hash: SHA1Lothar Nieswandt wrote:> Hello all,> > I am trying to write a *simple* web service client with axis2. The server> side requires http basic authentication. I can't find out how this is done> *easily* with axis2. Somebody on the list advised to do >> call.setProperty(Call.USERNAME_PROPERTY, "user");> call.setProperty(Call.PASSWORD_PROPERTY, "pass");>> but this seems to be deprecated. What is the proper way of doing this? >> I took a look at the security example and read something about password> callbacks but that seemed too complicated.>> Any hints?>> Thanks in advance,> Lothar> Hi Lothar,Axis2 does transport level basic authentication as follows./ code snipetOMElement payload = TestingUtils.createDummyOMElement(); /*** Proxy setting in runtime */ HttpTransportProperties.ProxyProperties proxyproperties = newHttpTransportProperties().new ProxyProperties(); proxyproperties.setProxyName("localhost"); proxyproperties.setProxyPort (); proxyproperties.setDomain("domain"); proxyproperties.setPassWord("password"); proxyproperties.setUserName("userName"); Options options = new Options(); options.setProperty(HTTPConstants.PROXY, proxyproperties); options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem( null, null); ServiceClient sender = new ServiceClient(configContext, null); sender.setOptions(options); OMElement result = sender.sendReceive(payload); TestingUtils.campareWithCreatedOMElement(result);For more information please see the test case, http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?view=markupdocumentation, http://ws.apache.org/axis2/1_0/http-transport.htmlThank youSaminda-BEGIN PGP SIGNATURE-Version: GnuPG v1.4.1 (GNU/Linux)Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.orgiD8DBQFEXyYYYmklbLuW6wYRAiZPAJ9ufhjx/tv7GH4SkWjpS8cYm7UVBQCfVLTQb93pEsP8BryC1/sE5ZZZHVE==UNFg-END PGP SIGNATURE-
Re: [Axis2] Http Basic Authentication
If you need a way to do this in Axis2 1.0 release, please see http://www.wso2.net/2006/05/reuse_share_http_connections It shows you how to set up a MultiThreadedHttpConnectionManager, you can set one up with basic preemptive just like in saminda's patch. thanks, dims On 5/11/06, Saminda Abeyruwan <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Saminda Abeyruwan wrote: > Lothar Nieswandt wrote: > >>>Hello all, >>> >>>I am trying to write a *simple* web service client with axis2. The server >>>side requires http basic authentication. I can't find out how this is done >>>*easily* with axis2. Somebody on the list advised to do >>> >>>call.setProperty(Call.USERNAME_PROPERTY, "user"); >>>call.setProperty(Call.PASSWORD_PROPERTY, "pass"); >>> >>>but this seems to be deprecated. What is the proper way of doing this? >>> >>>I took a look at the security example and read something about password >>>callbacks but that seemed too complicated. >>> >>>Any hints? >>> >>>Thanks in advance, >>>Lothar >>> > > > Hi Lothar, > > Axis2 does transport level basic authentication as follows. > / code snipet > > OMElement payload = TestingUtils.createDummyOMElement(); > /** > * Proxy setting in runtime > */ > HttpTransportProperties.ProxyProperties proxyproperties = new > HttpTransportProperties().new ProxyProperties(); > proxyproperties.setProxyName("localhost"); > proxyproperties.setProxyPort(); > proxyproperties.setDomain("domain"); > proxyproperties.setPassWord("password"); > proxyproperties.setUserName("userName"); > > Options options = new Options(); > options.setProperty(HTTPConstants.PROXY, proxyproperties); > options.setTo(targetEPR); > options.setTransportInProtocol(Constants.TRANSPORT_HTTP); > ConfigurationContext configContext = > > ConfigurationContextFactory.createConfigurationContextFromFileSystem( >null, null); > ServiceClient sender = new ServiceClient(configContext, null); > sender.setOptions(options); > > OMElement result = sender.sendReceive(payload); > > TestingUtils.campareWithCreatedOMElement(result); > > For more information please see the test case, > http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?view=markup > > documentation, > http://ws.apache.org/axis2/1_0/http-transport.html > > Thank you > > Saminda > > Hi Lothar, Sorry for misinterpretation. In Axis2 1.0 we do proxy authentication. For http server authentication we'll have to do a little fix. I'll attend to this asap. Saminda -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEYyosYmklbLuW6wYRApboAKCaabIDQ3Cp0U8h6z3veLDMUmf+fgCeKFiq Ds0w76N+/ESLM0TTUOANYcE= =0rfH -END PGP SIGNATURE- -- Davanum Srinivas : http://wso2.com/blogs/
Re: [Axis2] Http Basic Authentication
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Lothar, Thank you for bringing "Http Basic Authentication" to Axis2's attention. We've added Preemptive Basic Authentication schema to Axis2 codebase via HttpClient. For ex: / Options options = new Options(); options.setTo(targetEPR); HttpTransportProperties.BasicAuthentication basicAuthentication = new HttpTransportProperties().new BasicAuthentication(); basicAuthentication.setUsername("username"); basicAuthentication.setPassword("password"); options.setProperty(org.apache.axis2.transport.http.HTTPConstants.BASIC_AUTHENTICATION,basicAuthentication); //Blocking invocation ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMElement result = sender.sendReceive(payload); // In addition to you can set server credentials such as port, host and realm as well. So if you monitor the messages with basic authentication through tcp monitor you will able to see the {Authorization: Basic SOME_HEX_CODE} http header. Unfortunately the SVN has been down for two days and i could not be able to commit the code. Thus, I've attached a diff here for you attention and apply it to your code base for make the scenario work. I will commit the code and updated the docs as soon as the SVN is up. Please play with it and let we know the results. Apply the patch at {axis2.home}/modules/core/src/org/apache/axis2/transport. Thank you Saminda Saminda Abeyruwan wrote: > > Saminda Abeyruwan wrote: > >>>Lothar Nieswandt wrote: >>> >>> >>>>>Hello all, >>>>> >>>>>I am trying to write a *simple* web service client with axis2. The server >>>>>side requires http basic authentication. I can't find out how this is done >>>>>*easily* with axis2. Somebody on the list advised to do >>>>> >>>>>call.setProperty(Call.USERNAME_PROPERTY, "user"); >>>>>call.setProperty(Call.PASSWORD_PROPERTY, "pass"); >>>>> >>>>>but this seems to be deprecated. What is the proper way of doing this? >>>>> >>>>>I took a look at the security example and read something about password >>>>>callbacks but that seemed too complicated. >>>>> >>>>>Any hints? >>>>> >>>>>Thanks in advance, >>>>>Lothar >>>>> >>> >>> >>>Hi Lothar, >>> >>>Axis2 does transport level basic authentication as follows. >>>/ code snipet >>> >>>OMElement payload = TestingUtils.createDummyOMElement(); >>>/** >>> * Proxy setting in runtime >>> */ >>>HttpTransportProperties.ProxyProperties proxyproperties = new >>> HttpTransportProperties().new ProxyProperties(); >>>proxyproperties.setProxyName("localhost"); >>>proxyproperties.setProxyPort(); >>>proxyproperties.setDomain("domain"); >>>proxyproperties.setPassWord("password"); >>>proxyproperties.setUserName("userName"); >>> >>>Options options = new Options(); >>>options.setProperty(HTTPConstants.PROXY, proxyproperties); >>>options.setTo(targetEPR); >>>options.setTransportInProtocol(Constants.TRANSPORT_HTTP); >>>ConfigurationContext configContext = >>> >>>ConfigurationContextFactory.createConfigurationContextFromFileSystem( >>> null, null); >>>ServiceClient sender = new ServiceClient(configContext, null); >>>sender.setOptions(options); >>> >>>OMElement result = sender.sendReceive(payload); >>> >>>TestingUtils.campareWithCreatedOMElement(result); >>> >>>For more information please see the test case, >>>http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?view=markup >>> >>>documentation, >>>http://ws.apache.org/axis2/1_0/http-transport.html >>> >>>Thank you >>> >>>Saminda >>> >>> > > > Hi Lothar, > > Sorry for misinterpretation. In Axis2 1.0 we do proxy authentication. > For http server authentication we'll have to do a little fix. > I'll
Re: [Axis2] Http Basic Authentication
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Saminda Abeyruwan wrote: > Lothar Nieswandt wrote: > >>>Hello all, >>> >>>I am trying to write a *simple* web service client with axis2. The server >>>side requires http basic authentication. I can't find out how this is done >>>*easily* with axis2. Somebody on the list advised to do >>> >>>call.setProperty(Call.USERNAME_PROPERTY, "user"); >>>call.setProperty(Call.PASSWORD_PROPERTY, "pass"); >>> >>>but this seems to be deprecated. What is the proper way of doing this? >>> >>>I took a look at the security example and read something about password >>>callbacks but that seemed too complicated. >>> >>>Any hints? >>> >>>Thanks in advance, >>>Lothar >>> > > > Hi Lothar, > > Axis2 does transport level basic authentication as follows. > / code snipet > > OMElement payload = TestingUtils.createDummyOMElement(); > /** > * Proxy setting in runtime > */ > HttpTransportProperties.ProxyProperties proxyproperties = new > HttpTransportProperties().new ProxyProperties(); > proxyproperties.setProxyName("localhost"); > proxyproperties.setProxyPort(); > proxyproperties.setDomain("domain"); > proxyproperties.setPassWord("password"); > proxyproperties.setUserName("userName"); > > Options options = new Options(); > options.setProperty(HTTPConstants.PROXY, proxyproperties); > options.setTo(targetEPR); > options.setTransportInProtocol(Constants.TRANSPORT_HTTP); > ConfigurationContext configContext = > > ConfigurationContextFactory.createConfigurationContextFromFileSystem( >null, null); > ServiceClient sender = new ServiceClient(configContext, null); > sender.setOptions(options); > > OMElement result = sender.sendReceive(payload); > > TestingUtils.campareWithCreatedOMElement(result); > > For more information please see the test case, > http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?view=markup > > documentation, > http://ws.apache.org/axis2/1_0/http-transport.html > > Thank you > > Saminda > > Hi Lothar, Sorry for misinterpretation. In Axis2 1.0 we do proxy authentication. For http server authentication we'll have to do a little fix. I'll attend to this asap. Saminda -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEYyosYmklbLuW6wYRApboAKCaabIDQ3Cp0U8h6z3veLDMUmf+fgCeKFiq Ds0w76N+/ESLM0TTUOANYcE= =0rfH -END PGP SIGNATURE-
Re: [Axis2] Http Basic Authentication
Saminda, thanks a lot for your help. However, you are not exactly referring to what I mean. Proxy support is well documented, I had come accross your example before. But how can the credentials for the destination server - not the proxy - be supplied? I need the request to contain an authorisation header like Authorization: Basic SOME_HEX_CODE Thank you again. Lothar > --- Ursprüngliche Nachricht --- > Von: Saminda Abeyruwan <[EMAIL PROTECTED]> > An: axis-user@ws.apache.org > Betreff: Re: [Axis2] Http Basic Authentication > Datum: Mon, 08 May 2006 17:06:00 +0600 > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Lothar Nieswandt wrote: > > Hello all, > > > > I am trying to write a *simple* web service client with axis2. The > server > > side requires http basic authentication. I can't find out how this is > done > > *easily* with axis2. Somebody on the list advised to do > > > > call.setProperty(Call.USERNAME_PROPERTY, "user"); > > call.setProperty(Call.PASSWORD_PROPERTY, "pass"); > > > > but this seems to be deprecated. What is the proper way of doing this? > > > > I took a look at the security example and read something about password > > callbacks but that seemed too complicated. > > > > Any hints? > > > > Thanks in advance, > > Lothar > > > > Hi Lothar, > > Axis2 does transport level basic authentication as follows. > / code snipet > > OMElement payload = TestingUtils.createDummyOMElement(); > /** > * Proxy setting in runtime > */ > HttpTransportProperties.ProxyProperties proxyproperties = new > HttpTransportProperties().new ProxyProperties(); > proxyproperties.setProxyName("localhost"); > proxyproperties.setProxyPort(); > proxyproperties.setDomain("domain"); > proxyproperties.setPassWord("password"); > proxyproperties.setUserName("userName"); > > Options options = new Options(); > options.setProperty(HTTPConstants.PROXY, proxyproperties); > options.setTo(targetEPR); > options.setTransportInProtocol(Constants.TRANSPORT_HTTP); > ConfigurationContext configContext = > > ConfigurationContextFactory.createConfigurationContextFromFileSystem( >null, null); > ServiceClient sender = new ServiceClient(configContext, null); > sender.setOptions(options); > > OMElement result = sender.sendReceive(payload); > > TestingUtils.campareWithCreatedOMElement(result); > > For more information please see the test case, > http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?view=markup > > documentation, > http://ws.apache.org/axis2/1_0/http-transport.html > > Thank you > > Saminda > > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.1 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFEXyYYYmklbLuW6wYRAiZPAJ9ufhjx/tv7GH4SkWjpS8cYm7UVBQCfVLTQ > b93pEsP8BryC1/sE5ZZZHVE= > =UNFg > -END PGP SIGNATURE- > -- Echte DSL-Flatrate dauerhaft für 0,- Euro*! "Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl
Re: [Axis2] Http Basic Authentication
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lothar Nieswandt wrote: > Hello all, > > I am trying to write a *simple* web service client with axis2. The server > side requires http basic authentication. I can't find out how this is done > *easily* with axis2. Somebody on the list advised to do > > call.setProperty(Call.USERNAME_PROPERTY, "user"); > call.setProperty(Call.PASSWORD_PROPERTY, "pass"); > > but this seems to be deprecated. What is the proper way of doing this? > > I took a look at the security example and read something about password > callbacks but that seemed too complicated. > > Any hints? > > Thanks in advance, > Lothar > Hi Lothar, Axis2 does transport level basic authentication as follows. / code snipet OMElement payload = TestingUtils.createDummyOMElement(); /** * Proxy setting in runtime */ HttpTransportProperties.ProxyProperties proxyproperties = new HttpTransportProperties().new ProxyProperties(); proxyproperties.setProxyName("localhost"); proxyproperties.setProxyPort(); proxyproperties.setDomain("domain"); proxyproperties.setPassWord("password"); proxyproperties.setUserName("userName"); Options options = new Options(); options.setProperty(HTTPConstants.PROXY, proxyproperties); options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem( null, null); ServiceClient sender = new ServiceClient(configContext, null); sender.setOptions(options); OMElement result = sender.sendReceive(payload); TestingUtils.campareWithCreatedOMElement(result); For more information please see the test case, http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?view=markup documentation, http://ws.apache.org/axis2/1_0/http-transport.html Thank you Saminda -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEXyYYYmklbLuW6wYRAiZPAJ9ufhjx/tv7GH4SkWjpS8cYm7UVBQCfVLTQ b93pEsP8BryC1/sE5ZZZHVE= =UNFg -END PGP SIGNATURE-
[Axis2] Http Basic Authentication
Hello all, I am trying to write a *simple* web service client with axis2. The server side requires http basic authentication. I can't find out how this is done *easily* with axis2. Somebody on the list advised to do call.setProperty(Call.USERNAME_PROPERTY, "user"); call.setProperty(Call.PASSWORD_PROPERTY, "pass"); but this seems to be deprecated. What is the proper way of doing this? I took a look at the security example and read something about password callbacks but that seemed too complicated. Any hints? Thanks in advance, Lothar -- GMX Produkte empfehlen und ganz einfach Geld verdienen! Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner
Re: Making Axis work with HTTP/Basic authentication and a VB.Net client
Here's the main code in my handler, which extends BasicHandler: String username = messageContext.getUsername(); if(StringUtils.isBlank(username)) { LOGGER.debug ("Request provides no credentials."); throw new AxisFault( "Server.Unauthenticated", Messages.getMessage("cantAuth00", username), null, null ); } Criteria criteria = session.createCriteria(User.class); criteria.add(Restrictions.eq("loginId", username)); String hashedPassword = User.hashPassword (messageContext.getPassword()); criteria.add(Restrictions.eq("passwordHash", hashedPassword)); User user = (User)criteria.uniqueResult(); if(user != null) { Hibernate.initialize(user.getClientHiers()); Hibernate.initialize(user.getFeatures()); Hibernate.initialize(user.getRoles()); messageContext.setProperty (MessageContext.AUTHUSER, user); LOGGER.debug("Credentials authenticated."); } else { LOGGER.debug("Credentials not authenticated."); throw new AxisFault( "Server.Unauthenticated", Messages.getMessage("cantAuth01", username), null, null ); }On 4/28/06, Kevin O'Rourke <[EMAIL PROTECTED]> wrote: I tried just issuing a fault, but that seemed to send a SOAP Fault backto the client rather than sending a 401. Maybe I need to send aparticular fault code?By the way, I'm using Axis 1.3.I've got it working just now in what seems like a bit of a hack, modifying HttpAuthHandler to send a 401 if the username and password aremissing:String tmp =(String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION);if ( tmp != null ) tmp = tmp.trim(); if ( tmp != null && tmp.startsWith("Basic ") ) {...} else {HttpServletResponse response =(HttpServletResponse)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE );response.addHeader("WWW-Authenticate","Basic realm=\"NtiAuth\"");try {response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } catch (IOException e) {throw AxisFault.makeFault(e);}}I'm using an underlying Servlet method to send the error, is thisallowed from an Axis web service? It seems to work but I'm worried that it may cause mysterious bad things to happen.Kevin.Rich Rodriguez wrote:> My authentication handler is just an modified version of the> SimpleAuthenticationHandler that ships with Axis to hit my user table. > To be honest, I'm not totally clear on the interaction between that> handler and the HttpAuthHandler. My auth handler issues a fault if the> user and password are not in the context, and Axis issues a 401 to the > client.>> On 4/28/06, *Kevin O'Rourke* <[EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote: >> Thanks for the information. Just to be sure I understand:> - you have written your own AuthenticationHandler class and added it as> a handler in server-config.wsdd> - you have added the HTTPAuthHandler to the "http" transport flow in > server-config.wsdd> - in your services' .wsdd file you have added the "Authenticate" handler> to the request flow.>> Is that correct?>> So it looks like I need to write my own handler class to send back a > 401> error to the client if no username and password are supplied.>> I would have expected that functionality to be part of the> HTTPAuthHandler, seeing as it's a part of HTTP/Basic authentication. >> Rich Rodriguez wrote:> > The auth handler I have is defined outside the service as:> >> > > > type="java: my.custom.AuthenticationHandler"/>> >> > The transport request flow is defined as:> >> >> > > > > > type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>> > > >> > And each service has a request flow of: > >> > > >> > > >> > > > On 4/27/06, *Kevin O'Rourke* <[EMAIL PROTECTED]> [EMAIL PROTECTED]>> > [EMAIL PROTECTED] [EMAIL PROTECTED]>>> wrote:> >> > I'm trying to do authentication for my Axis web service using > HTTP/Basic> > ov
Re: Making Axis work with HTTP/Basic authentication and a VB.Net client
I tried just issuing a fault, but that seemed to send a SOAP Fault back to the client rather than sending a 401. Maybe I need to send a particular fault code? By the way, I'm using Axis 1.3. I've got it working just now in what seems like a bit of a hack, modifying HttpAuthHandler to send a 401 if the username and password are missing: String tmp = (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); if ( tmp != null ) tmp = tmp.trim(); if ( tmp != null && tmp.startsWith("Basic ") ) { ... } else { HttpServletResponse response = (HttpServletResponse)msgContext.getProperty( HTTPConstants.MC_HTTP_SERVLETRESPONSE); response.addHeader("WWW-Authenticate", "Basic realm=\"NtiAuth\""); try { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } catch (IOException e) { throw AxisFault.makeFault(e); } } I'm using an underlying Servlet method to send the error, is this allowed from an Axis web service? It seems to work but I'm worried that it may cause mysterious bad things to happen. Kevin. Rich Rodriguez wrote: > My authentication handler is just an modified version of the > SimpleAuthenticationHandler that ships with Axis to hit my user table. > To be honest, I'm not totally clear on the interaction between that > handler and the HttpAuthHandler. My auth handler issues a fault if the > user and password are not in the context, and Axis issues a 401 to the > client. > > On 4/28/06, *Kevin O'Rourke* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Thanks for the information. Just to be sure I understand: > - you have written your own AuthenticationHandler class and added it as > a handler in server-config.wsdd > - you have added the HTTPAuthHandler to the "http" transport flow in > server-config.wsdd > - in your services' .wsdd file you have added the "Authenticate" handler > to the request flow. > > Is that correct? > > So it looks like I need to write my own handler class to send back a > 401 > error to the client if no username and password are supplied. > > I would have expected that functionality to be part of the > HTTPAuthHandler, seeing as it's a part of HTTP/Basic authentication. > > Rich Rodriguez wrote: > > The auth handler I have is defined outside the service as: > > > > > type="java:my.custom.AuthenticationHandler"/> > > > > The transport request flow is defined as: > > > > > > > > > type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/> > > > > > > And each service has a request flow of: > > > > > > > > > > > > > > On 4/27/06, *Kevin O'Rourke* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote: > > > > I'm trying to do authentication for my Axis web service using > HTTP/Basic > > over SSL, as this seemed to be the easiest option. The client is > > written in Visual Basic .Net 2005. > > > > I've added the HTTPAuthHandler to my WSDD file: > > ... > > > > > > > > > > > > > > > > > > > > ... > > > > However no authentication is happening. The VB.Net client > seems to be > > waiting for a "401 WWW-Authenticate Basic" error from the > server, to > > indicate that the server wants authentication. Axis isn't > sending a > > 401 > > but is instead just happily giving me a null username and > password. > > > > Does anyone know how I can persuade Axis to send back a 401 error? > > > > Kevin > > > > > >
Re: Making Axis work with HTTP/Basic authentication and a VB.Net client
To answer your question - yes, that is my setup.On 4/28/06, Kevin O'Rourke <[EMAIL PROTECTED]> wrote: Thanks for the information. Just to be sure I understand:- you have written your own AuthenticationHandler class and added it as a handler in server-config.wsdd- you have added the HTTPAuthHandler to the "http" transport flow inserver-config.wsdd- in your services' .wsdd file you have added the "Authenticate" handler to the request flow.Is that correct?So it looks like I need to write my own handler class to send back a 401 error to the client if no username and password are supplied.I would have expected that functionality to be part of the HTTPAuthHandler, seeing as it's a part of HTTP/Basic authentication.Rich Rodriguez wrote:> The auth handler I have is defined outside the service as:>> > type="java:my.custom.AuthenticationHandler"/>>> The transport request flow is defined as:>>> > > type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>> >> And each service has a request flow of:>> >> >>> On 4/27/06, *Kevin O'Rourke* <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote:>> I'm trying to do authentication for my Axis web service using HTTP/Basic> over SSL, as this seemed to be the easiest option. The client is > written in Visual Basic .Net 2005.>> I've added the HTTPAuthHandler to my WSDD file:> ...> > > > > > > > > > ...> > However no authentication is happening. The VB.Net client seems to be> waiting for a "401 WWW-Authenticate Basic" error from the server, to> indicate that the server wants authentication. Axis isn't sending a > 401> but is instead just happily giving me a null username and password.>> Does anyone know how I can persuade Axis to send back a 401 error?>> Kevin> >
Re: Making Axis work with HTTP/Basic authentication and a VB.Net client
My authentication handler is just an modified version of the SimpleAuthenticationHandler that ships with Axis to hit my user table. To be honest, I'm not totally clear on the interaction between that handler and the HttpAuthHandler. My auth handler issues a fault if the user and password are not in the context, and Axis issues a 401 to the client. On 4/28/06, Kevin O'Rourke <[EMAIL PROTECTED]> wrote: Thanks for the information. Just to be sure I understand:- you have written your own AuthenticationHandler class and added it asa handler in server-config.wsdd- you have added the HTTPAuthHandler to the "http" transport flow in server-config.wsdd- in your services' .wsdd file you have added the "Authenticate" handlerto the request flow.Is that correct?So it looks like I need to write my own handler class to send back a 401 error to the client if no username and password are supplied.I would have expected that functionality to be part of theHTTPAuthHandler, seeing as it's a part of HTTP/Basic authentication.Rich Rodriguez wrote: > The auth handler I have is defined outside the service as:>> > type="java:my.custom.AuthenticationHandler"/>>> The transport request flow is defined as: >>> > > type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/> > >> And each service has a request flow of:>> >> >>> On 4/27/06, *Kevin O'Rourke* <[EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote: >> I'm trying to do authentication for my Axis web service using HTTP/Basic> over SSL, as this seemed to be the easiest option. The client is> written in Visual Basic .Net 2005.> > I've added the HTTPAuthHandler to my WSDD file:> ...> > > > > > > > > > ...>> However no authentication is happening. The VB.Net client seems to be> waiting for a "401 WWW-Authenticate Basic" error from the server, to> indicate that the server wants authentication. Axis isn't sending a> 401> but is instead just happily giving me a null username and password. >> Does anyone know how I can persuade Axis to send back a 401 error?>> Kevin>>
Re: Making Axis work with HTTP/Basic authentication and a VB.Net client
Thanks for the information. Just to be sure I understand: - you have written your own AuthenticationHandler class and added it as a handler in server-config.wsdd - you have added the HTTPAuthHandler to the "http" transport flow in server-config.wsdd - in your services' .wsdd file you have added the "Authenticate" handler to the request flow. Is that correct? So it looks like I need to write my own handler class to send back a 401 error to the client if no username and password are supplied. I would have expected that functionality to be part of the HTTPAuthHandler, seeing as it's a part of HTTP/Basic authentication. Rich Rodriguez wrote: > The auth handler I have is defined outside the service as: > > type="java:my.custom.AuthenticationHandler"/> > > The transport request flow is defined as: > > > > type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/> > > > And each service has a request flow of: > > > > > > > On 4/27/06, *Kevin O'Rourke* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > I'm trying to do authentication for my Axis web service using HTTP/Basic > over SSL, as this seemed to be the easiest option. The client is > written in Visual Basic .Net 2005. > > I've added the HTTPAuthHandler to my WSDD file: > ... > > > > > > > > > > ... > > However no authentication is happening. The VB.Net client seems to be > waiting for a "401 WWW-Authenticate Basic" error from the server, to > indicate that the server wants authentication. Axis isn't sending a > 401 > but is instead just happily giving me a null username and password. > > Does anyone know how I can persuade Axis to send back a 401 error? > > Kevin > >
Re: Making Axis work with HTTP/Basic authentication and a VB.Net client
The auth handler I have is defined outside the service as: The transport request flow is defined as: And each service has a request flow of: On 4/27/06, Kevin O'Rourke <[EMAIL PROTECTED]> wrote: I'm trying to do authentication for my Axis web service using HTTP/Basicover SSL, as this seemed to be the easiest option. The client iswritten in Visual Basic .Net 2005.I've added the HTTPAuthHandler to my WSDD file: ... ...However no authentication is happening. The VB.Net client seems to bewaiting for a "401 WWW-Authenticate Basic" error from the server, toindicate that the server wants authentication. Axis isn't sending a 401 but is instead just happily giving me a null username and password.Does anyone know how I can persuade Axis to send back a 401 error?Kevin
Making Axis work with HTTP/Basic authentication and a VB.Net client
I'm trying to do authentication for my Axis web service using HTTP/Basic over SSL, as this seemed to be the easiest option. The client is written in Visual Basic .Net 2005. I've added the HTTPAuthHandler to my WSDD file: ... ... However no authentication is happening. The VB.Net client seems to be waiting for a "401 WWW-Authenticate Basic" error from the server, to indicate that the server wants authentication. Axis isn't sending a 401 but is instead just happily giving me a null username and password. Does anyone know how I can persuade Axis to send back a 401 error? Kevin
Axis 1.3 - HTTP(S) Basic Authentication
Hello, I'm having a hard time enabling Axis Basic User Authentication. What in particular do I have to add/edit? Thanks for the help in advance. kind regards, Artur Kraft
basic authentication in web services
Hi, I would like to know what is the best practice to implement basic authentication in web services by using the SOAP headers? Is there a way to leverage on the client handlers to pick up user data on behalf of the client and send it along with the request. Thanks in advance William Kane Yahoo! Personals Single? There's someone we'd like you to meet. Lots of someones, actually. Try Yahoo! Personals
Re: basic authentication
Thanks Guy I think i'll stick to creating my own headers within the soap envelope - I'm still new to webservices/axis i don't really understand the wss4j Thanks for your help From: Guy Rixon <[EMAIL PROTECTED]> Reply-To: axis-user@ws.apache.org To: axis-user@ws.apache.org Subject: Re: basic authentication Date: Fri, 26 Aug 2005 15:49:52 +0100 (BST) Hi, all my code is for the digital-signature mode of WSS4J. But the project's own site has some deployment examples for UsernameToken. See http://ws.apache.org/wss4j/ and http://ws.apache.org/wss4j/axis.html Cheers, Guy On Fri, 26 Aug 2005, Plorks mail wrote: > > > Hi Guy > > Thanks fr getting back to me. Do you haveor can you lead me to an WSS4J > example ? > > Thanks for your help > > > > > > > >From: Guy Rixon <[EMAIL PROTECTED]> > >Reply-To: axis-user@ws.apache.org > >To: axis-user@ws.apache.org > >Subject: Re: basic authentication > >Date: Fri, 26 Aug 2005 14:47:05 +0100 (BST) > > > >If you are able to change the WSDL contract, then you can indeed include > >the > >username and password in the SOAP body. Just put them in a message part, > >like > >any other parameter. > > > >If you want to put username and password in the SOAP header, then you can > >use > >the UsernameToken mode of WSS4J to be compatible with the WS-Security > >standard; or you can invent your own header if you don't have to be > >standard > >or interoperable. Using WSS4J is probably better. > > > >On Fri, 26 Aug 2005, Plorks mail wrote: > > > > > hi all > > > > > > i'm currntly getting username and password using basic authentication in > >my > > > web service. > > > > > > we are using a product that doesn't support basic authentaication in the > > > http header, so now i have to re-write my web service. Can anyone > >suggest > > > an alternative way to do this? > > > > > > Can i set the username and password in the SOAP Envelope/body? > > > > > > Thsi is the code i'm curently using > > > String headerAuth = > > > (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); > > > > > > if (headerAuth != null) > > > { > > >headerAuth = headerAuth.trim(); > > > } > > > > > > if (headerAuth != null && headerAuth.startsWith("Basic ")) > > > { > > > int i; > > > > > > headerAuth = new String(Base64.decode(headerAuth.substring(6))); > > > > > > String [] userNamePassword = headerAuth.split(":"); > > > > > > userName = userNamePassword[0]; > > > password = userNamePassword[1]; > > > } > > > > > > thanks for any help > > > > > > _ > > > Express yourself instantly with MSN Messenger! Download today - it's > >FREE! > > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > > > > >Guy Rixon [EMAIL PROTECTED] > >Institute of Astronomy Tel: +44-1223-337542 > >Madingley Road, Cambridge, UK, CB3 0HA Fax: +44-1223-337523 > > _ > Winks & nudges are here - download MSN Messenger 7.0 today! > http://messenger.msn.co.uk > Guy Rixon [EMAIL PROTECTED] Institute of Astronomy Tel: +44-1223-337542 Madingley Road, Cambridge, UK, CB3 0HA Fax: +44-1223-337523 _ Want to block unwanted pop-ups? Download the free MSN Toolbar now! http://toolbar.msn.co.uk/
Re: basic authentication
Hi, all my code is for the digital-signature mode of WSS4J. But the project's own site has some deployment examples for UsernameToken. See http://ws.apache.org/wss4j/ and http://ws.apache.org/wss4j/axis.html Cheers, Guy On Fri, 26 Aug 2005, Plorks mail wrote: > > > Hi Guy > > Thanks fr getting back to me. Do you haveor can you lead me to an WSS4J > example ? > > Thanks for your help > > > > > > > >From: Guy Rixon <[EMAIL PROTECTED]> > >Reply-To: axis-user@ws.apache.org > >To: axis-user@ws.apache.org > >Subject: Re: basic authentication > >Date: Fri, 26 Aug 2005 14:47:05 +0100 (BST) > > > >If you are able to change the WSDL contract, then you can indeed include > >the > >username and password in the SOAP body. Just put them in a message part, > >like > >any other parameter. > > > >If you want to put username and password in the SOAP header, then you can > >use > >the UsernameToken mode of WSS4J to be compatible with the WS-Security > >standard; or you can invent your own header if you don't have to be > >standard > >or interoperable. Using WSS4J is probably better. > > > >On Fri, 26 Aug 2005, Plorks mail wrote: > > > > > hi all > > > > > > i'm currntly getting username and password using basic authentication in > >my > > > web service. > > > > > > we are using a product that doesn't support basic authentaication in the > > > http header, so now i have to re-write my web service. Can anyone > >suggest > > > an alternative way to do this? > > > > > > Can i set the username and password in the SOAP Envelope/body? > > > > > > Thsi is the code i'm curently using > > > String headerAuth = > > > (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); > > > > > > if (headerAuth != null) > > > { > > >headerAuth = headerAuth.trim(); > > > } > > > > > > if (headerAuth != null && headerAuth.startsWith("Basic ")) > > > { > > > int i; > > > > > > headerAuth = new String(Base64.decode(headerAuth.substring(6))); > > > > > > String [] userNamePassword = headerAuth.split(":"); > > > > > > userName = userNamePassword[0]; > > > password = userNamePassword[1]; > > > } > > > > > > thanks for any help > > > > > > _ > > > Express yourself instantly with MSN Messenger! Download today - it's > >FREE! > > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > > > > > > >Guy Rixon[EMAIL PROTECTED] > >Institute of Astronomy Tel: +44-1223-337542 > >Madingley Road, Cambridge, UK, CB3 0HA Fax: +44-1223-337523 > > _ > Winks & nudges are here - download MSN Messenger 7.0 today! > http://messenger.msn.co.uk > Guy Rixon [EMAIL PROTECTED] Institute of Astronomy Tel: +44-1223-337542 Madingley Road, Cambridge, UK, CB3 0HA Fax: +44-1223-337523
Re: basic authentication
Hi Guy Thanks fr getting back to me. Do you haveor can you lead me to an WSS4J example ? Thanks for your help From: Guy Rixon <[EMAIL PROTECTED]> Reply-To: axis-user@ws.apache.org To: axis-user@ws.apache.org Subject: Re: basic authentication Date: Fri, 26 Aug 2005 14:47:05 +0100 (BST) If you are able to change the WSDL contract, then you can indeed include the username and password in the SOAP body. Just put them in a message part, like any other parameter. If you want to put username and password in the SOAP header, then you can use the UsernameToken mode of WSS4J to be compatible with the WS-Security standard; or you can invent your own header if you don't have to be standard or interoperable. Using WSS4J is probably better. On Fri, 26 Aug 2005, Plorks mail wrote: > hi all > > i'm currntly getting username and password using basic authentication in my > web service. > > we are using a product that doesn't support basic authentaication in the > http header, so now i have to re-write my web service. Can anyone suggest > an alternative way to do this? > > Can i set the username and password in the SOAP Envelope/body? > > Thsi is the code i'm curently using > String headerAuth = > (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); > > if (headerAuth != null) > { >headerAuth = headerAuth.trim(); > } > > if (headerAuth != null && headerAuth.startsWith("Basic ")) > { > int i; > > headerAuth = new String(Base64.decode(headerAuth.substring(6))); > > String [] userNamePassword = headerAuth.split(":"); > > userName = userNamePassword[0]; > password = userNamePassword[1]; > } > > thanks for any help > > _ > Express yourself instantly with MSN Messenger! Download today - it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > Guy Rixon [EMAIL PROTECTED] Institute of Astronomy Tel: +44-1223-337542 Madingley Road, Cambridge, UK, CB3 0HA Fax: +44-1223-337523 _ Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk
Re: basic authentication
If you are able to change the WSDL contract, then you can indeed include the username and password in the SOAP body. Just put them in a message part, like any other parameter. If you want to put username and password in the SOAP header, then you can use the UsernameToken mode of WSS4J to be compatible with the WS-Security standard; or you can invent your own header if you don't have to be standard or interoperable. Using WSS4J is probably better. On Fri, 26 Aug 2005, Plorks mail wrote: > hi all > > i'm currntly getting username and password using basic authentication in my > web service. > > we are using a product that doesn't support basic authentaication in the > http header, so now i have to re-write my web service. Can anyone suggest > an alternative way to do this? > > Can i set the username and password in the SOAP Envelope/body? > > Thsi is the code i'm curently using > String headerAuth = > (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); > > if (headerAuth != null) > { >headerAuth = headerAuth.trim(); > } > > if (headerAuth != null && headerAuth.startsWith("Basic ")) > { > int i; > > headerAuth = new String(Base64.decode(headerAuth.substring(6))); > > String [] userNamePassword = headerAuth.split(":"); > > userName = userNamePassword[0]; > password = userNamePassword[1]; > } > > thanks for any help > > _ > Express yourself instantly with MSN Messenger! Download today - it's FREE! > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ > Guy Rixon [EMAIL PROTECTED] Institute of Astronomy Tel: +44-1223-337542 Madingley Road, Cambridge, UK, CB3 0HA Fax: +44-1223-337523
basic authentication
hi all i'm currntly getting username and password using basic authentication in my web service. we are using a product that doesn't support basic authentaication in the http header, so now i have to re-write my web service. Can anyone suggest an alternative way to do this? Can i set the username and password in the SOAP Envelope/body? Thsi is the code i'm curently using String headerAuth = (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); if (headerAuth != null) { headerAuth = headerAuth.trim(); } if (headerAuth != null && headerAuth.startsWith("Basic ")) { int i; headerAuth = new String(Base64.decode(headerAuth.substring(6))); String [] userNamePassword = headerAuth.split(":"); userName = userNamePassword[0]; password = userNamePassword[1]; } thanks for any help _ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Re: Webservice over Basic Authentication
Quoting "Jonathan J. Vargas R." <[EMAIL PROTECTED]>: > Hi, > > I did this: > > public class Main { > public static void main (String[] args) { > try { > EchoImpServiceLocator sl = new EchoImpServiceLocator (); > EchoImp service = sl.getEcho (); > > ->((org.apache.axis.client.Stub) service).setUsername ("anyuser"); > ->((org.apache.axis.client.Stub) service).setPassword ("anypassword"); > > System.out.println (service.echo ("Hola amigo!")); > } catch (Exception e) { > System.err.println ("Error: " + e.getMessage ()); > } > } > } > > > It works, just hope it's safe to do this, and it is compliant with ur > customs? otherwise how would u do it from here, the class Main? :) One other way to inject client authentication into an HTTP connection is to imbed it at the beginning of the URL. This is a standard outside of Axis. Following your variables used above, the command would be something like this: sl.setEchoImpEndpointAddress(" http://sdsuser:[EMAIL PROTECTED]:8080/axis/services/EchoImp"); EchoImp service = sl.getEcho(); service.echo ("Hola amigo!") > > thanks man. > > > On 8/8/05, Kr <[EMAIL PROTECTED]> wrote: > > < proxy object>.setUsername("dfdafasdf"); > > < proxy object>.setPassword("dfdfdfdf"); > > > > > -- > Jonathan J. Vargas Rodriguez > [EMAIL PROTECTED] > "Conservar el silencio interior cuando vuelo en la tormenta me es > mejor, porque asi ya no soy otra gota de la tempestad" >
Re: Webservice over Basic Authentication
Hi, I did this: public class Main { public static void main (String[] args) { try { EchoImpServiceLocator sl = new EchoImpServiceLocator (); EchoImp service = sl.getEcho (); -> ((org.apache.axis.client.Stub) service).setUsername ("anyuser"); -> ((org.apache.axis.client.Stub) service).setPassword ("anypassword"); System.out.println (service.echo ("Hola amigo!")); } catch (Exception e) { System.err.println ("Error: " + e.getMessage ()); } } } It works, just hope it's safe to do this, and it is compliant with ur customs? otherwise how would u do it from here, the class Main? :) thanks man. On 8/8/05, Kr <[EMAIL PROTECTED]> wrote: > < proxy object>.setUsername("dfdafasdf"); > < proxy object>.setPassword("dfdfdfdf"); > -- Jonathan J. Vargas Rodriguez [EMAIL PROTECTED] "Conservar el silencio interior cuando vuelo en la tormenta me es mejor, porque asi ya no soy otra gota de la tempestad"
Re: Webservice over Basic Authentication
< proxy object>.setUsername("dfdafasdf"); < proxy object>.setPassword("dfdfdfdf");
Webservice over Basic Authentication
Hi, I am having difficulties to access an axis webservices using an axis client through basic authentication. the server returns no authentication supplied message, as i should do since i am not giving auth info yet. I see MessageContext allows to indicate password and username, would be this the point? The fact is that i can't find where to place authentication info in the stubs generated by wsdl2axis. Any example online? hint ? so i could supply an username and password for the server? -- Jonathan J. Vargas Rodriguez [EMAIL PROTECTED] "Conservar el silencio interior cuando vuelo en la tormenta me es mejor, porque asi ya no soy otra gota de la tempestad"
Commons-http-client & Basic Authentication bug ?
I'm using Axis1-2Final & commons-http-client-3.0 with the handler 'SimpleAuthenticationHandler'. And commons-http-client makes systematically 2 copies (retry) of each http request to the server. Is it normal ? Axis1-2Final without commons-http-client-3.0 is Ok. Axis1-2RC2 with commons-http-client-2.0 is Ok. Thanks in advance. -- Slimane AMAR Mail: [EMAIL PROTECTED] GENIGRAPHURL : http://www.genigraph.fr 104, rue Castagnary Tel : +33 01 45 33 64 63 F-75015 PARIS FRANCE Fax : +33 01 45 33 89 63 --
RE: basic authentication
Use the url as follows "http://username:[EMAIL PROTECTED]" -Original Message- From: Plorks mail [mailto:[EMAIL PROTECTED] Sent: Monday, May 23, 2005 2:07 PM To: axis-user@ws.apache.org Subject: basic authentication Dear all, I'm trying to access an external web service that requires me to pass a valid username and password. I have some documentation but i'm clear how i do this It says "customers will be authenticated through use of HTTP headers. Authenticaton is performed using standard HTTP basic authentication. Every message must have the HTTP authentication header correctly set with customer's id and password..." I'm not sure how i do this if i call an external function e.g. doSomething, how do i pass the credentials through? Any help much appreciated _ Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk
Re: Basic Authentication
I guess, maybe you can try to set "username" in wsdd file like and set "passwd" in users.lst file 致 礼! ? huagang {/-◎◎-\} [EMAIL PROTECTED] ( (oo) ) 2005-05-26 ? 62125151-6226 才智,德之资也;德者,才之师也 === 2005-05-25 05:18:00 您在来信中写道:=== >Hi, > > I'm trying to access Microsoft sharepoint webservice from an axis >client. I need to authenticate using Basic /NTLM authentication. I'm >trying to set username and password >call.setUsername("username"); >call.setPassword("passwd"); > >I also tried - >call.setProperty("USERNAME_PROPERTY", "username"); >call.setProperty("PASSWORD_PROPERTY", "password"); > >I still get 401 error Please help me how to deal with this. I have also >attached the code and error below. > >Thanks. >Jyothi > > > >-- >log4j:WARN No appenders could be found for logger >(org.apache.axis.i18n.ProjectResourceBundle) >log4j:WARN Please initialize the log4j system properly. >AxisFault > faultCode: {http://xml.apache.org/axis/}HTTP > faultSubcode: > faultString: (401)Unauthorized > faultActor: > faultNode: > faultDetail: >{}:return code: 401 >401 Unauthorized >{http://xml.apache.org/axis/}HttpErrorCode:401 > >(401)Unauthorized >at >org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java >:732) >at >org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:143) >at >org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.j >ava:32) >at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) >at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) >at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) >at org.apache.axis.client.Call.invokeEngine(Call.java:2765) >at org.apache.axis.client.Call.invoke(Call.java:2748) >at org.apache.axis.client.Call.invoke(Call.java:2424) >at org.apache.axis.client.Call.invoke(Call.java:2347) >at org.apache.axis.client.Call.invoke(Call.java:1804) >at SoapWsdlClient.(SoapWsdlClient.java:23) >at SoapWsdlClient.main(SoapWsdlClient.java:36) >Press any key to continue . . . > > > > >-- > > > >import java.net.*; >import org.apache.axis.client.*; >import javax.xml.namespace.*; > > >public class SoapWsdlClient >{ >public SoapWsdlClient() >{ >try >{ > > >String endPointAddress = >"http:///_vti_bin/search.asmx"; >Service service = new Service(); >Call call = ( Call )service.createCall(); >call.setTargetEndpointAddress( endPointAddress ); >call.setUsername("username"); >call.setPassword("passwd"); > >call.setSOAPActionURI("urn:Microsoft.Search/Query"); >call.setOperationName( new >QName("urn:Microsoft.Search.Query", "Query") ); >String returned = ( String) call.invoke( new Object[] { " >xmlns=\"urn:Microsoft.Search.Query\" Revision=\"1000\">domain=\"QDomain\">urn:Microsoft.Search.Respon >se.Document.Documentlanguage=\"en-US\" type=\"STRING\">cannot >print1500 >" } ); >System.out.println( "Soap returned: " + returned ); > > >} >catch (Exception e) >{ >e.printStackTrace(); >} >} > >public static void main(String[] args) >{ >SoapWsdlClient SoapWsdlClient = new SoapWsdlClient(); >} >} > > >- >Jyothishree Honnavalli >RightAnswers, LLC >67 Walnut Avenue >Suite 210 >Clark, NJ 07066 >Ph: 732-396-9010 Ext. 167 >Fax 732-396-9011 > >- > > > > >AEROSPACE?INFORMATION?CO., LTD. > virus-free and secure email > = = = = = = = = = = = = = = = = = = = = AEROSPACE INFORMATION CO., LTD. virus-free and secure email
Re: Basic Authentication
Hi guys, Can anyone tells me how to reject a soap message in Axis Handler? Thanks, Yixing Ma
Basic Authentication
Hi , I found on apache axis-user mail archives discussion on Basic authentication. I looked at one of the solutions and tried using the stub as well…still getting 401 error. Please let me know how you figured it out. import org.apache.axis.client.*; import javax.xml.namespace.*; import com.microsoft.webservices.SharePointPortalServer.WebQueryService.*; public class SoapWsdlClient { public String callWebService(String qry) { String result= null; try { QueryServiceLocator os = new QueryServiceLocator(); QueryServiceSoapStub stub = (QueryServiceSoapStub) os.getQueryServiceSoap(); stub.setUsername("username"); stub.setPassword("password"); result = stub.query(qry); } catch (Exception e) { e.printStackTrace(); } return result; } public static void main(String[] args) { String queryxml ="urn:Microsoft.Search.Response.Document.Documentcannot print1500"; SoapWsdlClient SoapWsdlClient = new SoapWsdlClient(); String result= SoapWsdlClient.callWebService(queryxml); System.out.println(result); } } -Original Message- From: Jyothishree Honnavalli Sent: Tuesday, May 24, 2005 5:18 PM To: axis-user@ws.apache.org Subject: Basic Authentication Hi, I’m trying to access Microsoft sharepoint webservice from an axis client. I need to authenticate using Basic /NTLM authentication. I’m trying to set username and password call.setUsername("username"); call.setPassword("passwd"); I also tried – call.setProperty("USERNAME_PROPERTY", "username"); call.setProperty("PASSWORD_PROPERTY", "password"); I still get 401 error Please help me how to deal with this. I have also attached the code and error below. Thanks. Jyothi -- log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle) log4j:WARN Please initialize the log4j system properly. AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (401)Unauthorized faultActor: faultNode: faultDetail: {}:return code: 401 401 Unauthorized {http://xml.apache.org/axis/}HttpErrorCode:401 (401)Unauthorized at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:732) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:143) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2765) at org.apache.axis.client.Call.invoke(Call.java:2748) at org.apache.axis.client.Call.invoke(Call.java:2424) at org.apache.axis.client.Call.invoke(Call.java:2347) at org.apache.axis.client.Call.invoke(Call.java:1804) at SoapWsdlClient.(SoapWsdlClient.java:23) at SoapWsdlClient.main(SoapWsdlClient.java:36) Press any key to continue . . . -- import java.net.*; import org.apache.axis.client.*; import javax.xml.namespace.*; public class SoapWsdlClient { public SoapWsdlClient() { try { String endPointAddress = "http:///_vti_bin/search.asmx"; Service service = new Service(); Call call = ( Call )service.createCall(); call.setTargetEndpointAddress( endPointAddress ); call.setUsername("username"); call.setPassword("passwd"); call.setSOAPActionURI("urn:Microsoft.Search/Query"); call.setOperationName( new QName("urn:Microsoft.Search.Query", "Query") ); String returned = ( String) call.invoke( new Object[] { " urn:Microsoft.Search.Response.Document.Documentcannot print1500" } );
Basic Authentication
Hi, I’m trying to access Microsoft sharepoint webservice from an axis client. I need to authenticate using Basic /NTLM authentication. I’m trying to set username and password call.setUsername("username"); call.setPassword("passwd"); I also tried – call.setProperty("USERNAME_PROPERTY", "username"); call.setProperty("PASSWORD_PROPERTY", "password"); I still get 401 error Please help me how to deal with this. I have also attached the code and error below. Thanks. Jyothi -- log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle) log4j:WARN Please initialize the log4j system properly. AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (401)Unauthorized faultActor: faultNode: faultDetail: {}:return code: 401 401 Unauthorized {http://xml.apache.org/axis/}HttpErrorCode:401 (401)Unauthorized at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:732) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:143) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2765) at org.apache.axis.client.Call.invoke(Call.java:2748) at org.apache.axis.client.Call.invoke(Call.java:2424) at org.apache.axis.client.Call.invoke(Call.java:2347) at org.apache.axis.client.Call.invoke(Call.java:1804) at SoapWsdlClient.(SoapWsdlClient.java:23) at SoapWsdlClient.main(SoapWsdlClient.java:36) Press any key to continue . . . -- import java.net.*; import org.apache.axis.client.*; import javax.xml.namespace.*; public class SoapWsdlClient { public SoapWsdlClient() { try { String endPointAddress = "http:///_vti_bin/search.asmx"; Service service = new Service(); Call call = ( Call )service.createCall(); call.setTargetEndpointAddress( endPointAddress ); call.setUsername("username"); call.setPassword("passwd"); call.setSOAPActionURI("urn:Microsoft.Search/Query"); call.setOperationName( new QName("urn:Microsoft.Search.Query", "Query") ); String returned = ( String) call.invoke( new Object[] { "urn:Microsoft.Search.Response.Document.Documentcannot print1500" } ); System.out.println( "Soap returned: " + returned ); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { SoapWsdlClient SoapWsdlClient = new SoapWsdlClient(); } } - Jyothishree Honnavalli RightAnswers, LLC 67 Walnut Avenue Suite 210 Clark, NJ 07066 Ph: 732-396-9010 Ext. 167 Fax 732-396-9011 -
RE: basic authentication
Thank you From: Harrison Tim <[EMAIL PROTECTED]> Reply-To: axis-user@ws.apache.org To: "'axis-user@ws.apache.org'" Subject: RE: basic authentication Date: Mon, 23 May 2005 10:37:04 +0100 Hi It's fairly straightforward, here's both the client and server side code to a test web service, including the code for setting the HTTP basic authentication parameters and extracting them at the server side. They appear in the request as a http header, with the username and password base64 encoded. e.g. "Authorization: Basic base64(username:password)" The client looks like this :- public class ClientCallService { public MyServiceResponseType callWebService(MyServiceRequestType req) throws Exception { MyServiceLocator os = new MyServiceLocator(); MyServiceSoapBindingStub stub = (MyServiceSoapBindingStub) os.getMyService(); // Set basic authorization parameters on the HTTP request // using the account number + "password" stub.setUsername("username"); stub.setPassword("password"); return (stub.MyFunction(req)); } } And on the server side, within the class that handles the Axis service being called, to read the HTTP headers, code looks like this :- String user = null; String password = null; String returnStr = null; // Get the current message context MessageContext msgContext = MessageContext.getCurrentContext(); // Get the authorization string from the HTTP header String headerAuth = (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); // Trim the string if (headerAuth != null) { headerAuth = headerAuth.trim(); } // Break it down into the decoded username and password if (headerAuth != null && headerAuth.startsWith("Basic ")) { int i; headerAuth = new String(Base64.decode(headerAuth.substring(6))); log.getLogger().info("Base64 decoded auth string [" + headerAuth + "]"); i = headerAuth.indexOf( ':' ); if (i == -1) { user = headerAuth; } else { user = headerAuth.substring(0, i); } if (i != -1) { password = headerAuth.substring(i+1); if (password != null && password.equals("")) { password = null; } } } If you print out the username and password values, it should be what was passed in by the client. You can then choose to authenticate against a database, XML file or whatever. Remember to use https as Basic Authorization is unsafe without encrypting the whole session. Tim -Original Message- From: Plorks mail [mailto:[EMAIL PROTECTED] Sent: 23 May 2005 09:37 To: axis-user@ws.apache.org Subject: basic authentication Dear all, I'm trying to access an external web service that requires me to pass a valid username and password. I have some documentation but i'm clear how i do this It says "customers will be authenticated through use of HTTP headers. Authenticaton is performed using standard HTTP basic authentication. Every message must have the HTTP authentication header correctly set with customer's id and password..." I'm not sure how i do this if i call an external function e.g. doSomething, how do i pass the credentials through? Any help much appreciated _ Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk+ DISCLAIMER The information contained in this e-mail is confidential and is intended for the recipient only. If you have received it in error, please notify us immediately by reply e-mail and then delete it from your system. Please do not copy it or use it for any other purposes, or disclose the content of the e-mail to any other person or store or copy the information in any medium. The views contained in this e-mail are those of the author and not necessarily those of Admenta UK Group. _ Be the first to hear what's new at MSN - sign up to our free newsletters! http://www.msn.co.uk/newsletters
RE: basic authentication
Title: RE: basic authentication Hi It's fairly straightforward, here's both the client and server side code to a test web service, including the code for setting the HTTP basic authentication parameters and extracting them at the server side. They appear in the request as a http header, with the username and password base64 encoded. e.g. "Authorization: Basic base64(username:password)" The client looks like this :- public class ClientCallService { public MyServiceResponseType callWebService(MyServiceRequestType req) throws Exception { MyServiceLocator os = new MyServiceLocator(); MyServiceSoapBindingStub stub = (MyServiceSoapBindingStub) os.getMyService(); // Set basic authorization parameters on the HTTP request // using the account number + "password" stub.setUsername("username"); stub.setPassword("password"); return (stub.MyFunction(req)); } } And on the server side, within the class that handles the Axis service being called, to read the HTTP headers, code looks like this :- String user = null; String password = null; String returnStr = null; // Get the current message context MessageContext msgContext = MessageContext.getCurrentContext(); // Get the authorization string from the HTTP header String headerAuth = (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION); // Trim the string if (headerAuth != null) { headerAuth = headerAuth.trim(); } // Break it down into the decoded username and password if (headerAuth != null && headerAuth.startsWith("Basic ")) { int i; headerAuth = new String(Base64.decode(headerAuth.substring(6))); log.getLogger().info("Base64 decoded auth string [" + headerAuth + "]"); i = headerAuth.indexOf( ':' ); if (i == -1) { user = headerAuth; } else { user = headerAuth.substring(0, i); } if (i != -1) { password = headerAuth.substring(i+1); if (password != null && password.equals("")) { password = null; } } } If you print out the username and password values, it should be what was passed in by the client. You can then choose to authenticate against a database, XML file or whatever. Remember to use https as Basic Authorization is unsafe without encrypting the whole session. Tim -Original Message----- From: Plorks mail [mailto:[EMAIL PROTECTED]] Sent: 23 May 2005 09:37 To: axis-user@ws.apache.org Subject: basic authentication Dear all, I'm trying to access an external web service that requires me to pass a valid username and password. I have some documentation but i'm clear how i do this It says "customers will be authenticated through use of HTTP headers. Authenticaton is performed using standard HTTP basic authentication. Every message must have the HTTP authentication header correctly set with customer's id and password..." I'm not sure how i do this if i call an external function e.g. doSomething, how do i pass the credentials through? Any help much appreciated _ Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk+ DISCLAIMER The information contained in this e-mail is confidential and is intended for the recipient only. If you have received it in error, please notify us immediately by reply e-mail and then delete it from your system. Please do not copy it or use it for any other purposes, or disclose the content of the e-mail to any other person or store or copy the information in any medium. The views contained in this e-mail are those of the author and not necessarily those of Admenta UK Group.
RE: basic authentication
I think i've managed this call.setUsername("username"); call.setPassword("password"); From: "Plorks mail" <[EMAIL PROTECTED]> Reply-To: axis-user@ws.apache.org To: axis-user@ws.apache.org Subject: basic authentication Date: Mon, 23 May 2005 08:36:44 + Dear all, I'm trying to access an external web service that requires me to pass a valid username and password. I have some documentation but i'm clear how i do this It says "customers will be authenticated through use of HTTP headers. Authenticaton is performed using standard HTTP basic authentication. Every message must have the HTTP authentication header correctly set with customer's id and password..." I'm not sure how i do this if i call an external function e.g. doSomething, how do i pass the credentials through? Any help much appreciated _ Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk _ Be the first to hear what's new at MSN - sign up to our free newsletters! http://www.msn.co.uk/newsletters
basic authentication
Dear all, I'm trying to access an external web service that requires me to pass a valid username and password. I have some documentation but i'm clear how i do this It says "customers will be authenticated through use of HTTP headers. Authenticaton is performed using standard HTTP basic authentication. Every message must have the HTTP authentication header correctly set with customer's id and password..." I'm not sure how i do this if i call an external function e.g. doSomething, how do i pass the credentials through? Any help much appreciated _ Winks & nudges are here - download MSN Messenger 7.0 today! http://messenger.msn.co.uk
RE: Problems using the ServletSecurityProvider to do Basic Authentication
With trace logging turned on I get the following: - Enter: SimpleAuthenticationHandler::invoke - provider.getClass : class org.apache.axis.security.servlet.ServletSecurityProvider - org.apache.axis.i18n.resource::handleGetObject(user00) - User: preselect - org.apache.axis.i18n.resource::handleGetObject(user00) - User: preselect - org.apache.axis.i18n.resource::handleGetObject(password00) - Password: preselect - org.apache.axis.i18n.resource::handleGetObject(password00) - Password: preselect - org.apache.axis.i18n.resource::handleGetObject(got00) - Got HttpServletRequest - org.apache.axis.i18n.resource::handleGetObject(noPrincipal00) - No principal! - org.apache.axis.i18n.resource::handleGetObject(cantAuth01) - Enter: SOAPPart ctor(FORM_FAULT) - org.apache.axis.i18n.resource::handleGetObject(setMsgForm) - Setting current message form to: FORM_FAULT (currentMessage is now org.apache.axis.AxisFault) What is the principal, am I stilling missing some configuration. Is this meaningful to anybody. Clement -Original Message- From: Clement Lyons Sent: Tuesday, 10 May 2005 4:44 PM To: axis-user@ws.apache.org Subject: Problems using the ServletSecurityProvider to do Basic Authentication Hi All I'am running an Axis (1.2RC3) Web Service on a Tomcat (4.1.31) I'am having problems getting Basic Authentication working using the ServletSecurityProvider and the SimpleAuthenticationHandler. This is my configuration: In the Axis web.xml: AxisServlet Apache-Axis Servlet org.apache.axis.transport.http.AxisServlet use-servlet-security 1 BASIC Web Services Basic Authentication In the server-config.wsdd In tomcat-users.xml This setup was previously discussed here http://marc.theaimsgroup.com/?l=axis-user&m=104403054218784&w=2 quite a while back. I add the username and password in the client and using TCPMON can see that it is being sent in the HTTP Headers. I've also added logging to the SimpleAuthenticationHandler and can see that the username/password is received correctly and that the security provider used is org.apache.axis.security.servlet.ServletSecurityProvider Should the allowedRoles specified in the server-config.wsdd be a user or role in the tomcat-users.xml. Any pointers or help would be much appreciated. Clement
Problems using the ServletSecurityProvider to do Basic Authentication
Hi All I'am running an Axis (1.2RC3) Web Service on a Tomcat (4.1.31) I'am having problems getting Basic Authentication working using the ServletSecurityProvider and the SimpleAuthenticationHandler. This is my configuration: In the Axis web.xml: AxisServlet Apache-Axis Servlet org.apache.axis.transport.http.AxisServlet use-servlet-security 1 BASIC Web Services Basic Authentication In the server-config.wsdd In tomcat-users.xml This setup was previously discussed here http://marc.theaimsgroup.com/?l=axis-user&m=104403054218784&w=2 quite a while back. I add the username and password in the client and using TCPMON can see that it is being sent in the HTTP Headers. I've also added logging to the SimpleAuthenticationHandler and can see that the username/password is received correctly and that the security provider used is org.apache.axis.security.servlet.ServletSecurityProvider Should the allowedRoles specified in the server-config.wsdd be a user or role in the tomcat-users.xml. Any pointers or help would be much appreciated. Clement