Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

CXF : unable to login on soap service #11

Open
adrienchabot opened this issue Jun 12, 2022 · 10 comments
Open

CXF : unable to login on soap service #11

adrienchabot opened this issue Jun 12, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@adrienchabot
Copy link
Contributor

Describe the bug

Hi,

I'm trying to connect using soap service provided by safekeeping-cxf and experiencing issues.
The getVersion() soap operation is working fine.
When I login() with authServer/base64/user/password/port I get an Unsupported authentication type:class com.vmwar e.safekeeping.external.type.options.ConnectOptions.
It seems that "options" element (of login() operation) is linked to "ConnectOptions" causing the object to never beeing recognized as instanceOf pscConnectOptions ... and so failing with previous error.

Is it a bug or am i missing something ? :)

Reproduction steps

1. sended this request to /sdk entrypoint

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cxf="http://cxf.safekeeping.vmware.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <cxf:login>
         <options>
            <authServer>11.22.33.44</authServer>
            <base64>false</base64>
            <password>password</password>
            <port>902</port>
            <user>Administrator@vsphere.local</user>
         </options>
      </cxf:login>
   </soapenv:Body>
</soapenv:Envelope>


### Expected behavior

Got 500 error code with  `Unsupported authentication type:class com.vmwar
e.safekeeping.external.type.options.ConnectOptions` error

### Additional context

Debian 11 / OpenJDK 11 / Safekeeping master
@adrienchabot adrienchabot added the bug Something isn't working label Jun 12, 2022
@mdaneri
Copy link
Contributor

mdaneri commented Jun 13, 2022

Let me run a test, and I'll get back to you

@mdaneri
Copy link
Contributor

mdaneri commented Jun 14, 2022

I made some update to the WSDL file and the sapi.jar file. Can you please resync the repo and retry?

@adrienchabot
Copy link
Contributor Author

Many thanks for your quick reply !

Same thing with fresh new deployment.
Can you confirm I am requesting soap service the right way ?

In cxf-test you are using a boolean to switch between CSP or PSC login ; is there something I need to specify to login using PSC and SOAP ? I haven't found any detection mechanism in code that instantiate pscConnectOptions or cspConnectOptions.

Have you a working authentication example request/scenario using SOAP requests ?

@mdaneri
Copy link
Contributor

mdaneri commented Jun 15, 2022

I never tried to use soap directly.
The only thing I can do is use Java or C# and dump the soap call

@adrienchabot
Copy link
Contributor Author

adrienchabot commented Jun 16, 2022

Ok.

Is it possible to expose directly "loginPsc + loginCsp" additionally to "login" soap actions ? (each one linked to corresponding type "pscConnectOptions + cspConnectOptions")

Or adding another parameter in "login" to specify "auth_type(psc|csp)" in order to create the object with the right class ? ("pscConnectOptions"/"cspConnectOptions" and not "connectOptions" => like you do in your cxf-test app with a boolean)

I suppose it's this test that fails (or equivalent method in safekeeping-external/etc) : https://github.com/vmware/safekeeping/blob/74f91eb216d8003683f251dab109fa0b0eb6e148/safekeeping-cxf/src/main/java/com/vmware/safekeeping/cxf/SapiImpl.java#L749-L761

Object never match conditions instanceOf(pscConnectOptions|cspConnectOptions) because it's always created with parent ConnectOptions class through soap service (instead of child classes pscConnectOptions/cspConnectOptions)

@mdaneri
Copy link
Contributor

mdaneri commented Jun 17, 2022

Yes I can. Let me work on that

@mdaneri
Copy link
Contributor

mdaneri commented Jun 22, 2022

I created 2 new API loginCsp and LoginPsc
Please use LoginPsc should solve your issue

@adrienchabot
Copy link
Contributor Author

It works !! :) (I've made some corrections in prepare.sh to make it work)

I get a token in xml response, I've tried to pass it to HTTP Auth-token header but it throws a 500 with UnrecognizedToken exception. Am I using it the right way ?

@mdaneri
Copy link
Contributor

mdaneri commented Jun 29, 2022

do you get this error with the connect method?
What language are you using? Why can you not use the WSDL to generate the stub?
if you want to see a fully working client for the SOAP service, please check the sample https://github.com/vmware/safekeeping/tree/master/safekeeping-cxf-test

@adrienchabot
Copy link
Contributor Author

adrienchabot commented Jul 1, 2022

I was getting this error with isConnected (loginPsc, then isConnected [with Auth-token]).

I've made new tests, so now :

  • loginPsc return 200 with token
  • connect (with Auth-token header) return 500 with Can't load library: /opt/safekeeping/safekeeping-cxf/build/install/safekeeping-cxf/lib/lib64/libjDiskLib.so (there are some .so in this path but not this one - and I haven't found it in another location on disk)
  • isConnected (with Auth-token header) return 200 with false
  • ... other actions (getAllDumps/getRepositories/...) return 200 (with Auth-token header), but all body are empty => I suppose it's the expected behavior because of isConnected=false

I confirm that using workflow loginPsc/connect/isConnected (instead of loginPsc/isConnected) fixes UnrecognizedToken exception (even if I get a 500 on connect action).

I'm not using any language, only pure SOAP requests ; I'm querying /sdk entrypoint with SoapUI - wich generates stubs from SOAP wsdl/xsd url (great for basic/quick testing : in soapUI, create new SOAP project and paste /sdk?wsdl url in "initial wsdl" field, it will construct some tree views and generate sample requests).

EDIT : I'm using VMware-vix-disklib-7.0.3-19513565.x86_64.tar.gz (with openjdk 11.0.15 / debian 11)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants