Maximo Integration: Putting sub-objects in a response to SOAP - response

Need help! I'm having a problem with putting sub-objects in a response from Maximo to SOAP.
for Example, I want my response to look like this:
<mainObject>
<--Imagine mainObject fields here-->
<subObject>
<--Imagine subObject fields here-->
</subObject>
</mainObject>
I can't seem to find any sample from the internet that I can use as a reference.
Can anyone give me some clues/hints?

You can use the method createChildrenData() to create a new sub-object and then add the fields to that. For example:
irData.createChildrenData(subObject)
I had to decompile the StructureObject class to get that method. You'll need to create a new WSDL for this modified response, otherwise the end point won't recognize the new format.

Related

Grails pass object to the view and back again

I have some data that I need to persist through multiple actions within my Grails app. Due to the nature of the data, I would prefer not to store the data in the session. Here is an example of what I would like to do.
class MyController{
def index(){
MyObject object = MyObject.new(params.first, params.second, params.third)
[gspObject:object]
}
def process(){
MyObject object = params.gspObject
//continue from here
}
}
In my GSP if I do
<g:form action="process" params="[gspObject:gspObject]">
Then I get the error
Cannot cast object 'net.package.MyObject#699c14d8' with class 'java.lang.String' to class 'net.package.MyObject'
My question is, If I want to get the object back that I sent to the gsp, how can I get that? Is there some kind of scope that I can save the object in that would be a little safer then session? Is there a way to pass the object into the page itself and pass it back in the next request?
Grails has many layers, but at the bottom you have plain old HTTP just like in any web app. It's a stateless protocol, and you send a text or binary response, and receive text or text + binary requests. But you can't expect to be able to send an arbitrary object to a web browser in HTML and receive it back again in the same state as when you sent it - where is this Java/Groovy JVM object going to be stored in the browser?
You have basically two options. One is to store it at the server, which is less work because it remains as the same object the whole time. The session is a good location because it's coupled to the user, is created on-demand and can automatically time out and be removed, etc. The other is to do what you're trying to do - send it to the client and receive it back - but you are going to have to serialize it from an object (which could be a complex object containing arbitrarily many other objects) and deserialize it from the format you used on the client back into Java/Groovy objects.
JSON is a good option for serialization/marshalling. You could store the stringified object in a hidden form element if your page uses a form, or in a querystring arg if you click a link from this page to the next in the workflow. Don't send all of the object's data though, only what you need to rebuild it. Anything that's available in the database should be referenced by id and reloaded.
Something like
[gspObject: object as JSON]
or
[gspObject: [first: object.first, first: object.firstsecond, ...] as JSON]
will get it in the correct format for sending, and then you can parse the JSON from the request to reinstantiate the instance.

How to manually get/set object model from AngularDart component?

