How to have dynamic routing in datapower - websphere

Well I am quite new to datapower(IBM Websphere xi50) and i have got struck as to how to route dynamically.Suppose we have configured dynamic backend then a client asks for some service so how to route it .
Is it through XSLT or yhrough certain policy creation I am not getting any clear idea regarding it?
Thanks

Normally you use "var://service/routing-url" and not as Ajitabh answered "dp:url-open".
You can also use the "Set variable" action instead of XSLT.
dp:url-open is used to "fork" a message, not to route it. If you use dp:url-opento route you must also set "skip-backside = 1"!
See sample for XSLT:
<xsl:variable name="destURL" select="concat('http://127.0.0.1:',$Transformer-port,'/', $usrTransformer)" />
<!-- Set backend URL -->
<dp:set-variable name="'var://service/routing-url'" value="$destURL" />

I create an XSLT that looks at the different elements in the incoming message to help determine the destination. I then invoked the DataPower extension method <dp:set-variable('var://service/routing-url') select="yourUrlHere"/>. I put that XSLT into a routing action.

You can do it through XSLT . The steps to do it is as following (logically)
Step 1: Determine the criteria based on which you want routing [it could be URI or any part of message]
Step 2: Use datapower built in function dp:open-url to send traffic to target.
Step 3: Get the response and process it.
There are other ways to do it as well but this is the most straight forward way.

Related

Is it necessary to use the form to transfer data to the server?

I'm new to backend programming. I chose the laravel framework. Already learned the basics. During the study, the question arose: is it necessary to use the form to transfer data to the server ?. For example: the deletion route looks like this to me
Delete.
If I leave it, will it be a mistake? Maybe advise an article or something. Thanks in advance
Short answer is no, it's not necessary, but you should (if you're bound to HTML only).
The HTTP standard has different methods for different purposes. Using an anchor tag will always make a HTTP GET request to the link/server, which is not ideal, GET request should never change the remote (server) state, that's a job other methods (POST, PUT, DELETE, PATCH), you should try to use the method that better describe what you're trying to do: in your case I suppose you're trying to delete a complaint, so a DELETE or POST is what you're looking for.
The only way to use make a non GET request in plain HTML* is to use <form>. Also if you're planning to use a method different from POST you should take a look at Laravel's #method here
Mind that if you can and want to use JavaScript to perform your request you totally can, dropping the requirement to have use form (docs and docs).

SoapUI (non pro) Property Transfer getting the basics going using XPath

