Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 178BFDEE2 for ; Thu, 1 Nov 2012 20:12:06 +0000 (UTC) Received: (qmail 61641 invoked by uid 500); 1 Nov 2012 20:12:05 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 61599 invoked by uid 500); 1 Nov 2012 20:12:05 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 61590 invoked by uid 99); 1 Nov 2012 20:12:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Nov 2012 20:12:05 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [87.230.106.24] (HELO vwp1524.webpack.hosteurope.de) (87.230.106.24) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Nov 2012 20:11:56 +0000 Received: from p4fff5330.dip.t-dialin.net ([79.255.83.48] helo=laptop.local); authenticated by vwp1524.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1TU171-0002im-FN; Thu, 01 Nov 2012 21:11:35 +0100 Message-ID: <5092D775.2090905@apache.org> Date: Thu, 01 Nov 2012 21:11:33 +0100 From: =?ISO-8859-1?Q?Florian_M=FCller?= User-Agent: Postbox 3.0.5 (Macintosh/20120826) MIME-Version: 1.0 To: dev@chemistry.apache.org CC: Srinivas Chivukula Subject: Re: Fwd: how to send any element in wsse usernametoken References: <5a5e729e0ddcaea346482c9cff937d02-EhVcXl9JQQFXRwQFDQkEXR0wfgZLV15fQUBFBEFYXS9ZUF0WWlloB11LX15bLkQBWlteQFlTWA0=-webmailer2@server03.webmailer.hosteurope.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;fmui@apache.org;1351800716;9d0b7377; X-Virus-Checked: Checked by ClamAV on apache.org Hi Srinivas, It looks like your server is using Basic Authentication (or something similar). The status code 401 is not returned by the Web Services server, but by some other component that looks at the HTTP headers. Is this intentional? Do you have any reverse proxy in front of your service or some SSO setup in place? It may also use UsernameTokens but it doesn't seem to reach that check. OpenCMIS does also send Basic Authentication credentials, but it assumes that the UsernameTokens credentials and the Basic Authentication credentials are the same. If that's not the case, you have to code that into your own authentication provider. Florian > Hello Florian, > Thanks for the info, I still have some issue, I cant get the cmis client to > send the username and password at all, I get authorization failed, below is > the snippet of the code. please let me know if you see anything incorrect, > the user and password work fine if I use it in SoapUI, I checked the soap > xml at the CMIS Webservice and it does not have username and password tag > coming in at all > thanks > Srinivas > > SessionFactory f = SessionFactoryImpl.newInstance(); > Map parameter = new HashMap(); > String wsdl = "http://IP:8100/cmis/services/RepositoryService?wsdl"; > parameter.put(SessionParameter.USER, "username"); > parameter.put(SessionParameter.PASSWORD, "password"); > parameter.put(SessionParameter.BINDING_TYPE, > BindingType.WEBSERVICES.value()); > parameter.put(SessionParameter.WEBSERVICES_ACL_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, wsdl); > parameter.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, wsdl); > parameter.put(SessionParameter.REPOSITORY_ID, "repo_dev"); > Session s = f.createSession(parameter); > System.out.println("CMISTest.main()"+s.getRepositoryInfo()); > System.out.println("done!"); > > Error: > Exception in thread "main" > org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: > Error: The server sent HTTP status code 401: Unauthorized > at > org.apache.chemistry.opencmis.client.bindings.spi.webservices.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:76) > at > org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getRepositoryInfos(RepositoryServiceImpl.java:85) > at > org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:111) > at > org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl.getRepositories(SessionFactoryImpl.java:98) > at com.eohhs.cmis.example.CMISTest.main(CMISTest.java:66) > Caused by: com.sun.xml.ws.client.ClientTransportException: The server sent > HTTP status code 401: Unauthorized > at > com.sun.xml.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:203) > at > com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:179) > at > com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:94) > at > com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:116) > at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598) > at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557) > at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542) > at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439) > at com.sun.xml.ws.client.Stub.process(Stub.java:222) > at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135) > at > com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109) > at > com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89) > at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118) > at $Proxy40.getRepositories(Unknown Source) > at > org.apache.chemistry.opencmis.client.bindings.spi.webservices.RepositoryServiceImpl.getRepositoryInfos(Repository > > > > > On Wed, Oct 31, 2012 at 12:40 PM, Florian M�ller wrote: > >> Hi Srinivas, >> >> You need your own authentication provider for that. >> >> Have a look at this class: >> org.apache.chemistry.opencmis.**client.bindings.spi.** >> StandardAuthenticationProvider >> >> The getSOAPHeaders() method generates the SOAP header. It should be easy >> to add an additional tag there. >> >> You activate your custom authentication provider like this: >> >> parameter.put(**SessionParameter.**AUTHENTICATION_PROVIDER_CLASS, >> "com.example.custom.**authentication.provider"); >> >> You can also add your custom session parameters (-> AppID) and access them >> in the authentication provider. >> >> >> - Florian >> >> >> >> Hello I am new to this forum, If I have posted to the wrong address, >>> please >>> direct me to the correct forum, I am writing a client using apache >>> chemistry and I am having hard time in sending a custom element in the >>> username token >>> >>> myuser >>> mypassword >>> testappid >>> >>> >>> How do I send in the AppID in the UsernameToken element, below only has >>> USER and PASSWORD. the AppID is of a different namespace >>> >>> parameter.put(**SessionParameter.USER, "myuser"); >>> parameter.put(**SessionParameter.PASSWORD, "mypassword"); >>> >>> your input is greatly appreciated. >>> thanks >>> -- >>> Srinivas >>> >> > >