chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srinivas Chivukula <schivuk...@gmail.com>
Subject Re: Fwd: how to send any element in wsse usernametoken
Date Thu, 01 Nov 2012 19:46:47 GMT
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<String, String> parameter = new HashMap<String, String>();
 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 <fmui@apache.org> 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
>>  <oas:UsernameToken>
>>  <oas:Username>myuser</oas:**Username>
>>                  <oas:Password>mypassword</oas:**Password>
>>                  <edm:AppID>testappid</edm:**AppID>
>> </oas:UsernameToken>
>>
>> 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
>>
>
>


-- 
Srinivas

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message