XML in JSON in OSB REST

Hi guys!

I have problems of risk of transmitting an XML in JSON to my PROXY REST. The rest PROXY my OSB is the proxy for my SOAP REST. Useful load demand shoul look like this:

{

"login": "jstein."

"identityContext": "jazn.com",

"taskId": "string",.

'payload': {}

'any_0': {}

'any_01': ' < afastamento xmlns:ns1 ='http: / / www.tjsc.jus.br/soa/schemas/comagis/AfastamentoMagistrado' xsi: type ='def: AfastamentoMagistradoType' xmlns: xsi = "http: / / www.w3.org/2001/XMLSchema-instance' xmlns =" http: / / xmlns.oracle.com/bpel/workflow/task ">" ".

< ns1:Magistrado > 719 < / ns1:Magistrado >

< ns1:Status > start < / ns1:Status >

< ns1:Vaga > 8770 < / ns1:Vaga >

licença Nojo < ns1:Tipo > < / ns1:Tipo >

< ns1:PeriodoReferencia / >

< ns1:DataInicialSolicitada > 2015 - 10 - 10 < / ns1:DataInicialSolicitada >

< ns1:DataFinalSolicitada > 2015 - 11 - 05 < / ns1:DataFinalSolicitada >

"< / afastamento >.

}

},

'result': 'start '.

}

I try XML escaped too:

{

"login": "jstein."

"identityContext": "jazn.com",

"taskId": "string",.

'payload': {}

'any_0': {}

"any_01" : "& lt;" afastamentoMagistrado xmlns = & quot; ' http://xmlns.oracle.com/bpel/workflow/task ' xmlns:ns7 = & quot; ' http://www.tjsc.jus.br/soa/schemas/messages/StatusProcessamento ' xmlns:NS6 = & quot; ' http://www.tjsc.jus.br/soa/wsdl/utilitario/TaskListService ' xmlns:ns5 = & quot; ' http://xmlns.oracle.com/bpel/workflow/taskQueryService/schema ' xmlns:TNS = & quot; ' http://www.tjsc.jus.br/soa/schemas/services/utilitario/TaskListService ' xmlns:AfA = & quot; ' http://www.tjsc.jus.br/soa/schemas/comagis/AfastamentoMagistrado ' xmlns:Mag = & quot; http://www.tjsc.jus.br/soa/schemas/comagis/Magistrado "> \n "

& lt; AfA: Magistrado & gt; \n

& lt; Mag: Matricula & gt; 719 & lt; / mag: Matricula & gt; \n

& lt; / afa: Magistrado & gt; \n

& lt; AfA: Type & gt; Afastamento course para & lt; / afa: Type & gt; \n

& lt; AfA: Status & gt; K & lt; / afa: Status & gt; \n

& lt; AfA: StatusPublicacao & gt; Aguardando Portaria & lt; / afa: StatusPublicacao & gt; \n

& lt; AfA: DataInicialSolicitada & gt; 2021 12-31 & lt; / afa: DataInicialSolicitada & gt; \n

& lt; AfA: DataFinalSolicitada & gt; 2022 01-03 & lt; / afa: DataFinalSolicitada & gt; \n

& lt; / afastamentoMagistrado & gt; \n ".

}

},

'result': 'start '.

}

But I get the following error message:

"errorMessage": "ORABPEL-15235\n\nTranslation failure. \nFailed JSON to XML translation. org.codehaus.jackson.JsonParseException: Illegal side character (CTRL-CHAR, code 10)): must be escaped using the backslash to appear in the string value\n to [Source: java.io.BufferedReader@7db921c7; line: column 7,: 619] incoming data \nThe are not conform to the schema NXSD. Please correct the problem. \n ".



I find my way...

I used XML escaped without newlines. so, my request packet will be sent as follows:

