How do I use the WCF-CustomIsolated base64 decoding in BizTalk? - wcf

Input
An xml with a root and a base64-encoded xml, like <data>FFEFE#13DD</data>.
Problem
On the Message tab in the WCF-CustomIsolated adapter you can choose a body path expression to point to the postion in the incoming message you want to use as message. You can also set the type, string, xml, hex or base64.
Setting up this, with a tested xpath, using allowed syntax, that points to an Element and base64 as type, and make a SOAP-call from Postman ends up in "System.InvalidOperationException: ReadSubtree() can be called only if the reader is on an element node." To me it sounds like the xpath is not correct, but it is :)
I've looked at Extracting XML with WCF-SQL adapter and believe I do like that. Does anyone have used this functionality and can guide me? I would be most grateful.

Related

Webmethods - Retrieve PDF file from SFTP and encode

I am new to webmethods and need some guidance. I am tasked to read the PDF document from SFTP server and base64 encode it. I have managed to GET the file from SFTP location and now struggling to encode it. Below is the code snippet to read the file:
INVOKE pub.client.sftp:login
INVOKE pub.client.sftp:cd
INVOKE pub.client.sftp:ls
INVOKE pub.client.sftp:get
MAP
I later modified the code to include base64 encoding, no output is produced. Code is shown below:
INVOKE pub.client.sftp:login
INVOKE pub.client.sftp:cd
INVOKE pub.client.sftp:ls
INVOKE pub.client.sftp:get
INVOKE pub.string:base64Encode
MAP
when i debug the code, it executes SFTP GET and stops. No information about encoding.
Please guide me to achieve this requirement. Thank you for your help in advance.
Try something like this,
after sftp:get, invoke the pub.io:streamToBytes and then invoke pub.string:base64Encode
Don't forget to map field in pipeline.
The pub.string:base64Encode expect a byte[] Input, you can try to convert the stream to byte[] with pub.io:streamToBytes

how to parse incoming XML file in HTTP request and generate s response based on incoming XML data in Tibco BW

I am new to TIBCO BW development. I need your expert opinion, as I am stuck to create a response XML file. Here is the scenario.
I get a XML file in the HTTP request and after parsing the incoming request XML structure, I have to create a response document which will act as a stub to the incoming request.
First I create a HTTP Receiver which will act as receiving the XML file in the HTTP request. Then I used Parse XML to parse the incoming XML document is correct or wrong. After this activity I am stuck, since I create the Render XML activity after this but it does not fetch the data even after I map the incoming request parsed by Parse XML activity, I can see during Testing time that it is getting the whole XML in the Input but even after mapping the output with input from Parsing, I get NULL values, hence facing errors.
Please let me know where I am doing wrong, or should I use any other method to catch the incoming values, such that I can create a proper response XML document to be used as Response.
Once you received the HTTP request, parsed the HTTP Post Data using the "Parse XML" activity, I really advice you to use a "Mapper" to map your input (received and parsed as an XML) to a XML output schema. This output can easily be returned after.
For example,
My HTTP client send me an XML like this
And I want to return an XML like this with the addition of a and b
The process :
And the mapper
And the end, you can send the XML HTTP response like this :
EDIT (comment) :
To edit the prefix namespaces in a process. You must click on the process (left hand menu) and on the bottom side, there is a button "Namespace Registry"
if you click on it you'll be able to change the prefix name.
But bear in mind, this kind of manipulation can break the existing mapping in the process because everything is XML based in Tibco BW.

Pentaho rest client with variable url

I'm new to Pentaho and using the Rest Client. I can get the Rest client to work by using generate rows for the url. But then I need to pass part of the result of the json to be part of the url for the next request. I'm not sure how to do this. Any suggestions.
Remember that PDI works with streams, you, for each REST request you made, you will have one row as result. You will have as many rows as many requests you do.
I'm not sure if you can deserialize the JSON object directly from the PDI interface, but in the worst scenario, you can use the "User Defined Java Class" to use some external library (like Gson) and deserialize the object.
Then, you can create another variable in the UDJC step and concatenate the attributes you need on the URL string that comes from the last step.
In the other hand you can use "Modified Javascript" to deserialize it and return the attributes you need to then concatenate it with the URL. To use it, just declare varibles inside the code, and then use "Get variables" button to retrieve the available fields to send to the next step.
There are many ways to do it, I suggest you to use the Modified Javascript because it's easier to handle.
You CAN parse the Json response, just use Json Input a a nex step, and then use XPath to parse the field you want: $.result.the.thing.u.want.

How to set http headers in dotCMS

I'm trying to create a XML data feed with dotCMS. I can easily output the correct XML document structure in a .dot "page", but the http headers sent to the client are still saying that my page contains "text/html". How can I change them to "text/xml" or "application/xml"?
Apparently there's no way to do it using the administration console. The only way I found is to add this line of (velocity) code
$response.setHeader("Content-Type", "application/xml")
to the top of the page template.
Your solution is the easiest. However there are other options that are a bit more work, but that would prevent you from having to use velocity to do the XML generation, which is more robust most of the time.
DotCMS uses xstream to generate XML files (and vise versa). You could write a generic plugin to use this as well.
An JSONContentServlet exists in dotCMS that takes a query and generates json or xml (depending on your parameters). It is not mapped on a servlet by default, but that is easy to add.

What does "Predicate Mismatch for View"

I am writing a iOS client for a an existing product that uses a legacy SOAP webservice. I got the proper URL to send my SOAP/XML messages too and even have some samples. However, none of them seem to work...
I always get a 404 error with the following error text "Predicate mismatch for View"
I am using an ASIFormDataRequest for the actual request and apending the data (SOAP XML in this case) via [someFormRequest appenData:myData].
I am flat out of ideas here and am wondering what, if anything I am doing wrong. Or should I ping one of the back end guys? Could this error be a result of something on the server side?
This is an error message spit out by the pyramid web framework when attempting to access a URL without supplying all of the required parameters. You definitely want to double check that the URL you are using has all of the required params (headers, query string options, request body, etc) and if you're convinced that what you are sending is correct then but your backend guys because it's definitely a miscommunication or a bug between the two of you.