OGC : How to know which ogc service type is in my url location? - ogc

Having a predefined url for my ogc service how can i know if is wms or wfs: /My/predefined/URL/
Well i know that if i made /My/predefined/URL/?request=GetCapabilities i will find which service type is, but is there any faster way something like GetServiceType?
I want categorize my url from wms and wfs, and in some cases i could find that information directly on url but in other cases not. How can i do that without have to ask for each url getCapabilites and lookup for servicetype attribut to see if is wms or wfs.

This is what GetCapabilities request is for. In some cases the URL may contain a hint which service type it is, but that's not always the case. So you have to ask the server and this is what GetCapabilities is for.

Well i know that if i made /My/predefined/URL/?request=GetCapabilities
i will find which service type is, but is there any faster way
something like GetServiceType?
Actually it is invalid to ask for a GetCapabilities response for an unknown service type, so if you can do this then your service must have the service parameter preset somehow.
To find out if your service is a WMS you need:
/My/predefined/URL/?request=GetCapabilities&service=WMS&
To find out if your service is a WFS you need:
/My/predefined/URL/?request=GetCapabilities&service=WFS&
To find out if your service is a WCS you need:
/My/predefined/URL/?request=GetCapabilities&service=WCS&
same for SOS, CSW, WPS, WMTS...
If the service is of the type specified you will get a GetCapabilities response, otherwise you will get an exception like:
<?xml version='1.0' encoding="UTF-8" ?>
<ServiceExceptionReport version="1.2.0"
xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wcs/1.0.0/OGC-exception.xsd">
<ServiceException code="InvalidParameterValue" locator="request">msWCSDispatch(): WCS server error. WCS request not enabled. Check wcs/ows_enable_request settings.
</ServiceException>
</ServiceExceptionReport>
Note it is entirely possible for a service endpoint like /My/predefined/URL/? to have multiple service types available.

Related

How can I access the auth_mellon nameId property in my javascript application

I have implemented mod_auth_mellon in my apache httpd 2.4 webserver. I configured Mellon to authenticate when I try to access my oracle JET application.
So far all is good, when I go to http://example.com, I am redirected to my sso login page and after entering my credentials I am sent back to https://example.com.
My problem is that once I return to my application at https://example.com, I need to be able to access the Mellon-nameid attribute so I can retrieve user privilleges from a database talbe based on email address.
According to all the docs I have read, mod_auth_mellon stores the mellonUser attribute in the apache environment, and/or the response headers.
Also according to what I have read, there is no way in my JET application to access the apache environment variables, and so far I haven't found a way to examine the response headers to get the mellonUser from there either.
Is there an alternate way to access the MellonUser attribute? Can it be stored in teh Mellon cookie, or maybe put on the url as a query parameter?
Also any methods for accessing the headers would be appreciated as well.
Just posting here, even though it's an old thread.
So when you use Apache Mellon, you can supply the nameID in a header value. If you are using apache as a proxy, (I.E you successfully authenticated, now go through the proxy), the web server can access the nameID as an attribute. You can also pass whatever other SAML attributes you want (Assuming you already know how to do this, i'll leave this part out).
Now the problem is, that header value is something the web app (Backend) sees BEHIND the proxy. Javascript is ran client side, in the user's actual browser. So in this scenario it would not be able to see this value unless you tell the backend to send it forward.
As an example, if you setup Apache SAML and then have it proxy to a PHP app, and you have a page that simply dumps the headers:
<?php
foreach (getallheaders() as $name => $value) {
echo "$name: $value\n";
}
?>
OR:
<?php
var_dump($_SERVER);
?>
VIOLA, you can see the nameid and whatever other attributes! However, go to your web console, and poke around, or check out your headers... these will be different because you are getting headers from pre-proxy, while the webapp gets headers from the post-proxy.
So what can you do? In my php example, since PHP will parse first, you can grab the variable from the backend, and echo it into a script that will be ran after this is all done.
<script>
username = "<?php echo $YourHeaderNameID; ?>";
</script>
However, there is some danger to this as well. Client side Javascript and be easily modified. So if your username "johnsmith", and you wanted to change the website username to "joeschmoe", that would be trivial. You should probably have the backend provide whatever user information you require, and then use javascript to style, rearrange, do whatever with.

google managed-VMs specify instance in URL

I use google managed-VMs. My module has several instances. I need to perform a HTTP call on each of these instances. Hence, I would like to know if there is a way to specify the recipient instance in the URL.
For instance I tried: http://<instance-name>.<module-name>.<project-name>.appspot.com/ without success.
You're missing a <version-name> in there:
http://<instance-name>.<version-name>.<module-name>.<project-name>.appspot.com
See https://cloud.google.com/appengine/docs/python/modules/#Python_Application_hierarchy for more details (this is the page for Python, but it applies across-the-board.

How do you get the groupUniqueId for the Google Group Settings API?

I am looking at this API: https://developers.google.com/admin-sdk/groups-settings/v1/reference/groups/get
However, when I try the test at the bottom, it always returns 400 Bad request. I have tried using the Google group email address (without the #gmail.com and with the #gmail.com) for several groups I am in.
How do you find the groupUniqueId for a Google group?
I had the problem yesterday and 'think' I undertood it:
I use the PHP SDK and had to use groupssettings API.
When I executed my query, the PHP answer was something such: "incorrect json format".
Still in my API, I had to FORCE the JSON to be used, by adding optional parameter: alt=json
Then, The query worked.
Until now, this is the only Google API where I had to specify this.
What I suspect is the "Try It" feature to use json, and because the API does NOT returns json by default, it just fails. Too bad there is no way to force json there.

Rest web service consumes XML with other parameters as well

Would it be possible to consume an XML request along with other parameters as well?
These params are not Form Params.
The client would pass these params with XML.
Actually when you talk about REST web service, you talk in terms of GET, POST, DELETE and PUT.
If you talk about the client only then POST and PUT will allow you to pass the user object, where as others will may ask for the id to perform the specific operation.
So, in a web service you have the parameter, ID, and it could be pathparam/formparam/queryparam and you have a #consume tag as well. But I have never seen a client that would pass these parameters with XML, because the URL path is not affected.

UTF-8 For Restful Services

Currently i enable UTF-8 as #Consumes("application/xml;charset=utf-8") in the RESTful Services for the different methods. I am interested to see if we can change this for all REST services with a single configuration change. We are using CXF, maybe there is something it provides?
Thanks
Ravi
The first question is are you sure you want to prevent any of your rest resources from accepting non-UTF-8 entities? Such an across the board proclamation feels like it could cause trouble down the road.
I'll admit that I haven't used CXF so I can't speak to those specifics. But I can think of one option each under the JAX-RS and Servlet APIs which might be along the lines of what you seek to accomplish.
Using the Servlet API: Depending on how you are deploying your application you might be able to create and inject a servlet filter. In the doFilter method, you can check the encoding of the request entity and continue on to the next part of the filter chain (ultimately to the rest application). If an improper entity is sent on the request, you would just set the appropriate HTTP 415 status onto the response and not invoke your rest application.
Using JAX-RS: Depending on how you parse/accept the entity body in your resources, you could create and inject a custom MessageBodyReader implementation. This reader could parse your entity, ensuring that it is UTF-8 only and throw an appropriate exception otherwise.

Resources