Angular manages our objects somewhere in the Scope, but I need to manually set and get the object that controls a component so I can automatically set all the component's info once I download its model from the web through JSON.
Example
#Component (selector: 'my-component')
class MyComponent {
//component fields
}
As the user interacts with <my-component> it changes its fields. I want to be able to get the whole MyComponent object with its fields to save them like this
MyComponent comp = magicComponentGetterFunc('my-component');
String json = encodeJson (comp); //I do this this redstone_mapper
I think ngProbe can do that.
ElementProbe ep = ngProbe('my-component');
You can can find examples by visiting the links at https://pub.dartlang.org/packages/angular where ngProbe or ElementProbe is mentioned.
The CHANGELOG.md mentions that ngProbe is necessary for animation but the codedoc on the ElementProbe class still states that it is for testing and debugging (see https://github.com/angular/angular.dart/blob/96c0bcc7b6b0c3501b2c4799f425de8cd2e4dc0c/lib/core_dom/view_factory.dart#L259)
To get the JSON you either have to implement a getter/method (for example toJson) that returns the JSON you want or use some of the available serialization solutions (see State of Serialization and Deserialization of JSON in Dart).
If you want to do that this usually indicates that your approach works against the way Angular should be used.

How to convert JS array to JSON, before passing that to controller (using AJAX - POST call)

I ve a JS array, comprising multiple JS objects.
I want to convert JS array to JSON type, & pass that to controller (using AJAX - POST call).
So that I can retrieve the values from the Array of Objects, in my controller & save them in DB.
NB: I ve tried using $.stringify(myArry), but its not able to send data to controller in JSON format. Also I cant use $.toJSON(myArray), as I m not allowed to include a new plugin in our solution. :(
Plz suggest me any other idea.
Else if anyone can let me know how to deserelize the array in cotroller, that I ve sent by using $.stringify(myArry), that would also great.
Something like
var result = JavaScriptConvert.DeserializeObject(inputContent, JsonDataType);
Per this post, it looks like you'll have to add another plug-in:
JSON stringify missing from jQuery 1.4.1?
The Google solution looks good: http://code.google.com/p/jquery-json/
Or just use the JSON object from Crockford: https://github.com/douglascrockford/JSON-js

Translating javascript json parse to rails

I had to change an application that was making a call clientside (JS) to get back data that comes back as JSON. I had to move the call server side, and I'm using rails to return the data.
To reference the object I need, with the object being returned called "data" I was able to call it JS like so:
data.photos[0].tags[0].mouth_left.x
I'm very new to rails, I have the call populating a variable called face_values, I think I should call to_json on it next, but how do I reference the arrays and nested objects within?
Even a point in the right direction would be great, thank you.
parsing JSON in Rails is as follows:
parsed_json = ActiveSupport::JSON.decode(your_json_string)
or check out this link
They claim they are 21.5x faster than ActiveSupport::JSON.decode

BizTalk 2010: Access Context In Map

This could be a very basic question, but hopefully someone will be able to answer it.
I am receiving messages (HL7) using a custom receive pipeline. Inside my custom pipeline, I am promoting properties into the context. I have set up a map where I need to access these properties. However, I would like to access these properties on the send side. The reason why it needs to be on the send side is because I am attaching my map to the send port, so I assume that the message will have already hit the MessageBox and will be mapped on the send side. Hopefully that makes sense...
I know that there are a few 3rd party tools I can use, but I was hoping that there's a simple functoid, or some code I can enter in a scripting functoid that will access the context for me.
Would someone be able to point me in the right direction with this?
There is, indeed a C# functoid that allows access to context properties but it seems to only work with maps on a Receive Port or inside an Orchestration.
You can use the Context Accessor Functiod to do this... Combine it's pipeline component with yours and it should work... Beware it should be handled within the same thread...
http://contextaccessor.codeplex.com/
I don't know if this is possible. However, I had a similar requirement to access message context properties and I was able to populate a message with the context properties in an orchestration thanks to
Greg.Forsythe's excellent instructions
I had a similar situation to access the context properties to get the filename property in the my map. I did the below steps without using any external functoids. Hope this helps someone
Steps:
create a new schema say "FileSchema"
FileNode(rootNode)
-FileName (fieldElement)
Click the schema and in the properties target namespace - clear the namespace.
make the FileName property distinguished. Rt.Click FileName and show promotions and add FileName to Distinguished property tab.
In your target schema, add the field FileName. for me I added it to a SQL schema, since I need the filename for every row in the database
In your orchestration, use the message assignment shape and type the below
// create a variable varFileXML of type System.XML.XMLDocument
// I'm creating a xml same like the file schema and loading that to the XML variable and then assigning that to the Message of type FileSchema
varFileXML = new System.Xml.XmlDocument();
varFileXML.LoadXml("<FileNode><FileName>FileName_0</FileName></FileNode>");
Msg_FileSchema = varFileXML;
//Get the FileName to a variable of string type
varFileName = Msg_FlatFileSchema(FILE.ReceivedFileName);
varFileName = System.IO.Path.GetFileName(varFileName);
//Access the filename property from the message and assign the variable to that
Msg_File.FileName = varFileName;
Now that we got the FileName in to the message you can use that in mapping to your target schema
I used a transform shape to create a new inline map with source as your target schema and fileschema together and the destination as the target schema.I mapped the filename from the fileschema to my target schema the filename property
this is one of the many ways to get the context property. Hope it helps
thanks & regards
Silam

Resources