{

"login": "jstein."

"identityContext": "jazn.com",

"taskId": "string",.

'payload': {}

'any_0': {}

'any_01': "" < afastamentoMagistrado xmlns = ""http://xmlns.oracle.com/bpel/workflow/task ""xmlns:ns7 = ""http://www.tjsc.jus.br/soa/schemas/messages/StatusProcessamento "" xmlns:ns6 = ""http://www.tjsc.jus.br/soa/wsdl/utilitario/TaskListService ""xmlns:ns5 = ""http://xmlns.oracle.com/bpel/workflow/taskQueryService/schema ""xmlns:tns = ""http://www.tjsc.jus.br/soa/schemas/services/utilitario/TaskListService ""xmlns:afa = ""http://www.tjsc.jus.br/soa/schemas/comagis/AfastamentoMagistrado "" xmlns:mag = "http://www.tjsc.jus.br/soa/schemas/comagis/Magistrado" > < afa ": Magistrado > < mag: Matricula > 719 < / mag: Matricula > < / afa: Magistrado > < afa: Tipo > course para Afastamento < / afa: Tipo > < afa: Status > dinna < / afa: Status > < afa: StatusPublicacao > Aguardando Portaria < / afa: StatusPublicacao > < afa: DataInicialSolicitada > 2021 - 12 - 31 < / afa: DataInicialSolicitada > < afa: DataFinalSolicitada > 2022 - 01 - 03 < / afa: DataFinalSolicitada > < / afastamentoMagistrado > \n"

}

},

'result': 'start '.

}

I was inside my pipeline operation, create a component of 'Replace' with the inlinedXML function to translate the content of any_01 for escaped XML objects change... Put an end to its work for me...

Thank you guys.

Tags: Fusion Middleware

