Need to add Oauth to Soap - java

I need to add oauth to a soap url. I know how to do it for rest api but not for soap. Can anyone help me with a sample code for a url in java
URL is like : http://example.org.com/TempRefWS1/TestRefWS
Need a sample code on how to add oauth for a soap url

Related

How to use access_token in azure with OAuth 2.0

I am practicing an azure sample named OAuth 2.0 Sample for Azure AD Spring Boot Starter Resource Server library for Java.I followed the steps but blocked in Check the authentication and authorization.I have got the access_token successfully, but I don't know how to use it in postman or any other ways. Is there any doc or advice? Thanks very much!
Okay, I added the Authorization in request header, but I got 401 and an error message. And this is way where I got the access_token.
Is there something wrong?
You could do something like below :
You can add the necessary URL and HTTP verb at the top.
You will have to add Authorization Headers in the postman and add the oauth token bearer like below
Authorization : Bearer <Oauth Token>
Update :

Java jax-rs send HTTP GET Request accompanied with JSON Data Input

I'm using jax-rs library to create a client testing a Web Service by sending HTTP requests to it, for study purposes. Now a POST Request looks something like this:
Response res = target.
request().post(Entity.entity(jinput.toString(), MediaType.APPLICATION_JSON));
and GET Request something like this:
Response res = target.
request().accept(MediaType.APPLICATION_JSON).get(Response.class);
Where target is the targeted URI and jinput the JSON Input used to post a resource...
Now I wonder... is there a way I can send a GET Request accompanied with a JSON input? For the sake of testing how the Web Service reacts to it...
By using cURL to manually send HTTP requests I can do it... but is there a way I can do it using the jax-rs library?
Thanks in advance :)
P.S. I would like to test the same thing with a DELETE Request as well... if possible...

how do I extract request parameters and headers of webservices from its url in java

I need to create a SOAP envelop but I only have the URL of the web services. How can I get the headers and parameters to create the SOAP envelop for given URL of the Web services in Java?
You need a WSDL to create the SOAP envelope. One way to get the WSDL is to hit the URL you already have by appending '?wsdl' to the URL. You can also try /ServiceName?wsdl. Once you get the WSDL, you can easily generate SOAP envelope using SoapUI.

What OAuth protocol is this API using and is there a standard OAuth Library I can use to authenticate with it?

I have come across this private API that authenticates using OAuth API (Not sure what version or flavor of OAuth it is). My working knowledge of OAuth isn't that great so I need some directions to sort this out.
Here's how I was able to to test it manually using Postman/Advance Rest controller Chrome extensions and make a successful query to access a protected resource.
Step 1. Made a POST request to the OAuth Service URL with specific headers. The response includes the OAuth token
Authorization:OAuth oauth_consumer_key="<<key>>",oauth_signature_method="PLAINTEXT",oauth_signature="<<secret>>%26"
Here's an example response format. The response includes the OAuth token and the Oauth token secret (Both of which I need to use to access the protected resource in the next step)
oauth_token=<<token>>&oauth_token_secret=<<secret>>&oauth_session_handle=JN-eMMx1z_Tpy3sFrgzVsssF9Y_pyJaE&oauth_expires_in=3600&oauth_authorization_expires_in=86400
Step 2. Make a POST/GET request to the protected resource after setting the Authorization header with Key, Secret and OAuth token
Authorization:OAuth oauth_consumer_key="<consumerKey>",oauth_signature_method="PLAINTEXT",oauth_signature="<consumerSecret>%26<oauth_token_secret>",oauth_token="<oauth_token>"
Now, Here are my questions:
What version of OAuth is this API using?
Is there a standard OAuth client library that does the authentication and lets me query for protected data without me having to manually construct the POST call with headers like above, get the token (by parsing the response and extracting the token), make another POST/GET manual call with another formatted header to access the protected resource? If so how?
I tried scribe-java and extended the DefaultApi20.java but I can't get it to work. Then I wondered if I understand the API version properly. Because this private API gives me just one URL to get the token. Not sure what Authorization URL, Request Token URL & Access Token URL are in this context.
I even tried looking at the Google oauth client library for Java but I can't find an example using it that fits my context. Any help understanding this is appreciated.
You're using OAuth 1.0. The Scribe library is the way to go with Java: https://github.com/fernandezpablo85/scribe-java. In your case so-called 2-legged authorization is what it needs to do. Here's sample code for 2-legged OAuth 1.0 with Scribe: http://enrico.sartorello.org/blog/2013/08/2-legged-oauth-java-client-made-easy/

Unable to access webservice using SOAP UI for requests sent through a webserver which is protected by Siteminder

We have a webservice hosted on Tomcat app server which is fronted by a Apache webserver. This webserver is protected by sideminder . The webservice is implemented using JAX WS 2.
When i try to access the webservice using SOAP UI 3.6.1 with the authorized username and password I get a 403 forbidden error, though I am able to access the WSDL through a browser after entering the credentials.
Wrote a Java client but get the same error, even after using the Authenticator class.
How can i access this webservice using SOAP UI.
The issue could be that the webserver is rejecting requests because the SITEMINDER cookie is not present in the SOAP UI request. Would there be a way to attach a siteminder cookie in the SOAP UI Request.
Have you tried this ? change in headers and attachments in soapui and in wsdl
Just to elaborate on user1640065 answer , you may have to manually add the Basic Authentication header with Base64 encoded userid:password values. I did not test this with Soap UI, but had the same problem accessing web services API secured by SiteMinder.

Categories

Resources