How to write data into xml through web service

Hi,
  I have a requirement to write the data into xml through a web service .send me related links and sample code if any.

hi kiran,
  write the data into xml : We need suitable set of java Beans for handling WebService Data.
   However, there are cases when you may prefer an alternate mapping, or when there just isn't a well-defined mapping for your particular schema construct (xsd:choice is a common example). For these cases, IBM® WebSphere® has introduced a new feature called Custom Data Binding that allows you to integrate alternate data binding technologies like JAX-B, EMF/SDO and XML beans, as well to define your own XML schema to Java mappings. This article provides an overview of the technology and how you can get started integrating it into your application.
GO THru THis Links :
http://www-128.ibm.com/developerworks/websphere/library/
techarticles/0601_gallardo/0601_gallardo.html.
Hope It Helps.
Thanks
Varun CN

Similar Messages

  • Is it possible to read/write data from Salesforce using web service hub in Informatica?

    Anyone from Informatica can asnwer this question please

    Is it possible to read/write data from Salesforce using web service hub in Informatica? Not asking about PowerExchange for Salesforce or Informatica Cloud. Just using web service can we load data into Salesforce? Thanks ahead.

  • How to write data to xml file?

    Hi,
    I have done a project which read data from a web then write in log file.
    Now i want to write data in xml file.
    how to write?
    i read some java and xml tutorial, quite quite difficult.
    Who can give a simple example with some comments?
    If you also give some tips on learning java web services, i will be very appreciated.
    Thanks
    Yang Bin

    Choose Xerces2.4 to serialize the DOM object is an option.
    javac XercesTest.java -classpath xmlParserAPIs.jar;xercesImpl.jar;.
    java -classpath xmlParserAPIs.jar;xercesImpl.jar;. XercesTest test.xml
    below is the source file: XercesTest.java
    //JAXP
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    //APACHE SERIALIZE FUNCTION
    import org.apache.xml.serialize.*;
    class XercesTest
    public static void main(String[] args) throws Exception
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse( new File( args[0] ) );
    File f = new File( "copy_of_"+ args[0] );
    OutputFormat format = new OutputFormat("xml","UTF-8",true ) ;
    FileOutputStream fout = new FileOutputStream( f );
    XMLSerializer ser = new XMLSerializer(fout, format );
    ser.serialize( doc );
    hope it's helpful
    land

  • How to write data into a file

    Hi
    I want to write data from a string into a file. I am created a directory and a .doc file . But when i write this data from a string into .doc file , its give an error : File not found exception
    But, when i check in my directory, a file is created with blank.
    My code is:
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    class createFile {
         public static void main(String[] args) {
    try {
         String mss = "This is for dedo";
         FileInputStream fis;
         FileOutputStream fos;
    File file = new File("C:\\JD\\m4.rtf");
    // Create file if it does not exist
    boolean success = file.createNewFile();
         success = true;
    if (success) {
                   System.out.println("suc");     
                   fis = new FileInputStream(mss);
                   System.out.println(fis);
              fos = new FileOutputStream(file);
              int c;
                   while ((c = fis.read()) != -1) {
         fos.write(c);
                   System.out.println("mss");
              fis.close();
              fos.close();
         System.out.println("created");
    // File did not exist and was created
    } else {
    // File already exists
    } catch (IOException e) {
         System.out.println(e);
    regards
    madhu

    InputStream inputStream = new ByteArrayInputStream(mss.getBytes());Use this to push into the file>
    Ummm.... no. InputStreams are for reading, not for writing.
    Anyway, OP, you're making a mistake. You're trying to open a stream to a file called "This is for dedo". Use FileOutputStream(File file) constructor or FileOutputStream(String pathToFile). You can then wrap that stream with a PrintWriter or whatever you need.

  • How to move data connections with SOAP web service in different environments in InfoPath Forms 2010

    Hello,
    I've an InfoPath Form where I've around 10 SOAP web service data connections. They are calling a custom web service for a custom business process. The web service URL has a query string parameter which identifies whether it's a Test web service or the Production
    one. The web service URL looks like this:
    http://server/webservice/wsdl?targetURI=testSPRead (for the Test environment)
    http://server/webservice/wsdl?targetURI=ProdSPRead (for the Production environment)
    When I develop the form in Dev environment, I use the Test web service URL and save the data connection as UDCX files in the data connection library. After completing the development, when I deploy this Form in Production, I update the URL in the UDCX
    file in the Production data connection library, but when I run the Form in Production, it throws error 'Error occurred in calling the web service'. After doing more research, when I extracted the XSN file and opened Manifest.xsf file in Notepad, I found the
    references of 'testSPRead' parameter.
    So, in the UDCX file the web service URL is '/targetURI=ProdSPRead' but in the Manifest.xsf file, there is a reference of Test web service parameter which is 'testSPRead' and that's why it's throwing error.
    For testing purpose, I updated the Manifest.xsf file and replaced all the occurrences of 'testSPRead' to 'ProdSPRead' and also updated all the relevant files of the data connections (like XML, XSF etc.) and saved the Manifest.xsf as Form.xsn and deployed
    in Prod and it worked.
    The question is - is this the right way of doing it? There should be a simple method in such cases where web service has conditional parameter to identify the Test and Production web service.
    Does somebody know what is the right way of doing it? I also thought of adding 'double' data connections - one set of Test and another set of Production and call them by identifying the current SharePointServerRootURL, but that's a lot of work. I've 10 web
    service data connections in my Form and in that case I'll be having 20 data connections and setting their parameters in different Rules is too much work.
    Please advise. It's very important for me!
    Thanks in advance.
    Ashish

    Thanks for your response Hemendra!
    I hope Microsoft improves this thing in subsequent patches of InfoPath 2010 or InfoPath 2013 because I don't think this is a very special requirement. This is failing the purpose of having UDCX files for data connections. Why the WSDL's parameter value
    is being written in the Manifest.xsf and other XSF and XML files. InfoPath should always refer the URL and parameters from the UDCX files.
    --Ashish

  • How to write WSDD file to deploy web service

    I write a server code,I want to deploy it as service,but I don't know how to write WSDD file?I use AXIS and SOAP
    I need help,thanks a lot.
    Regards
    William
    2.24

    Yes, put your wsdd with your class files. But if you want AdminClient to work correctly, be sure all environement variables are set correctly.
    Me, I never use it, I prefer to modify directly the server-config.wsdd

  • How to write settings into xml

    I?ve got a small class that returns the names of each JInternalFrame. The code is below; I have an xml file where I am saving various settings. In the xml file I have created a tag and in that tag I want to write all the name of the JInternalFrames. Can someone help me with writing a method which will write the frames names into the xml tag.
    package persisted_display_settings;
    import javax.swing.*;
    import mdi_internal_frame.FrameManager;
    import mdi_internal_frame.TSFrame;
    import state_manager.StateManager.Prerequisite;
    * The PersistDisplaySettings looks after the persisted screen settings for each frame.
    * It allows the user to save the layout settings of each screen so that the user doesn't
    * have to reconfigure layout every time they restart
    public class PersistDisplaySettings {
         * Gets the name of all TS frames and the last modified layout information and saves
         * this in a xml file
         * @param projectDir is the project directory
         public void SaveCurrentTsProfile(String projectDir) {
              System.out.println("Start Here");
              System.out.println(projectDir);
              JInternalFrame[] frames = FrameManager.getJDesktopTS().getAllFrames();
              System.out.println(frames.length);
    // Iterate through each frame that is open and get the names
              // Only get the names of the frames that are saved
              for (int noOfFrames = 0; noOfFrames < frames.length; noOfFrames++) {
                   String tsName = "";
                   boolean unsaved = true;
                   //Check to make sure the frames are TS frames
                   if (frames[noOfFrames] instanceof TSFrame) {        
                        JInternalFrame tsFrames = frames[noOfFrames];
                        if(tsFrames.getTitle().contains(":-")){
                             tsName = tsFrames.getTitle();
                             tsName = tsName.substring(17);
                             unsaved = getSavedTSNames(tsFrames);
                        else if(tsFrames.getTitle().contains("-")){
                             tsName = tsFrames.getTitle();
                             tsName = tsName.substring(16);
                             unsaved = getSavedTSNames(tsFrames);
                        if(!unsaved){
                             System.out.println(tsName);
              System.out.println("point 2");
              FrameManager.getSelectedTSFrame().isMaximum();
              System.out.println(FrameManager.getSelectedTSFrame());
              System.out.println(FrameManager.getSelectedTSFrame().isMaximum());
         * Returns all the saved TS frame names. This method is Called
         * by the SaveCurrentTsProfile method
         * @param save boolean flgg indicating if GUI should save modified test sequences
         public boolean getSavedTSNames(JInternalFrame frame) {
                        boolean[] modified = ((TSFrame)frame).stateManager
                        .getPrereqState(Prerequisite.TS_MODIFIED);
                        return modified[0];     
    }

    I have a GUI project which has frames consisting of data in table view. What i'm trying to do is save the layout of the frames into an xml file so that the user doesn't have to reconfigure layout every time they restart the application. The code which i have attached gets the names of each frame.
    I also have another class which is currently generating various other settings and writing it into the xml file. The xml file looks like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <PTMViewProfile>
    - <viewProfile>
    <testSequences />
    - <tsName>
    <tsName tag="arefa" />
    </tsName>
    <tsStatus />
    - <columns>
    - <tcc>
    <column tag="usim" visible="false" width="75" index="-1" />
    <column tag="dev" visible="false" width="75" index="-1" />
    <column tag="tp" visible="false" width="75" index="-1" />
    <column tag="iwd" visible="false" width="75" index="-1" />
    <column tag="tdma" visible="false" width="75" index="-1" />
    <column tag="selref" visible="true" width="75" index="2" />
    <column tag="md" visible="false" width="75" index="-1" />
    <column tag="timer" visible="false" width="75" index="-1" />
    <column tag="description" visible="false" width="75" index="-1" />
    <column tag="name" visible="true" width="120" index="0" />
    <column tag="domain" visible="true" width="75" index="5" />
    <column tag="note" visible="false" width="75" index="-1" />
    <column tag="hsdpa" visible="false" width="75" index="-1" />
    <column tag="wi" visible="true" width="75" index="4" />
    <column tag="ttcn" visible="false" width="75" index="-1" />
    <column tag="approval" visible="false" width="75" index="-1" />
    <column tag="inter" visible="false" width="75" index="-1" />
    <column tag="duration" visible="false" width="75" index="-1" />
    <column tag="etsi" visible="true" width="75" index="1" />
    <column tag="hsupa" visible="false" width="75" index="-1" />
    <column tag="auto" visible="true" width="75" index="3" />
    <column tag="cipher" visible="false" width="75" index="-1" />
    <column tag="suite" visible="false" width="75" index="-1" />
    <column tag="shield" visible="false" width="75" index="-1" />
    <column tag="hop" visible="false" width="75" index="-1" />
    </tcc>
    In the - <tsName> i want to print out all the names of the frames.
    This is the method thats creating the tags in the xml file. This method is stored in a different class;
    public Element writeViewProfile(String name) {
              Message.logInfo("Saving View Profile XML Document:" + name);
              Element root = XMLManager.createNamedElement("PTMViewProfile");
              Element viewProfile = XMLManager.createNamedChildElement(root, xmlViewTag);
              Element tsNameTag = XMLManager.createNamedChildElement(viewProfile, xmlTSFrameTag);
              Element tsFrameName = XMLManager.createNamedChildElement(viewProfile, xmlFrameTag);
              writeTsFrame(tsFrameName, "Arefa");
              Element tsFrameStatus = XMLManager.createNamedChildElement(viewProfile, xmlFrameStatusTag);
              Element columns = XMLManager.createNamedChildElement(viewProfile, xmlColumnsTag);
              writeColumnSet(columns, xmlTCCColumnTag);
              writeColumnSet(columns, xmlTSColumnTag);
              writeColumnSet(columns, xmlResTCCColumnTag);
              writeColumnSet(columns, xmlResTSColumnTag);
              Element sashes = XMLManager.createNamedChildElement(viewProfile, xmlSashesTag);
              for (int i = 0; i < sashList.size(); i++) {
                   writeSash(sashes, sashList.get(i));
              return root;
         };This is the method thats writing the xml file;
    private void saveProfile(String name) {
              if (!readyToSave)
                   return;
              ViewProfile viewProfile = viewProfiles.get(currentViewProfileName);
              if (viewProfile != null) {
                   // try {
                   Element root = viewProfile.writeViewProfile("ptmProfile");
                   // create an xml document with our data
                   Document doc = new Document(root);
                   // dump the document to file
                   XMLManager.dumpXMLDocToFile(doc, "ptmProfile", FileManager.baseDir());
                   // catch (Exception ignore) {
                   // System.out.println(ignore.getMessage() + ignore.getStackTrace());
         }In the xml file how can i print the names of the frames into that <tsName> tag using the SaveCurrentTsProfile() method .
    I hope this helps you understand whats hapenning.
    Thanks!

  • How to fetch data into xml file trom sql table.

    Hi,
    We r now working in oracle 9iAS portal.
    We have installed xdk along with 9iAS.
    I would like to know how to and where to run an xsql file,preferably with an example to fetch data from a database table to a xml file.

    Please download the latest version of XDK for Java at:
    http://otn.oracle.com/tech/xml/xdk_java
    In the downloaded package, there are demos for XSQL Servlet. The demo "emp" and "empdept" are good start.

  • HOW TO  WRITE DATA INTO A CLOB VARIABLE IN PL SQL-URGENT!!!!!!!

    Hi,
    In a PLSQL procedure, i need to store all error messages into a CLOB variable and finally RETURN the Clob.
    While using DBMS_LOB.wirteappend, i am getting Error like
    "INVALID LOB LOCATOR SPECIFIED".
    Here is the code sample i used,
    CREATE OR REPLACE procedure ErrorAppend
    is
    clobObj CLOB;
    amt binary_integer:=32767;
    errormsg varchar2(2000);
    BEGIN
    for j in 1..3
    loop
    BEGIN
    insert into errortest values(j);
    EXCEPTION
    WHEN others THEN
    errormsg:='ERROR OCCURED '||SQLERRM;
    dbms_lob.writeappend(clobObj,amt,errormsg);
    END;
    commit;
    end loop;
    dbms_output.put_line(clobObj);
    END ErrorAppend;
    Here i am not allowed to get empty_clob/clob from the table.
    Any help will be apprciated.
    rgds,
    senthil.

    InputStream inputStream = new ByteArrayInputStream(mss.getBytes());Use this to push into the file>
    Ummm.... no. InputStreams are for reading, not for writing.
    Anyway, OP, you're making a mistake. You're trying to open a stream to a file called "This is for dedo". Use FileOutputStream(File file) constructor or FileOutputStream(String pathToFile). You can then wrap that stream with a PrintWriter or whatever you need.

  • How to write data from query into Real time cube?

    Hi All,
    Can anyone explain me step by step how to write data into a real time cube from front end queries.
    Thanks in advance

    Hi
    You can do this using Integrated Planning
    You need to create a aggregation level on the Real Time infocube and can create Planning function/sequence, Variables if needed.
    Then you can create query on this aggregation level and you can make the keyfigures Input ready in property pane and you can change the data and save it into cube.
    Please find below help link which clearly explains step by step about Integrated Planning like creating input ready queries etc.,
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/43/0c033316cd2bc4e10000000a114cbd/frameset.htm
    Regards
    Ravi

  • How to Convert internal table data into xml and xml data into internal tab

    Hi Guys,
          I have a requirement  that  i have to convert the internal table data into xml format and viceversa . for my requirement  i came to know that i have to use Transformations concept.  i done the converting the data from internal table into xml data by using standard Tranformations. My Question is 
    1) Can i use same Transformation to convert the xml data into abap internal table. if it is possible then how ???
    2) Is it possible using the standard Transformation  or I have to go for XSLT approach
    Please help me out from this guys,
    Thanks and Regards
    Koti

    Hi Koti,
    This is possible. There is a link. With the help of this link you can convert ABAP data to XML and vice versa.
    Link: http://www.heidoc.net/joomla/index.php?option=com_content&view=article&id=15:sapxslt&catid=22:sap-xslt&Itemid=31

  • How to download internal table data into xml file?

    Hi,
    Experts,
    I have downloaded internal table data into XLS format using GUI_DOWNLOAD Function module, But i didn't Know how to download internal table data into XML format please post some ideas/inputs on this issue.
    Thank you,
    Shabeer ahmed.

    check this
    data : gd_repid type sy-repid.
    GD_REPID = SY-REPID.
    DATA : L_DOM TYPE REF TO IF_IXML_ELEMENT,
           M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
           G_IXML TYPE REF TO IF_IXML,
           W_STRING TYPE XSTRING,
           W_SIZE TYPE I,
           W_RESULT TYPE I,
           W_LINE TYPE STRING,
           IT_XML TYPE DCXMLLINES,
           S_XML LIKE LINE OF IT_XML,
           W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
          BEGIN OF XML_TAB OCCURS 0,
          D LIKE LINE OF XML,
          END OF XML_TAB.
    data : l_element           type ref to if_ixml_element,
           xml_ns_prefix_sf     type string,
           xml_ns_uri_sf        type string.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
       NAME = 'REPAIRDATA'
       DATAOBJECT = IT_FINAL_LAST1[]
    IMPORTING
       DATA_AS_DOM = L_DOM
    CHANGING
       DOCUMENT = M_DOCUMENT
    EXCEPTIONS
       ILLEGAL_NAME = 1
       OTHERS = 2.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    *Start of code for Header
    * namespace
    t_mnr = sy-datum+4(2).
    CALL FUNCTION 'IDWT_READ_MONTH_TEXT'
      EXPORTING
        LANGU         = 'E'
        MONTH         = t_mnr
    IMPORTING
       T247          = wa_t247
    concatenate sy-datum+6(2)
                wa_t247-ktx
                sy-datum(4) into t_var1.
    concatenate sy-uzeit(2)
                sy-uzeit+2(2)
                sy-uzeit+4(2) into t_var2.
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    l_element  = m_document->get_root_element( ).
    xml_ns_prefix_sf = 'TIMESTAMP'.
    concatenate t_var1 t_var2 into xml_ns_uri_sf separated by space.
    clear : t_var1,
            t_var2,
            t_mnr,
            wa_t247.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'FILECREATOR'.
    xml_ns_uri_sf    =   'SAP'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMGROUP'.
    xml_ns_uri_sf    = '1'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMTYPES'.
    xml_ns_uri_sf    = 'W'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    *End of Code for Header
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
      DOCUMENT = M_DOCUMENT
    IMPORTING
      XML_AS_STRING = W_STRING
      SIZE = W_SIZE
    TABLES
      XML_AS_TABLE = IT_XML
    EXCEPTIONS
      NO_DOCUMENT = 1
      OTHERS = 2.
    LOOP AT IT_XML INTO XML_TAB-D.
    APPEND XML_TAB.
    ENDLOOP.
    *Start of Code for File name
    concatenate p_file
                '\R'
                '000_119481'
                sy-datum+6(2) sy-datum+4(2) sy-datum+2(2)
                sy-uzeit(2)   sy-uzeit+2(2) sy-uzeit(2) '.xml' into p_file.
    *End of Code for File name
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE = W_SIZE
      FILENAME = p_file
      FILETYPE = 'BIN'
    TABLES
      DATA_TAB = XML_TAB
    EXCEPTIONS
      OTHERS = 10.
    IF SY-SUBRC  = 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • How to activate another worksheet in excel file and write data into it

    Hi,
    I am writing an automation program to collect test data and write the data to an excel file.
    The excel file has several worksheets and now I can only write data to one sheet. Can anyone please let me know how to activate another worksheet and write data into it? Thank you very much.

    You can do a search in the Example Finder for more Excel VIs.
    They will give you a clearer idea of how to go about doing things in the way you need.
    - Partha
    LabVIEW - Wires that catch bugs!

  • How to write data to an XML file present under application server

    frnds: can ne one tell me, how to write data in to a file, which is present under a application server
    Ex: i want to write a string data in to a file test.txt which is present under "http://localhost:8080/<some_webapp>/test.txt"
    Note:i have deploted a service<some_webapp> under Tomcat/webapps dir

    Very simple. A servlet can writes to that file if it has the good rights.
    In the servlet get (or post) method, use a code like this:
    import java.io.*;
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
    try {
    String filePath = this.getServletContext().getRealPath("/text.txt");//See http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
             PrintWriter writer = new PrintWriter (filePath);
            //or BufferedWriter out = new BufferedWriter(new FileWriter(filePath));
            writer .println("aString");
           writer.flush();
            writer .close();
        } catch (Exception e) {
           e.printStackTrace();
    }Hope That Helps

  • Why we need to conver Context  Node data into XML file----Export to Excel

    Hi All,
    Let me clarify my dought........today i have gone through the concept of  "Exporting Context Data Using the Webdynpro Binary cache" in SAP Online Help.
    From the SAP Online Help pdf document, i have found that, the context node data has been converted first in to XML file,after that file had been stored in the web dynpor binary cache...bla....bla.........
    Here my qtn is why they had converted context node data into XML file. With out doing that can not we export context node data to excel file..?
    Regards
    Seshu
    Edited by: Sesshanna D on Dec 19, 2007 7:25 AM

    Hi Sesshanna,
    it is not neccessary to do that but xml has the advantage, that it can be easily transformed into every output format that might occur in later project stages.
    If it's simply about blowing out some Excel, I suggest using an OSS library such as jexcelAPI or Jakarta POI and building the Excel how you need it.
    regards,
    Christian

Maybe you are looking for