Similar Questions

  • How to convert XMl to JSON object in jsx?

    Is anyone know how can I convert an xml file to the json object. any help or any jsx library that can help please let me know if possible?

    Thank you

    Upendra

    I was able to create this script with your help, which is a generic XML to JSON converter xml obj passes just in the service.
    Thanks for your suggestion Silly-V

    function xmlToJson(xml) {
      // Create the return object
      var obj = {};
      if (xml.nodeKind() == "element") {
      if (xml.attributes().length() > 0) {
      for (var j = 0; j < xml.attributes().length(); j++) {
      var attributeName = xml.attributes()[j].name();
      obj[attributeName] = String(xml.attributes()[j]);
      }
      }
      } else if (xml.nodeKind() == "text") {
      obj['text'] = xml.text();
      }
      if (xml.children()) {
      for (var i = 0; i < xml.children().length(); i++) {
      var item = xml.child(i);
      if (xml.children()[i].nodeKind() == "text") {
      obj['text'] = xml.children()[i].toString();
      } else {
      var nodeName = item.name();
      if (typeof(obj[nodeName]) == "undefined") {
      obj[nodeName] = xmlToJson(item);
      } else {
      if (typeof(obj[nodeName].push) == "undefined") {
      var old = obj[nodeName];
      obj[nodeName] = [];
      obj[nodeName].push(old);
      }
      obj[nodeName].push(xmlToJson(item));
      }
      }
      }
      }
      return obj;
    };
    

    Thank you

    Upendra Stifler

  • How to convert xml to json in as2 object data

    Hi all

    Please let me know how I can convert the XML in json object. I have a lot of research, but did not find any solution. Please help me please guys.

    Thank you

    Shyam vir

    create a swf main as3 to load your as2 project and an as3 swf that converts your xml in json file.

  • Read the value of XML or JSON based on the name of the key

    I can't figure out how to get the value of the url to Image_Calendar1 JSON or XML data.  Sorry if it's 'obvious', but I am a new developer.

    I was cheating and ListItemData.value [1] .url but in this case, that the XML feed changes the number values of the moments which throws out of my method.  I need to be able to get the value based on the name of the key.  Is this possible?

    Thank you. Examples of the XML and the JSON /port.

    Okay, it might not be pretty, but what I do to solve my problem is to convert the ListItemData in JSON and stringify it.  I then split the string with 'key' and then count the lines.  Would not work if 'key' wasn't in each line, or if there are child elements of the child elements.  But... it works for me at the moment.  Future, me I hope, will be more intelligent and can fix it when it breaks.

    var testString = String (JSON.stringify (ListItemData))

    var javascriptcount = String (testString.split("key").length - 1).

    Console.log ("try to use the length:" + javascriptcount)

  • How to parse JSON data using REST POST format

    I was able to create service for REST and the GET operations.

    Using what I know I can pass variables to the Manager but I would like to know if someone can give an overview by creating REST and POST and process json data.

    Thank you

    You can use the following documents to understand how to create GET and POST REST of service operations. There are examples and step by step instructions.

    E - IB: how to create and access a simple REST based Web Services? (Doc ID 1454887.1)

    E - IB: example for PeopleSoft REST provider service (GET/POST methods) (Doc ID 1533318.1)

    In regards to JSON, you can use Documents to represent the message in JSON format. You can also access/parse JSON data using the Document definition.

    Management of Documents in JSON format

    Thank you!

  • Need to replace a XML tag request in OSB

    I have my proxy in OSB service connected to MQ as the supplier of inputs. Now, I want to take a couple of namespaces and copy them into the body and remove the labels.

    Here is the entrance to MQ...

    -------------------------------------------------------------------------------------------------------------------------------------
    < soapenv:Envelope xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns: v = "http://www.w3.org/1999/XSL/Transform" >

    < soapenv:Header / >

    < soapenv:Body >

    < v: createAccount >

    < partId > Mnhtd_21 < / partId >

    < / v: createAccount >

    < / soapenv:Body >

    < / soapenv:Envelope >
    -------------------------------------------------------------------------------------------------------------------------------------
    I want this xml request to be converted in the following xml code before it can be routed to business...
    -------------------------------------------------------------------------------------------------------------------------------------

    < v: createAccount xmlns: v = "http://www.w3.org/1999/XSL/Transform" >

    < partId > Mnhtd_21 < / partId >

    < / v: createAccount >
    -------------------------------------------------------------------------------------------------------------------------------------

    How can I convert in the stream of messages of the Proxy Service?

    Help, please.

    Thanks in advance!

    Published by: 994962 on March 20, 2013 12:10 AM

    Hello

    Have you managed to make it work?

    Kind regards
    Fabio Douek

  • remove the xml namespace tag in OSB

    OSB
    -----
    In the Proxy Service:
    Once I get the response of Business Service 1, I have to send requests to Business Service 2.

    Business Service 1 xml response is < Reference > 123 < / reference >

    Business Service 2 xml query must be < > 123 ReferenceId < / ReferenceId >

    Now, in my Proxy I used assign to the variable "refreq" and then in entitled (Xquery/xslt), I wrote

    * < ReferenceId > {$webservices / / reference} < / ReferenceId > *.

    webserviceres is the response Variable for ServiceCallout Document (that I used for Business Service 1).

    Then, I used ServiceCallout to 2/Service of the company operation.


    It is request to BS2 is sent as below.
    < ReferenceId >
    < reference xmlns:S = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns2="xmlns.oracle.com/xyz/XyzService/" > 123 < / reference > "
    < / ReferenceId >

    I want to just send as < > 123 ReferenceId < / ReferenceId >

    Use the full path instead of / / and data()

    {data($webservices//Reference)}

  • JSON REST API format

    Hi all

    I want to read a specific attribute of my assets using the REST API and I would like this information in JSON, but I don't know how to do to get the attribute first, I used http://localhost:9080 / cs/REST/sites/mysite/types/BasicContent_C/assets/1374098078620 / , but the API returns the entire RESOURCE as XML, is it possible to return a single attribute? and it is possible to return this information in JSON format? or I need to read the information together and look for the attribute I want show?

    I want to show information about an external jsp page, I mean the other application.

    Best regards.

    Hello rvillamarin,

    I'm sorry but I needed the same two months ago and I have not found the way.

    Answer your questions, in my opinion:

    is it possible to return a single attribute? N ° you must retrieve the whole XML and look for the attribute on it.

    and it is possible to return this information in JSON? No. two options: create a model in WCSites in order to recover the attributes and present a JSON or create an intermediate java class to convert XML to JSON.

    or I need to read the information together and search for the attribute I want to show? So you can not do directly in the call of REST, you need to develop something.

    What we have done is to process the XML once we received in the client.

    It will be useful,

    Gerardo

  • Request API GET: expected XML, but get JSON

    I'm getting started with the API of the NSX and fall on a few surprises.

    A good example is GET /api/1.0/appliance-management/certificatemanager/certificates/nsx

    The 6.1 page reference (nsx_61_api.pdf) 29 shows the response in XML format (the same than any other answer; JSON is not mentioned in the doc):

    < x509Certificates >

    < x509certificate >

    < subjectCn > < / subjectCn >

    < issuerCn > < / issuerCn >

    < version > < / version >

    ...

    But the real answer is JSON:

    {

    certificates: [1]

    0:  {

    subjectCn: "nsx-mgr-250-60 - 30.test.hytrust.com.

    issuerCn: "nsx-mgr-250-60 - 30.test.hytrust.com.

    version: '3 '.

    ...

    Usually, I specify content type in the headers GET (although I tried specifying application/xml, but still had JSON). In other calls, like GET /api/2.0/services/vcconfig, the response is XML...

    I use the Advanced Client REMAINS in Chrome. Here are the headers (clean) out:

    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36 Chrome/40.0.2214.94
    Authorization: basic Bonneau
    Accept: * / *.
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US, en; q = 0.8
    Cookie: XSRF-TOKEN =blah; JSESSIONID =blabla
    and the answer:


    Cache-Control: private

    Expires: Thursday, January 1, 1970 00:00:00 GMT

    Set-Cookie: JSESSIONID = blah; Path = /; Guarantee; HttpOnly

    Content-Type: application/json

    Transfer-Encoding: segmented

    Date: Thu, 12 February 2015 18:53:22 GMT

    Server:


    TL; Dr: How can I specify which of the XML or JSON is returned; or... is there of the updated documents showing what calls return what?

    Just add the header:

    Accept: application/xml

    I just tested and it seems that with this customer REST of Chrome, it is necessary to get the XML response. For example with customer Firefox REMAINS, it is not necessary. Here I make the default XML output.

  • Output of REST

    I'm pretty new to the REST, and I understood how to run a workflow through the REST.  Works very well, but what I'm trying to understand is how to retrieve the results.  I have a workflow that displays all virtual machines in a cluster in an output called vmArray parameter.  I can run the workflow via REST very well.  I can see the State of enforcement, etc.  How to actually get the contents of the variable however?  I couldn't find any example online.  Any help is appreciated.  Thank you

    Mike

    See my article here: http://bit.ly/restvco

    Look in the section: results expected of the POSITION

    The Location header will provide you with the token of workflow. Perform a GET against this url to see the output of your workflow (this should have information similar to what you see when you view a workflow runtime in the customer to vRO... only in XML or JSON according to how you put your headers)

    Hope that helps

  • JSON Date Source

    Hello

    I'm almost done to convert my application to use XML to JSON; the last thing I need to reconfigure is my field of research (which is looking the listView data source).

    In XML, I would fix the query:

    query: "/root/continent"
    

    looking for this file:

    XML

    
        
            
            Brazil vs Croatia
            Thursday 12 June 2014
            17:00PM (Local Time)
            Arena de Sao Paulo
            
        
    
    

    So now, I have converted more of JSON and instead use the title of listItem, I use fixtureInfo just as they were both providing the same information.

    JSON

    [
      {
        "type":"item",
        "id":"1",
        "dateNumber":"12/06/2014",
        "fixtureInfo":"Brazil vs Croatia",
        "dateInfo":"Thursday 12 June 2014",
        "timeInfo":"17:00PM (Local Time)",
        "timestamp":"1402603200000",
        "stadiumInfo":"Arena de Sao Paulo"
      }
    ]
    

    Data source:

    DataSource {
                        id: dataSource1
                        property string sQuery: ""
                        onSQueryChanged: {
                            dataModel1.clear()
                            load()
                        }
                        source: "asset:///JSON/Fixtures.json"
                        type: DataSourceType.Json
                        remote: false
    
                        onDataLoaded: {
                            //create a temporary array tohold the data
                            var tempdata = new Array();
                            for (var i = 0; i < data.length; i ++) {
    
                                tempdata[i] = data[i]
    
                                //this is where we handle the search query
                                if (sQuery == "") {
                                    //if no query is made, we load all the data
                                    dataModel1.insert(tempdata[i])
                                } else {
                                    //if the query matches any part of the country TITLE, we insert that into the list
                                    //we use a regExp to compare the search query to the COUNTRY TITLE (case insenstive)
                                    if (data[i].listItem.title.search(new RegExp(sQuery, "i")) != -1) {
                                        dataModel1.insert(tempdata[i])
    
                                        //Otherwise, we do nothingand donot insert the item
                                    }
    
                                }
    
                            }
    
                            // this if statement below does the same as above,but handles the output if there is only one search result
                            if (tempdata[0] == undefined) {
                                tempdata = data
    
                                if (sQuery == "") {
                                    dataModel1.insert(tempdata)
                                } else {
                                    if (data.listItem.title.search(new RegExp(sQuery, "i")) != -1) {
                                        dataModel1.insert(tempdata)
                                    }
                                }
                            }
                        }
                        onError: {
                            console.log(errorMessage)
                        }
                    }
    

    Therefore, what set that the query - for my data source - so that it will pick up the JSON data as before with XML?

    Thanks in advance.

    Like many I know THAT JSON does not use a query. Check out these https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/working_w... https://developer.BlackBerry.com/native/reference/Cascades/bb__data__jsondataaccess.html

  • EJB + REST WebServices

    Hi all

    I am developing an EJB application and REST to display Web services for client application.

    What I tried and founded:

    Oracle JDeveloper 12 c (12.1.3) tutorials - building and consuming a RESTful Web Service from related database

    Oracle JDeveloper 12 c (12.1.2) tutorials - creating a Web Application using EJB and JPA JavaServer Faces

    http://waslleysouza.com.br/2014/10/RESTful-Web-service-no-JDeveloper-12C/

    Re: The best way to implement Web service in the existing EJB application

    Oracle JDeveloper 12 c (12.1.3) tutorials - web services REST-JSON consuming in Mobile Applications with Oracle Mobile Ap...

    Annotation EJB REST/JSON session...?

    Re: Need DataControl customer who accepts JSON of Service Rest

    These are not quite what I need. There are parts that I use all of them, but at the end, when I test the webService with analizer http it doesn´t work.

    Anyone know a good tutorial, from the beginning (create EJB´s, creation of the webservice_REST) to the end (customer consuming the webservice_REST) without problems?

    Thanks in advance

    https://blogs.Oracle.com/IMC/entry/building_simple_java_ee_rest

  • How to prevent the OSB 11g to change original prefixes xmlns?

    Hello


    Could someone tell me how to prevent the modification of the xml namespace that I have carefully specified in the WSDL and XSD OSB file?

    By example, if I deploy wsdl file beginning with

    <soap:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/"> ...

    Then I get to the BSO for the same wsdl wsdl file is something like

    <WL5G3N0:definitions xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/"/>


    He renames "SOAP" to "WL5G3N0".  This name change similar to most of the other namespace in the WSDL and XSD files xml prefixes.  This OSB causing to use for a purpose limited in our environment.  We simply turn this renaming feature off (or find different technologies of accommodation... ).


    So I hope it's possible to disable and someone knows how, in the community of Oracle users.  Could someone tell me if it is possible and how to disable the prefix renaming in OSB?


    Thank you

    or at least there is no known way to get that off, right?

    I'm not an employee of the Oracle, so I can't say with 100% confidence. I don't know a way, and I'm sure that the path does not exist.

    thinking of using 'engine for stateful service' Oracle SOA for this is very bad...

    It's not so bad. If you do not service calls in the Middle, then BPEL is not to dehydrate State, making it more or less stateless.

    DataContractSerializer seems to be picky and all pending schema corresponding to certain prefix text

    It's weird, but the code generators are a common source of bugs in SOA :-)

    Good luck!

    Vlad @ genericparallel.com

  • How to bind xml or other data to a mobile list in Dreamweaver?

    I'm trying to understand what should be a simple thing in Dreamweaver.

    It is in the use of jquery mobile, how do I join a xml file for items in list of attributes?

    If this is not possible, someone would be able to tell me or direct me to a way to manage data in Dreamweaver for mobile applications. I'm on top, trying to understand all the technology. It seems that HTML5, xml, sqlite, json and all the possibilities. I have a simple database of items maybe 300: a picture and a description. The data will reside and be read on the mobile application client-side.

    I want to read items in a list. Then call to the top of the individual items on a new 'page' based on the selection of the user of the list item. It's so easy to Dashcode Mac. Surely, I must be missing something in Dreamweaver 5.5.

    TIA to anyone who is trying to point me in the right direction.

    Have a look here http://books.google.com.au/books?id=kJ5ZWFZtWFgC&pg=PA113&lpg=PA113&dq=spry+datasets+and+j query + mobile & source = bl & to ots = l8vMEvoRZn & to sig = rZYgQGSdsxX64jCQPnFFqJdMwFg & hl = en & to her = X & ei = xpwPT8 GRIumiiAeztrQK & to sqi = 2 & ved = 0CF4Q6AEwBw #v = onepage & to q = % 20datasets % 20and % 20jquery % 20mobile spry & f = false (apologies for the length of the URL) and here http://foundationphp.com/dwmobile/

    GRAMPS

  • Is it possible to read the contents of the XML file rather than the properties for the location of FLEX

    Is it possible to read the contents of the XML file rather than the properties for the location of FLEX

    Strictly speaking, this is not really true. When running, the ResourceManager of IResourceBundles for localization, not deal with XML files or properties files. As long as you implement IResourceBundle, you can back it up with XML, properties, JSON, AMF files - what you want. The problem is that mxmlc will not build modules of resources for you what it is, with the exception of properties files, and cannot compile just resource bundles in a .swf using anything other than properties files. If you build your own interface to spit IResourceBundles, this could work, but it is probably more trouble that it's worth.

    (Assuming that you establish the link in the application) the best solution is to write a script to pre-process the XML in properties files.

Maybe you are looking for