Bug WSO2Integration Studio http endpoint character (<,>) - wso2

I am looking for a rest api in Wso2 Integration Studio. Does not support > and < signs in http endpoint URL. These marks >
I used the expression. But that doesn't save my change.
The example is below.

You should be able to use < and > character entities to represent < and > respectively?
URI template would be
http://localhost:8000/ngsi-ld/v1/entities?year>{uri.var.ep.year}

Related

Fiddler regex to match a file

I am trying to intercept a http request(which is requesting for a .js file) and return a file from the local disk.
Here are the sample http requests :
> http://rupall.mmk.test.com/%7B636242121790000792%7D/WebResources/main_system_library.js?ver=1854333973
> http://rupall.mmk.test.com/%7B636242121790000792%7D/WebResources/main_system_library.js?ver=1854333973
> http://rupall.mmk.test.com/%7B636242121790000792%7D/WebResources/main_system_library.js?ver=-1518765574
Here is my regex :
REGEX:http://rupall\.mmk\.test\.com/.*/WebResources/main_system_library.js?ver=.*$
But this regex is not matching any of the http requests that I listed above. When I use the test feature of fiddler, it is failing. Is this regex correct or what am I missing here ?
Try this
https?:\/{2}\w*\.\w*\.\w*\.\w*\/{1}\%\d\w*\%{1}\d+\w\/{1}\w*\/{1}\w*\.js\?ver\=
https://regex101.com/r/4zoky6/1

wso2 esb endpoint can not be changed

I have some external URL (restful api) to be integrated.
Those URL have different prefixed URL with different parameter at url, for example:
www.abc.com/books
www.abc.com/book/11
www.abc.com/book/11/authors
When get response from those invocation, esb needs to convert response from one json format to our standard json format.
I plan to use esb javascript mediator to perform convert operation, but I didn't find any way to attach url parameters.
Any one have any idea?
I have used mediator by java code to implement it, but it is too heavy.
I am also looking into connector for another option.
I have got a solution by use url template. By this solution, I can change url according to template defined.
With this solution, I didn't need to write mediator or connector.

WSO2 API Manager versioning APIs

I am looking to change the structure of the URL generated by the WSO2 API Manager for a defined service by switching the position of the version number. For example, the default for a service is
http://localhost:8020/some_service/1.0.0
however, I would prefer to have it as
http://localhost:8020/1.0.0/some_service/
My 2cts; you could put Apache with mod-proxy and mod-rewrite module or HAProxy in front of WSO2 AM and user rewrite rules on the URL's.
That URL format is fixed one and generally that is the URL format is followed. If you like to change the format, there is no way, but you can define the version with context and make a preferred url pattern. But again version must be filled.

Monitoring HTTP requests and responses (no web browser)

I'm creating web services to make an Android app talk to a server.
I'm using Tomcat for the server and a JAX RS lib to convert data between Java objects and JSON during the transfers.
What I want is to be able to view the actual HTTP requests and responses the framework is creating.
A web browser (like Firefox with Firebug) won't do because I also need to check the request bodies generated by the Android app.
With the Servlet API I could intercept and get the request data with a filter, but not the response (I believe) after it was written by the framework.
Wireshark might be a solution (I'm trying it right now), but seems to be a bit to much. I need to worry about properly filtering my messages and didn't figure out yet how to get my HTTP messages properly formatted (plain text w/o the hexa content).
I wonder if there is a simpler way to do this from inside my application or from tomcat.
Try Tomcat's AccessLogValve. You can configure it to log incoming request headers as well as outgoing response headers. Here's an example:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_headers_access_log." suffix=".txt"
pattern="%t "%r" %s ||| %{Content-Length}o ||| %{User-Agent}i" />
Notice the %{xxx}o pattern - that's for response header. You might want to use it as %{X-JSON}o. Also notice the %{xxx}i pattern - that's for request headers.
Nest the <Valve/> element within a <Context/>, <Host/> or <Engine/> elements and you'll be all set.
I ended up using Wireshark with the following filter:
http.content_type == "application/json" || http.accept ==
"application/json"
To get the content decoded, right click on the json part of you package ("JavaScript Object Notation: application/json") > Copy > Bytes > Printable text only

Can Groovy be a client to JAX-RPC-style web service?

Apparently, Groovy easily consumes web services. Can it consume a web service that needs JAX-RPC instead of JAX-WS? Should I use an older version of Groovy or its libraries to do so?
It's really easy to consume XML-RPC web services. You need the Groovy XML-RPC as well as the Smack library in your classpath.
I wrote some groovy scripts to work with our Atlassian Confluence wiki and here's a short example to retrieve a wiki page using XML-RPC:
import groovy.net.xmlrpc.*
def c = new XMLRPCServerProxy("http://host:port/rpc/xmlrpc")
def token = c.confluence1.login("username","password")
def page = c.confluence1.getPage(token, "SPACE", "pagename")
println page.content
c.confluence1.logout(token);
You use the XMLRPCServerProxy to access the XML-RPC services. If your services require complex parameters as parameters or return one, these are represented as Groovy maps, with the attribute name as key and it's value as the corresponding value. In the script above, the service getPage returns a Page object, which is a map, but as you can directly access a map's key using the dot-notation in Groovy, page.content is the same as page.get("content").
What do you mean by "can it consume a web service that needs JAX-RPC instead of JAX-WS"? What differences do you expect on the Groovy side? Did you try to call that web service as documented:
import groovyx.net.ws.WSClient
def proxy = new WSClient("http://localhost:6980/MathService?wsdl", this.class.classLoader)
proxy.initialize() // from 0.5.0
def result = proxy.add(1.0 as double, 2.0 as double)
assert (result == 3.0)
result = proxy.square(3.0 as double)
assert (result == 9.0)
Do you get any particular error?
Since Groovy can work with compiled Java classes, sometimes the easiest way to access a SOAP-based web service is to just generate the stubs and write a Groovy client that uses them. Use your "wsimport" tool (JAX-WS) or wsdl2java (JAX-RPC) to generate the stubs, and write your Groovy class as usual.