I'm facing some issues when generating a schema using a RFC connection to SAP while calling the function "BAPI_COMPANYCODE_GETLIST" which then creates a schema in my integration account using the content generated previously. However, after the schema is generated, when i access it all it has are the headers that are on the SAP table and none of its content. In this case the headers are COMP_NAME and COMP_CODE and it should return 122 rows but it does not and it also doesnt return any error so i cannot understand why it can retrieve the headers of the table but not its content.
I've tried enabling safe typing but after that the SAP connection doesnt work anymore, also tried calling different functions but the results are the same with different headers. Since this connector is recent i'm not able to find any solutions for this issue at this moment
The flow first receives an HTTP Request, afterwards it calls the BAPI function to generate the schema which is then used to create the schema in the integration account with the following properties:
{
"Content": "#{base64ToString(items('For_each')?['Content'])} ",
"ContentType": "application/xml",
"SchemaType": "Xml"
}
The schema is just that – the metadata describing the structure of an XML document. It is not the XML document itself.
The schema will contain two parts, the request message structure and the response message structure. You need to use the request message structure to form the BAPI get list, then can use the response message structure to parse the response. Either of the generic send message to SAP or the targeted Call BAPI actions of the SAP connector can be used to send the request message.
Related
Using
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(notificationHubConnection, notificationHubName, enableTestSend);
NotificationOutcome outcome = await hub.SendDirectNotificationAsync(fcmNotification, deviceUri);
I am able to send and receive notifications using FCM via the Azure hub to a Xamarin Android app, finally. However the payload is not present in the received RemoteMessage even though the sent fcmNotification json payload looks good and passes validation. I am basically looking at the RemoteMessage.Data property, but not finding the expected payload array. Looking at RemoteMessage structure, I haven't found any part of the payload array either.
I know that the Azure hub manipulates the notification by adding the necessary headers like content type, e.g. "application/json". Are there any other settings that are needed to be passed to enable the "data" only payload?
Additional settings are not necessary, but the format of the entire notification contents has to have this type of structure:
"{ \"data\":{ \"A\": \"aaa\",\"B\": \"bbb\",\"C\": \"ccc\",\"D\": \"ddd\",\"E\": \"eee\",\"F\": \"fff\"}}"
The number of data elements is up to you. The data element name can be anything as well as the associated content except for the need for backslash usage for special characters. Both the element name and content can be inserted using variables creating a traditional composite string.
What is especially important is the inserted spaces as shown. Also note that traditional Json formatting is not acceptable because of the need for those spaces.
Working on developing rest endpoint, with spring-boot, to consume a resource from another microservice (external), since both the services are in development phases, there is quite a lot of changes in request and response frequently. Many times our micro-service failed because of change in response from the target microservice.
To avoid this failure, we thought of Defining a JSON schema in the calling client to describe the expected response.
If there is a schema mismatch log an error message, prefixed with "JSON_SCHEMA_MISMATCH".
Please advise if there are any other better solutions for handling this in a more generic way, meaning the same could be used for other microservices as well without more duplicated codes.
You can use objects to directly fetch the values from the services.
For example -
VOClass vOobject = restTemplate.getForObject(url, VOClass.class, params);
The microservice which you are using should also return the same object, or the json with same variable names.
If there are variables you are getting in response match the variables from your VOClass object then those values will be set and those not matching will be null.
ALso if there are new varaibles returned from microservice, you can cosume them by adding those variables in your VOClass.
I am using IBM integration toolkit
I have an application with two flows; the request flow has a json request message using http request node then the message is thrown to another flow (in another application representing a stub)through a MQ Input, compute node then MQ reply.
It then throws the message to the response flow in my application through MQ Input
I need to output the message in a json form through http reply node but in the flow it runs an exception "Message does not contain valid HTTP context information, Need return context info"
if anyone have a clue for this error and how to solve it
Thanks in advance
The problem is that your HTTP response flow does not know which request it has to respond.
In case you really need your request and response to be implemented as different flows, you have to store identifier of incoming HTTP or SOAP request somewhere, for example as a message in some dedicated queue.
In your request flow you can find identifier of request in
InputLocalEnvironment.Destination.HTTP.RequestIdentifier
or
InputLocalEnvironment.Destination.SOAP.RequestIdentifier
depending on the type of your input node.
Then, your response flow should read a message written by request flow to find a value of RequestIdentifier.
This value should be set into the LocalEnvironment of response message assembly:
OutputLocalEnvironment.Destination.HTTP.Reply.ReplyIdentifier
or
OutputLocalEnvironment.Destination.SOAP.Reply.ReplyIdentifier
Here is IBM doc: https://www.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ac20450_.htm#ac20450___le
When the HTTPInput node receives an input request message, it sets the local environment field Destination.HTTP.RequestIdentifier to a unique value that identifies the Web service client that sent the request. You can refer to this value, and you can save it to another location if appropriate.
For example, if you design a pair of message flows that interact with
an existing WebSphere MQ application (as described in Broker calls
existing Web service), you can save the identifier value in the
request flow, and restore it in the reply flow, to ensure that the
correct client receives the reply. If you use this technique, you must
not change the data, and you must retain the data as a BLOB.
The HTTPReply node extracts the identifier value from the local
environment tree and sets up the reply so that it is sent to the
specific client. However, if you are using an HTTPReply node in a flow
that does not have an HTTPInput node, and this field has been deleted
or set incorrectly, message BIP3143S is issued.
I was reading this Questions regarding REST
What exactly is RESTful programming?
While reading i get that the client is independent of server and client don't need to construct anything.
I want to know that when we are building forms like user registration . Then what is the REST way of doing it.
I mean when i do GET for /user/new then
Does the server has to send the complete FORM in html
Only send fields in JSON and form is constructed by client itself
But then again there will be many complexities, if i just send the fields, then what things like
Hidden fields
Default value for select boxes
what about some logic like this field can'r be greater than 30 etc
REST is, as you're already aware, a way of communicating between a client and a server. However, the issue here is what is being defined as the "client". Personally, I tend to consider that the browser itself is not in itself the client: instead, the client is written in JavaScript, and the browser is merely a conduit to executing it.
Say for the sake of argument that you wish to view the details of user '1414'. The browser would be directed to the following location:
/UserDetails.html#1414
This would load the static file ViewUser.html, containing all the form fields that may be necessary, as well as (via a <script> tag) your JavaScript client. The client would load, look at the URL and make a RESTful call to:
GET /services/Users/1414
which would send back JSON data relating to that user. When the user then hits "save", the client would then make the following call:
PUT /services/Users/1414
to store the data.
In your example, you wanted to know how this would work with a new user. The URL that the browser would be directed to would be:
/UserDetails.html#0
(or #new, or just # - just something to tell the JavaScript that this is a new client. This isn't a RESTful URL so the precise details are irrelevant).
The browser would again load the static file ViewUser.html and your JavaScript client, but this time no GET would be made on the Users service - there is no user to download. In addition, when the user is saved, this time the call would be:
POST /services/Users/
with the service ideally returning a 302 to /services/Users/1541 - the location of the object created. Note that as this is handled in the client not the browser, no actual redirection occurs.
"Forms" for hypermedia APIs could be rendered in a "forms aware" media type like for instance Mason (https://github.com/JornWildt/Mason), Hydra (http://www.markus-lanthaler.com/hydra/) or Sirene (https://github.com/kevinswiber/siren). In Mason (which is my project) you could have a "create user" action like this:
{
"#actions": {
"create-user": {
"type": "json",
"href": "... URL to resource accepting the POST ...",
"method": "POST",
"title": "Create new user",
"schemaUrl": "... Optional URL to JSON schema definition for input ..."
"template": {
"Windows Domain": "acme"
}
}
}
}
The client can GET a resource that include the above action, find it be the name "create-user" and in this way be told which method to use, where to apply it, how the payload should be formated (in this case its JSON as described by an external schema definition) and some default values (the "template" object).
If you need more complex descriptions (like selection lists and validation rules as you mention) then you are on your own and will have to encoded that information in your own data - or use HTML or XForms.
There are multiple ways to do what you want.
You can use GET for /user/new along with a create-form link relation to get a single link. This can in plain HTML or HTML fragment, or a schema description, practically anything you want (the result will be less reusable than the other solutions).
You can use a standard MIME type which supports form descriptions. For example HAL with a form extension or collection+json.
You can use an RDF format, like JSON-LD with a proper vocab like Hydra.
Let's say I have a northwind database and I use ADO.NET Entity Data Model which I automatically generate from the tables in database. Then I add a new WCF data service that inherits from DataService. When I start the web application, that runs the service I can request data like this:
http://machine/Northwind.svc/Orders
This will return all orders from order table in atom/xml format. The problem is I do not want XML. I want JSON. I think I tried all kinds of settings (web.config) and attributes in my application, but I still get XML. No matter what. I can only get JSON, when I use fiddler and change the request header to accept JSON.
I do not like the concept of content negotiation. I want always to return data in JSON format. How can I achieve that?
Keep in mind that I did not create any model objects, they are automatically created based on database tables and relationships.
Well - content negotiation comes with HTTP. In any case, you could intercept the incoming request and add/overwrite the Accept header to always specify the JSON. There's a sample how to support JSONP which uses a similar trick, I think you should be able to modify it to always return JSON as well. http://archive.msdn.microsoft.com/DataServicesJSONP.
The behavior you criticize is defined by specification of OData protocol. OData defaults to Atom and client can control media type of the representation either by Accept HTTP header or by $format parameter in query string (but I'm not sure if WCF Data services already support this).