How do I use certificate based authentication with SOAP? - web-services

I'm trying to get the wsdl from a soap ws but I'm getting a:
ERR_BAD_SSL_CLIENT_AUTH_CERT
error, when I tried to access https://dummyurl.com:8446/data.php?wsdl from my browser.
I've been given 3 files: ca.crt, pablo.crt and pablo.key but I don't know how to use these files in order to authenticate with this service.
I've also tried to use curl to get the wsdl (without any luck)
curl -k https://dummyurl.com:8446/data.php?wsdl -v -key=pablo.key -cacert=ca.crt -cert=pablo.crt
So my question is, how can I use this certificates and key in order to authenticate and and get the wsdl?

You might find documentation useful
https://curl.haxx.se/docs/sslcerts.html

Related

Why is Basic Authentication failing with Postman CLI?

I am trying to automate via the Postman CLI my collections.
I am able to run a folder (with the Postman Runner) without problems, using Basic Authentication to access many endpoints I am calling.
If I try to run the very same folder with the Postman CLI, all the protected endpoints answer with 403 Forbidden.
It seems that the requests are not using the authentication header.
Is it a known problem? Is there a workaround?
Plus, to troubleshoot better, is there a way to inspect the requests when the collection is run with the Postman CLI? I can see a recap but I cannot see the detailed requests with all the headers, body, ect...
I am running the collection/folder with
postman collection run COLLECTION_UUID -k --verbose -e ENVIRONMENT_UUID -i FOLDER_UUID --env-var "source=X.X.X.X" -d "datafile.json"

CSRF Token error when attempting to post from CURL to an API endpoint I control. How do I write the request?

I have not utilized this part of Django before, but I have an endpoint which is giving me a 403 error and is telling me that my request needs a csrf token. I was trying to figure out how best to get this since I was attempting to set up a bunch of curl requests to handle some simple queries to the endpoint. Likewise, I was thinking to also use POSTman, but I was not sure where documentation is to handle these request.
I have seen the cookie csrftoken, but when I was attempting to curl with it, it was still giving me a 403. thought it would looking something like this:
curl -d #profilepicturev2.png -b "csrftoken=Ebfn2OlfhSwFjAEQdoQon7wUjbynFoJqrtHMNPla3cy7ZfCMT9cxZ3OQHsbaedam" http://127.0.0.1:8000/api/files/uploader
Maybe I am mistaken? I am trying to send a photo to the server, so i was thinking that this would be correct and wasnt sure if i needed to add additional params in order to append additional data information.
i need to see your code, but i think you need to install "pillow" to send pictures in django !

How to document APIs in postman in the following conditions?

We have a series of GET requests api, say in the format of
curl -XGET ip-address/api-keywords
These kind of requests generate a JSON responses.
Now the issue here is when I document using Postman,we do not want the ip address to be exposed. How to edit that in postman?.
You can setup environments in Postman that will let you use variables. Then in your collection, different developers or users can setup their own environments and variables. See https://www.getpostman.com/docs/environments

WSO2 APIM 1.10 - config endpoint secure scheme while adding api via REST-API

I am using APIM 1.10 to add new APIs via the REST-API (see: https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APIsApi#apisPost) and it works fine but:
I want to add the security-scheme: "Basic Auth" for the api endpoint.
But I have no idea how to do this, because the endpointConfig-config is not described.
I need something like this: endpointSecured:true, endpointAuthDigest:"Basic", endpointUTUsername:"usN", endpointUTPassword:"pass"
Any ideas?
C ya,
Marty
Following steps will help you to achieve the requirement.
Edit the API and go to the implementation tab.
Click on "Show More Options".
Select "Secured" for Endpoint Security Scheme.
Provide the credentials and save.
When you create API using rest API, you can add secure endpoint details by adding following part. &endpointType=secured&epUsername="admin"& epPassword="admin"
Here is a sample command
curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=SampleAPI&context=/country&version=1.0.0&visibility=public&thumbUrl=&description=Check Country by Code&tags=country&endpointType=secured&epUsername="admin"& epPassword="admin"&tiersCollection=Gold,Bronze&http_checked=http&https_checked=https&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*&default_version_checked=default_version&bizOwner=xx&bizOwnerMail=xx#ee.com&techOwner=xx&techOwnerMail=ggg#ww.com" -d'endpoint_config={"production_endpoints":{"url":"http://services.groupkt.com/country/get/iso2code/IN","config":null},"endpoint_type":"http"}';

How to pass a parameter to a wsdl URL?

I know it is not the current ways of doing things but...
How do I pass a http parameter to a WSDL URL?
I tried to attach it to the end of the query String like
"http://host:port/serviceA/methodA?wsdl&parameterName=value"
but the webservice refuse to read it.
What is the correct way of doing it?
I am no authority, but I am working with a web service (SOAP) at the moment - SOAP services seem to expect an XML Document, delivered as a POST.
Try doing a HTTP POST instead of a GET:
curl -d parameterName=value "http://host:port/serviceA/methodA?wsdl"
I solved this question by changing the endpoint URL. (not the WSDL URL)
Thanks for you reponses.