Preamble: First off - I am a complete novice, and have zero clue what I am doing, apologies in advance.
Question:
I have working SOAP messages in SoapUI (regular flavour) that I have valid responses to. I am trying to build a set of test steps that can complete a transaction lifecycle for testing.
I only just figured out that Property Transfer could be used to take a response from call A to be used in call B.
I have the source declared correctly, and the Target correctly, With the default namespace info I have successfully transferred the complete response of call A into the target property. Now I just need to cut that down to one element only. I have tried all manner of things, but I seem to be getting [null] every time (except where I don't include the bit to choose one element at all, as noted above).
I just don't know what the format of the line that specifies the desired field should be. I know I have to have the name of the desired field in it, near the end, but beyond that I am randomly trying all sorts.
Okay, I have it solved, after many stupid trials and errors. For posterity and so I can reference it myself in future, this is what I got going:
Inside the soap message response body, there is a tag ns1 (which I am guessing is namespace 1).
Inside that is a section called salesInvoiceReturn.
Inside that is another section called salesInvoiceDetails.
Inside that is a field that I need is called salesInvoiceSalesTax.
So my line in the XPath Source section that works reads:
//ns1:salesInvoiceReturn/salesInvoiceDetails/salesInvoiceSalesTax
Pressing the Run button shows me it captures the correct value into the Custom Property I selected. I don't seem to need any code at all in the Target section.

How to update the "Replacement Value" in ReplaceText Processor using Rest API?

I need to know how to update the values in nifi processors using Rest API.
https://nifi.apache.org/docs/nifi-docs/rest-api/index.html
For example: I have used below processor structure
GetFile>SplitText>ExtractText>ReplaceText>ConvertJSONToSQL>PUTSQL.
I have passed following inputs for above processors.,
FileLocation(GetFile).
validation(ExtractText).
ReplacementValue(ReplaceText).
DBCP ConnectionPool,username and pwd for SQL.
I just need to use nifi rest api client to write above inputs into processors.
For example : If I give Processor name and input file in Rest API Client then it will write into processor.
Please stop me if anything i'm doing wrong.
Help Appreciated and Tell me any other ways is possible?
Mahen,
You can issue a PUT request to /processors/{id} and provide the new value of the "Replacement Value" property. You'll need to provide JSON body in the request to do this, and you can see the structure by expanding the endpoint noted above on the documentation link you provided, then clicking ProcessorEntity > ProcessorDTO > ProcessorConfigDTO to see the pop-up dialogs with the element listing and examples. You can also quickly get the current values of the processor by issuing a GET request to /processors/{id}.

Can Sling mappings be restricted to requests with host header

I would like to selectively apply Sling mappings defined in sling:Mapping nodes under /etc/map.publish and can't get the behaviour I would like.
Essentially, I would like the mapping rule to trigger only when the host header matches the request.
I am currently using sling:Mapping nodes under /etc/map.publish to map resource paths to short URLs in the response.
So under /etc/map.publish/http/myapp I would have the following node:
<jcr:root ...>
jcr:primaryType="sling:Mapping"
sling:internalRedirect="/content/company/app/en"
sling:match="app.company.com
</jcr:root>
What I would like is that when a user requests:
http://app.company.com/content/company/app/en/page.html
The urls in the response (when mapped) will return in the form:
http://app.company.com/page.html
The reason for this difference in inbound and outbound urls is because I have Apache rewriting URLs for different device types.
However, when a request with a different host header arrives, such as:
http://localhost:4502/content/company/app/en/page.html
I do not want the URLs to be mapped according to that rule. Right now, it is being mapped to
http://app.company.com/page.html
It seems as though the mapping is strictly resolves the resource using considering the host/port. Then when mapping urls during output a "best match" is found and used. I would like the map() to behave like the resolve() if possible.
There are two mechanisms based on /etc/map:
URL resolver using resolver.resolve() responsible for transforming URLs like http://app.company.com/page.html into content path, eg. /content/company/app/en/page.html
Link rewriter using resolver.map() method which transforms the content and shortens all links from /content/company/app/en/page.html form in <a>, <img>, etc. to full URL. It will work only if you don't have any regular expressions in apropriate sling:match property.
You can use domain name to map/resolve content and eg. create multidomain environment, so http://app.company.com/page.html will hit one resource and http://app.company2.com/page.html will hit another.
However, you can't disable or enable link rewriter depending on the current request host. Eg. if configure mappings as above, the /content/company/app/en/page.html content path will always be shortened to http://app.company.com/page.html, no matter what host header you have in your request.
If you want to make sure your inbound request is resolved, just add a second mapping to it.
Your mapping would look like this:
<jcr:root ...>
jcr:primaryType="sling:Mapping"
sling:internalRedirect="[/content/company/app/en,/content,/]"
sling:match="app.company.com
</jcr:root>
Outbound mappings, s.a. resolver.map(), will use the first applying rule.

ajax send parameter to jsp but failed

I am trying to send data to my jsp via:"xhr.send(projectCode);"
but apparently the parameter is not received when I am trying to realise it with System.out.print it is a null displayed.
so the story from the begining. my javascript function send the parameter to the jsp whitch construct an xml file and resend to the first one.
this will reconstruct my second dropdownList with the xml code constructed and received.
so the problem that the parameter dosent sent at all.
What should I do.
Just note in case the syntax whatever you have sent is like this:
url="postjob2.jsp?param=" + param;
After param=" keep a space and then the parameter. My issue got resolved as soon as I entered the space.
The simplest all-round solution is to run your application with a HTTP-tracer, such as fiddler for windows or wireshark. In that way you can see if the proper data is being submitted from your client to the server Given the amount of details you provide, I think this is the best starting point

Resources