[OSB] xml to json

Hi all,
we need to transform xml into json and as far as we know josn is not supported directly in OSB.
We found in http://www.bramstein.com/projects/xsltjson/ a stylesheet to transform XML to JSON but when we try to import that XSLT into OSB 10.3.1 we got an error ...
Do you know/recommend any other XSLT/Xquery tranformation for converting xml into json ?
Thanks and regards
ferp

Hi all,
found also http://www.bjelic.net/2012/08/01/coding/convert-xml-to-json-using-xslt/ and now the xlst is imported into OSB.
When we tested directly via test console the xlst, it works ... but when we invokei through the pipeline we don't get any result:
Assign [ Xslt Resource: xml_to_json_prj/xmlToJson
Input Document: $body/*
Variable Names And Bindings:
to [ result ]
... we are trying to understand where is the problem ....
Thanks and regards
ferp

Similar Messages

  • Rest method that can support request/responce in both xml and json formats

    Hi,
    I want  to create rest method that can support request/responce in both xml and json formats.
    I am trying in bellow way, but its not working getting error.
    any idea on this?
    Code in IService.cs :
    [OperationContract]       
    [WebGet(UriTemplate = "/Login/{UserID}/{Password}")]
    Responce Login(string UserID, string Password);
    Code in Service.cs :
    public Responce Login(string UserID, string Password)
                try
                    objResponce = new Responce();
                    objResponce.MessageType = Responce.ResponceType.Warning.ToString();
                    string Con = GetConnectionString(UserID, Password);  //Method to check valid user or not
                    if (Con.Trim().Length != 0)            
                        objResponce.Message = "you have logged in Successfully";                   
                    else
                        objResponce.Message = "Please Enter Valid UserID,Password";                
                catch (Exception ex)
                    through ex;             
                return objResponce;
    My Config settings :
    <services>
          <service name="OnePointAPI.OnePointAPIService">
               <endpoint address="JSON" binding="webHttpBinding" contract="OnePointAPI.IOnePointAPIService" behaviorConfiguration="webJSON" ></endpoint>
               <endpoint address="XML" binding="basicHttpBinding" contract="OnePointAPI.IOnePointAPIService" behaviorConfiguration="webXML" ></endpoint>     
          </service>   
     </services>
     <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="webJSON">
              <webHttp defaultOutgoingResponseFormat="Json"/>
            </behavior>
            <behavior name="webXML">
              <webHttp defaultOutgoingResponseFormat="Xml" />
            </behavior>
          </endpointBehaviors>
     </behaviors>  
    Anwar Shaik

    In several days (in the 19th) i will lecture at
    SQLSaturday #360 and my last demo (hopefully I will have the time) is
    Full implementation of JSON, I will show several function using JSON serializer and deserializer, and as mentioned full implementation including fast
    indexes on JSON column (finding specific Node in 10 million rows
    in less then a second). If you want to wait, then I will publish it latter probably, or you can come the lecture if you want :-)
    * I am using Json.NET framework, by the way.
    regarding your question, all you need is to find a nice serializer/deserializer framework (you can use
    Json.NET framework) in order to do what you are looking for (if I understand what you asked)
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Convert XML to JSON format

    Hi all,
    I need to do a POC on converting XML format to JSON format,i found that there is rest adapter which we can achieve this  ,
    but i couldn't find the adapter in the list of adapters ,how to download this adapter from sap market place and also is there any alternative way of achieving this.

    Hi Vidya Sagar,
    REST Adapter is not available for free like SOAP, FTP, SFTP etc Adapters. You need to purchase it from third party vendors like Advantco. You can visit the link below for more information:
    REST Adapter for SAP NW PI | Advantco SAP NetWeaver Solutions
    https://www.advantco.com/misc/Gateway%20or%20Progress%20Integration.pdf
    Alternate way to convert XML to JSON and viceversa is use of open source technology - Apache Camel. You can download the Apache Camel from the link below:
    Apache Camel: Camel 2.13.2 Release
    Also you can refer to tutorials and examples available on the site - Apache Camel: Tutorials for the implementation.
    Regards,
    Shreyansh Shah

  • OSB XML to Flat file(write)- MFL?

    Hi,
    OSB 11G
    I will be invoking the db to get XML data and I have to write to a text file(pipe delimiter).
    I saw below forum, but I am not sure how to create MFL .Can you anyone pls mention the steps. (MFL ->XML to flat file )
    Do I have import xsd in Native Builder and convert to a flat file with pipe delimiter ?
    How to write a CSV file in OSB
    Thanks
    Edited by: soauser on Jul 7, 2011 8:07 PM

    truth must be said, MFL is very sensitive to input data, any deviation from the contract is punished with a NullPointerException, especially when the input is in binary format. One would expect a better error message, but what can we do.
    Make sure your input data complies with the Schema, for instance do a xsd validation...

  • Generate a Shared Component LIST in XML or JSON format

    Greetings...
    I am using the LIST functionality within the Shared Component area of our application in order to maintain a menu/navigation list. I'm utilizing all of the features of the LIST Shared Component -- links, authorizations, conditions, comments, etc. This list will appear on every page, so I'm putting it on page zero.
    I'd like to get this list in an XML, JSON, or some format so I can manipulate it in javascript to display it. I guess another way to put it is that the template options for a LIST template seem to be very detailed and specific (which is great in general) and I am looking to just get the data out and display it myself.
    I can easily enough write a SQL query to produce the hierarchy proper hierarchy of the list, but I would be circumventing the method ApEx uses to implement all of the conditions and authorizations on the entries. I see there are APIs for both generating the list and also checking conditions, but neither of them are accessible to my custom schema and I wasn't sure if I should even attempt to reproduce them.
    Basically, I'd like to use the built-in functionality of the LIST Shared Component, but use my own display methods.
    Shane.

    http://htmldb.oracle.com/pls/otn/f?p=20297:14

  • Need to parse xml or json file but am not a programmer

    My VPN provider has an api I can use to download the current servers in xml or in json format. I want to parse it and have it show me the top 3 servers based on the current load but after googling linux xml parser tutorial I found the format of the xml file I have is very different than what is expected. Here is a sample.
    <?xml version='1.0' standalone='yes'?>
    <status result="ok">
    <servers>
    <servers public_name="Acamar" country_name="United States" country_code="us" location="Miami" continent="America" bw="47" bw_max="1000" users="57" currentload="4" />
    <servers public_name="Acrux" country_name="Netherlands" country_code="nl" location="Amsterdam" continent="Europe" bw="25" bw_max="1000" users="20" currentload="2" />
    <servers public_name="Acubens" country_name="Sweden" country_code="se" location="Uppsala" continent="Europe" bw="121" bw_max="1000" users="64" currentload="12" />
    <servers public_name="Alhena" country_name="Canada" country_code="ca" location="Toronto, Ontario" continent="America" bw="269" bw_max="1000" users="84" currentload="26" />
    <servers public_name="Alkaid" country_name="United States" country_code="us" location="Chicago, Illinois" continent="America" bw="210" bw_max="1000" users="88" currentload="21" />
    </servers>
    </status>
    The tutorials I found expect these things like "public_name" and "bw" to be inside their own entries like <public_name>Acamar</public_name>. Can someone recommend a good tool that doesn't need me to know perl or python I can use to: pull out all servers in Canada with bw_max of 1000 for example?
    Last edited by maggie (2015-05-30 11:49:45)

    @maggie: That is easily done with XPath expressions, for example:
    xmlstarlet sel -t -m '//servers[@country_code="us"]' -c '.' -n vpn.xml
    xmlstarlet sel -T -t -m '//servers[@country_code="us"]' -v @public_name -o " " -v @bw -n vpn.xml
    xmlstarlet sel -t -m '//servers[@country_code="us"]' -v '@public_name' -o ": " -v '@currentload' -n vpn.xml
    xmlstarlet sel -t -m '//servers[@country_code="us" and @currentload<15]' -v '@public_name' -o ": " -v '@currentload' -n vpn.xml
    xmlstarlet sel -t -m '//servers[@currentload<15]' -v '@public_name' -o ": " -v '@currentload' -n vpn.xml
    http://www.w3schools.com/xpath/default.asp
    Edit: If you use json and jshon, then you'll have to do the sorting and filtering in the shell
    jshon -e servers -a -e country_code -u -p -e public_name -u -p -e bw -u <vpn.json | {
    # filter country_code
    while read -r country_code && read -r public_name && read -r bw; do
    [ x"$country_code" = x"ca" ] && echo "$public_name $bw";
    done
    } | sort -k2,2nr -k1,1d # sort second field (bw) numeric reverse, if equal use dictionary sort on first (name)
    Last edited by progandy (2015-05-31 05:47:50)

  • Provide XML or json format API

    I love Curah!, it's simple and clean service. Wouldn't it be great if it serve curated contents with json or xml format? I want to display my contents via my Windows Store App.

    Can you tell us a little more about how you would use a Curah! API?  Is the goal to display your own curations in a Windows Store App?  If so, would a curator-specific RSS feed meet your needs?  Or are you interested in other use cases too?
    Sorry for the late reply.
    It would be great to have REST interface not only fetching list of articles but also submitting new items. I'm building statistics learning app, so if Curah provides REST interface, I can mix and personalize contents list with
    YouTube video link, Wikipedia articles, etc in order to share to my colleagues.

  • OSB with Rest JSON webservice

    Hi, I am new to OSB and working on making OSB as a pass thru for RestFul JSON webservices. I am able to get JSON response back in case of GET request however for POST request I am getting this error:
    <con:fault
    xmlns:con="http://www.bea.com/wli/sb/context">
    <con:errorCode>BEA-380000</con:errorCode>
    <con:reason>Unsupported Media Type</con:reason>
    <con:location>
    <con:node>AegisRouteNode</con:node>
    <con:path>response-pipeline</con:path>
    </con:location>
    </con:fault>
    I have used transport header in response action to convert content type to application/json. I am not sure why it works perfectly for GET request but fails for POST.
    I appreciate any help that can be provided. Thanks.

    > I have used transport header in response action to convert content type to application/json
    Why in response? o_O
    My understanding of what is happening is that the remote server rejects your POST with HTTP 415. I.e. you need to set the Content-Type transport header in request pipeline.
    For GET though the server may just ignore the Content-Type header or lack thereof, and that's why it may work.
    Try to point your call via Fiddler to see the actual HTTP request and response, it should give you the idea what's going on.
    Vlad
    http://vladimirdyuzhev.com

  • Autosuggest:  XML and JSON datasets treated differently

    Not sure if I found a bug or not, but I found something kinda
    odd with Autosuggest and XML data vs. JSON data.
    Check this url:
    http://www.christopherchin.com/sandbox/testSpry.html
    The first input box is XML data the second input is JSON.
    When you type Christopher in both fields, you get a list of
    people named christopher.
    Now type a space and the first letter of the last name of one
    of the Chris'.
    XML works. JSON doesn't.
    Thoughts?
    Thanks!
    Chris

    Look at your JSON output, it has 2 spaces between the first
    name and last name for some of your entries, but only in your JSON
    output, not your XML output.
    If you fix your JSON ouput so it matches the XML output, I'll
    bet it works.
    --== Kin ==--

  • JSON in OSB

    Dear All,
    I am trying to implement OSB service where is accepts JSON input and provides the output in the same format. Any pointers to this would be helpful.
    I tried converting JSON to xml using JSON lib but however failed to do so.
    TIA.
    Regards,
    Mithun S.

    Well thanks all for the inputs.
    Tried doing things like JSON to xml formats and failed to get the output.
    I have an API for Google geocode http://maps.googleapis.com/maps/api/geocode/json? which i am trying to hit via Biz service.
    It's not any kind of Web-Service hence getting no results but errors.
    Any suggestion, how can i use the above API to get an output in OSB.
    Like adding the required address to the API gives me the desired output as in the link below
    http://maps.googleapis.com/maps/api/geocode/json?address=Harrow%20HA2%200ET&sensor=false
    TIA.

  • Desktop app, getting a search result as XML/JSON from any website. How?

    Heya!
    I have a java program that im fiddling with whenever im bored. It's purpose is basically for me to learn new things and possibly make a nifty piece of software for me and my friends.
    Say, I have a list of entries (movies). Each entry has an iMDB link. What i would like to do is to be able to click a button and get a new window (perhaps, i haven't designed this bit yet) with information imported directly from iMDB.
    An approach I came up with is this: When you type something in iMDB's search field, you get a page with results. Is there any way to grab that result internally in my desktop app as XML or JSON perhaps, and parse that info and populate some text fields/areas with that parsed info?
    Reason why I ask this is because i have no clue about that "section" of Java (I've got quite basic desktop skills, but nearly none with networking/web and media). Are there any default libs in Java that have functionality that might be useful to me? I'd appreciate a poke in the right direction :)
    edit: hmmmm i've found some pointers in http://forums.sun.com/thread.jspa?threadID=5407197&start=0&tstart=0 and it seems like I have to use the text files provided by iMDB since i am to use this for non-commercial purposes. Delete this thread as I should've done much better research before I made this one. My appologies.
    Edited by: Ojive on Oct 4, 2009 5:27 PM

    edit: I see you have recanted this question. Never mind then.

  • Is it possible to create an Apple Script to import data from a web data feed (RESTful XML/JSON)?

    Before I get started looking for a programmer, does anyone know if it will be possible to create a script that will allow Numbers to connect to an external data feed in either XML or JSON? I want to enable some colleagues who use Mac to connect to the same data feed that Excel for Office connects to.. Thanks,

    It is definitely not hard to import XML or JSON data via an AppleScript. As an amateur tinkerer, I found a way, for example, to bring in OFX data from my bank (OFX is a flavor of XML) using the XML parser built into System Events, which is AppleScriptable.
    How satisfied your colleagues would be with the solution, though, will depend on what you mean by "connect to an external data feed." If you are dealing with datasets in the thousands of rows and need frequent and rapid response, then you may not be happy. In that kind of situation you would need to expect at least a few seconds of wait time every time you "refresh."
    If, as in my case, you have only a few hundred rows and don't need to bring the data in every few seconds, then the AppleScript solution is very practical. The programmer could probably goose the performance and make the job easier by using AppleScript as a wrapper for a script in Python or another language that is faster than AppleScript at parsing XML and JSON.
    SG

  • Unable to parse the OData service in JSON

    Hi,
    Need to parse the OData Service in JSON format.Able to successfully get Service and MetaData documents. After that, when try to parse OData service returning response in JSON.
    Below  code is throwing exception.
    Server Used:SMP3.0
    ODATA SDK Used:SMP3.0 ODATA SDK
    Service Used: http://services.odata.org/v2/Odata/Odata.svc/Products?$format=json
    Code Snippet:
       @try {
          ODataCollection *collc = [[self.serviceDocument getSchema] getCollectionByName:_srvcInfo.serviceEntityName];
          ODataEntitySchema *schema = [collc getEntitySchema];
          //Instantiate parser for Carrier entity
         ODataDataParser *dataParser=[[ODataDataParser alloc] initWithEntitySchema:schemaandServiceDocument:self.serviceDocument];
          //Parses a feed or an entry xml or json
          [dataParser parse:entriesData];
          results = dataParser.entries;
      @catch(NSException *e) {
          NSLog(@"Exception:%@, %@", e.description, e.debugDescription);
    Exception:
    -[__NSCFArray objectForKey:]: unrecognized selector sent to instance
    However Service Used:http://services.odata.org/V3/Northwind/Northwind.svc/Products?$format=json. Not
    throwing any exception, but dataParser.entries is returning 0 objects
    Please let us know, is the same API is used for parsing JSON.
    What can be the reason of issue and what are possible resolution.
    Thanks,
    Parveen.

    My expert area is not IOS but you can check this IOS Odata development tutorial that might help you,Getting started with SMP3 Native OData iOS apps
    Midhun VP

  • URL Services Data Control (REST / JSON)

    Hi,
    I am planning to write a PoC of an integration for JIRA in an ADF Application. I am not too expert on REST services but that is what JIRA API gives me, REST API.
    I have been trying to create an URL Services Data Control but I have encounter 2 problems;
    - Since I need to use 11g R1 I can't choose the HTTP type request so I just have read access through GET request. If I am not mistaken, 11g R2 allows you the possibility to chose GET,POST,DELETE etc.
    - Under the assumption that OK, I am OK just working with GET action, the REST service response comes as JSON so I don't know exactly if its worth to use the URL Data Control at this point since once I have created my DC it doesnt have any structure like would normally do.
    My questions;
    In this blog by Frank Nimphius https://blogs.oracle.com/jdevotnharvest/entry/which_option_to_choose_for he says
    Note: In the above, I exclude REST services in my recommendation because this is what ADF will
    address much better using the URL data control in JDeveloper 11g R2 (available) and with improved functionality
    in the upcoming Oracle JDeveloper 12c release.*.- Is this valid for XML and JSON responses or just for XML responses?
    *.- Do I need to create an XSD file myself in order to get a better DC objects?
    *.- Finally, what is the best approach since I am confused about all information on internet.
    Thanks
    p.s: I am using 11.1.1.6

    If you are stuck on 11.1.1.6 then you can just write simple POJOs that access the REST services and then expose those services as data controls for ADF.
    If you can upgrade to 11.1.2.3 then you'll be able to fully leverage the REST data control - the basic steps are here:
    https://blogs.oracle.com/adf/entry/exposing_multiple_methods_under_one

  • Brief explaination of REST,Webservices,CSON and JSON

    brief explaination of REST,Webservices,CSON and JSON

    http://www.simplecodestuffs.com/what-is-the-difference-between-http-and-rest-and-soap-in-web-services/
    SOAP uses WSDL for communication between consumer and provider, whereas REST just uses XML or JSON to send and receive data
    WSDL Defines contract between client and service and is static by its nature. In case of REST contract is somewhat complicated and is defined by HTTP, URI, Media Formats and Application Specific Coordination
    Protocol. It’s highly dynamic unlike WSDL.
    SOAP doesn’t return human readable result, while REST result is readable with is just plain XML or JSON
    This is not true. Plain XML or JSON are not RESTful at all. None of them define any controls(i.e. links and link relations, method information, encoding information etc…) which is against REST as far as messages must be self contained and coordinate interaction
    between agent/client and service.
    With links + semantic link relations clients should be able to determine what is next interaction step and follow these links and continue communication with service.
    It is not necessary that messages be human readable, it’s possible to use cryptic format and build perfectly valid REST applications. It doesn’t matter whether message is human readable or not.
    Thus, plain XML(application/xml) or JSON(application/json) are not sufficient formats for building REST applications. It’s always reasonable to use subset of these generic media types which have strong semantic meaning and offer enough control information(links
    etc…) to coordinate interactions between client and server.
    REST is over only HTTP. HTTP is most widely used and when we talk about REST web services we just assume HTTP. HTTP defines interface with it’s methods(GET, POST, PUT, DELETE, PATCH etc) and various headers
    which can be used uniformly for interacting with resources. This uniformity can be achieved with other protocols as well.
    REST permits many different data formats where as SOAP only permits XML.
    While this may seem like it adds complexity to REST because you need to handle multiple formats, in my experience it has actually been quite beneficial. JSON usually is a better fit for data and parses much faster. REST allows better support for browser clients
    due to it’€™s support for JSON.
    If this helped you resolve your issue, please mark it Answered

Maybe you are looking for