on 06-24-2011 3:56 PM
Hi all,
anybody knows if exists of has an generic XSLT to transform XML to Json protocol to integrate with mobile devices?
Thanks
A little bit Off Topic... please, excuse me... I have a personal project/idea to create a Custom Adapter Module for JSON integration with PI.
Somebody can be interested to contribute?
It can be usefull regarding Mobile Application integration with Sap XI/PI, rather than develope Custom Handler in Abap.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are open to other types of mapping, you can follow this wiki for XML to JSON transformation using ABAP:
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=163840922
Best Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is possible. If you are looking for XSLT logic to convert xml to json ... Please google there are plenty of good websites.
I believe you are looking for mapping logic to convert xml to json using XSLT mapping.
Here is one good site
http://www.bizcoder.com/index.php/2010/02/12/convert-xml-to-json-using-xslt/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> but how should i implement it in PI?? i cant see the way
Implement XSLT mapping..
Save your XSL file as zip file. In PI create new imported archive and import the zip file. In operation mapping select source and target interfaces and at the mapping program section select type XSL file and look for your XSLT zip file.
Refer this [link |http://www.riyaz.net/blog/xslt-mapping-a-simple-example/technology/sap/808/]also
baskal,
sorry i did not explain propely.
i know how to import a XLS mapping in pi. but the result in this case is not a XML document,so its not clear to me what to define in the operation mapping as target Operation.
is not clear tome how to configure the ID if there is no target service.
do you have any sugguest??
>i need to wrap it in a single string inside a xml field
Yes.
It is fully based on your target side requirement. What I'm saying is send the entire json output as a string element to target system. If the target side supports HTTP then post it to that system using http receiver and let them decide about processing your json output string. Hope you understand.
hi,
i followed you. my doubt is about how to configure PI to send the data to target system.
as i commented you before when configuring the OM, the system request me to define a source operation, target operation and a mapping program
i should send the Json as it is and avoid to send it in a XML file,¿ or is there any standar module that i can implement in the receiver HTTP adapter to transform the XML to plain?
Source Operation: Si_ClientMobileRequest
Mapping: XML2Json.xls
Target Operation: ?????
how should i configure the OM in ESR and how to configure the ID??
is it possible??
Thanks
RP
Edited by: Rodrigo Alejandro Pertierra on Jul 5, 2011 3:18 PM
>my doubt is about how to configure PI to send the data to target system.
You need to talk to target system and see what type of service they support. If they have web based appllication then you can use HTTP adapter in the receiver side.
>how should i configure the OM in ESR and how to configure the ID??
DIscuss with target system... Create XML structure and have a field of type string and fill your entire json output as string value.
example:
<target>
<output> json output here </output>
</target>
Post this data via http adapter to target system. If they support web service , use their web service. Once you created target structure use source and targe in the OM and pick xsl file as mapping.
Hello,
as i commented you before when configuring the OM, the system request me to define a source operation, target operation and a mapping program
Yes, once you create an operation mapping, the operations become mandatory. Actually, it does not matter what you declare in your target operation. Even if you declare a simple type data type -> message type -> target interface, the output of the operation mapping depends on the output of the last mapping program that you have declared in it. As such, the output of the last mapping takes PRECEDENCE in an operation mapping.
take the case of adding a prolog manually via java mapping (for SOAP over HTTP scenarios):
Source XML
<SourceXML>
<Data/>
</SourceXML>
Target XML
<TargetXML />
Java Mapping will convert the source xml into string and add &elements= to the output
So the declaration in the operation mapping would be
SI_OUT_Source (Source XML message type) -> Java Mapping -> SI_IN_Target (Target XML Type)
The output would be
&elements=<SourceXML><Data/></SourceXML>
The output would not be viewable via tree view, only by source view. As you can see, it does not match the declared target XML. Same with your case, this should be okay.
Hope this helps,
Mark
Edited by: Mark Dihiansan on Jul 6, 2011 3:59 AM
hi Mark
so no matter which target SI y define in the OM the result of the last mapping takes precedence and this result is sent to target system?? I was traying to test it but the system was down and still it is.
if this case "doest work" would i be able to use the estandar module xml2plain in a receiver HTTP adapter --> the solution that Baskar suggeuest.
Thanks
Hello,
so no matter which target SI y define in the OM the result of the last mapping takes precedence and this result is sent to target system??
Yup, this is correct.
if this case "doest work" would i be able to use the estandar module xml2plain in a receiver HTTP adapter --> the solution that Baskar suggeuest.
It is not possible to use modules in the Plain HTTP Adapter because it resides on the ABAP stack. To use modules, you can opt for SOAP Adapter with Do Not Use SOAP Enveloped checked. I can't say if the xml2plain would work. Let's wait for other replies.
Hope this helps,
Mark
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.