How to marshal List Source using JAXB and xjc?

Hi all,
I'm having problems to marshal objects of xjc generated java classes to xml output. In detail I am facing problems to use a list of sources (List<javax.xml.transform.Source>) that's been generated.
The schema I am using is:
<xs:complexType name="tTestAttachment">
<xs:sequence>
<xs:element name="textXML" type="xs:base64Binary" xmime:expectedContentTypes="text/xml" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="TestAttachment" type="tTestAttachment" />
...By using xjc the java classes are generated without problems. The expectedContentTypes="text/xml" results the generation of a List<Source> parameter for the class.
public class TTestAttachment {
@XmlMimeType("text/xml")
protected List<Source> textXML;
...Now I want to test the generated classes and marshal an object I created by the following code
StreamSource ssrc = new StreamSource("file:D:/temp/test.xml");
attachment.getTextXML().add(ssrc);
attachment.getTextXML().add(ssrc);
ObjectFactory objFactory = new ObjectFactory();
JAXBContext jc = JAXBContext.newInstance(TTestAttachment.class);
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
JAXBElement<TTestAttachment> jaxbelem = objFactory.createTestAttachment(attachment);
marshaller.marshal(jaxbelem, new PrintWriter(System.out));
...But as return I just receive an error message, that StreamSource is not known to the context:
javax.xml.bind.MarshalException
- with linked exception:
[javax.xml.bind.JAXBException: class javax.xml.transform.stream.StreamSource nor any of its super class is known to this context.]
...So now I made it known to the JAXBContext by adding it as parameter:
JAXBContext jc = JAXBContext.newInstance(TTestAttachment.class);With the result, that I get an output but not as expected with content of the source inline but with the link to it.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:TestAttachment xmlns:ns2="http://www.example.com/schema01">
<ns2:textXML xsi:type="streamSource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<systemId>file:D:/temp/test.xml</systemId>
</ns2:textXML>
<ns2:textXML xsi:type="streamSource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<systemId>file:D:/temp/test.xml</systemId>
</ns2:textXML>
</ns2:TestAttachment>A second idea was to leave the JAXBContext as it is and add the annotation @XmlList to the attribute of the generated java class. But that also does not lead to the expected result. It included the content of the source now but whitespace separated and not as single objects. The expected result should look some like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TestAttachment xmlns="http://www.example.com/schema01">
<textXML>PD94...sbzwvbWVzc2FnZT4=</textXML>
<textXML>PD94...sbzwvbWVzc2FnZT4=</textXML>
</TestAttachment>By the way - when I'm using a single "text/xml" mime type element (maxOccurs="1") in the based schema everything works fine. xjc generates a single attribute of type javax.transform.Source and the marshalling works out the expected way.
Any suggestions on how to marshal the objects correctly?
- Thanks in advance

Hope this link help you -
http://chakkaradeep.com/index.php/autohosted-sharepoint-apps-deep-dive-part-2/
Also check this link, About Autohosted Apps Preview program
http://blogs.msdn.com/b/calvarro/archive/2014/05/20/about-autohosted-apps-preview-program.aspx
For production, it is recommended to convert Auto Hosted to Provider Hosted App, so better prepared for it now.
http://msdn.microsoft.com/EN-US/library/office/dn722449(v=office.15).aspx
Hope this helps!
Ram - SharePoint Architect
Blog - SharePointDeveloper.in
Please vote or mark your question answered, if my reply helps you

Similar Messages

  • How to connect one page using button and by link in BSP

    how to connect one page using button and by link in BSP

    hi,
    use on 'onclick' functionality.
    1. In layout, onclick = 'NEXT_PAGE' of the button
    2. Capture the event in onInputprocessing,
    DATA: event_id TYPE REF TO  cl_htmlb_event.
    case event_id.
    when 'NEXT_PAGE'.
                navigation->goto_page( 'URPAGE URL' ).

  • Explain How delivery date is calculated using backward and forward schedul

    How can anyone please explain how delivery date is calculated using forward and backward scheduling
    I want to have it broken down into the following steps
    for eg for delivery date calculation following dates are used
    Material Availabilty Date
    Material Staging Date
    Pick/pack time
    Transportation PLanning date
    Loading date
    Goods issue date
    Transit Date
    Delivery Date
    Can some one please give me an example and explain wht these dates are
    for eg customer needs delivery date on  11/20/2008
    how would the system cacluate whether it can meet the delivery date using backward scheduling
    and if it doesnt meet how does the system do the forward scheduling
    also i am not clear with the following dates
    material avaialibilty date
    material staging date
    transportation date
    can some one please explain me all this in detail
    Thanks

    Hi,
    Basically this is the CRSD(Customer requested ship date logic)logic in which system calculates the ship date depends upon the material availability. If material is available system calculates ship date on the basis of master data maintained in customisation.Master data is maintained in the  following link.
    If material is not available then system takes into consideration vendor delivery date & then calculate customer ship date.
    Please go through the link in SPRO
    LE-Shipping -Basic shipping functions-Scheduling -Delivery scheduling & Transportation scheduling-Maintain duration.
    In customisation following data is maintained
    Material Availabilty Date
    Material Staging Date
    Pick/pack time
    Transportation PLanning date
    Loading date
    Goods issue date
    Transit Date
    Delivery Date
    Hope you got the idea of CRSD calculation
    Regards,
    Prashant.

  • How to refresh table display using slis and 'reuse_alv_grid_display method.

    hello,
    how to refresh table display using slis and 'reuse_alv_grid_display method'.
    when i'm refreshing table display it performs once again reuse_alv_grid_display.and when i back the previous value appear.how to solve it?
    neon

    are you chaning any value in the gird if so use this..
    Pass the user_command form name to the Import parameter
    I_CALL_BACK_USERCOMMAND .
    and have the Dynamic form implementation..
    FORM user_command USING ucomm TYPE sy-ucomm
                selfield TYPE slis_selfield.
    "The below is important for Editable Grid.
      DATA: gd_repid LIKE sy-repid, "Exists
      ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      CASE ucomm.
        WHEN 'REFRSH'.
      ENDCASE.
           selfield-refresh = 'X'.
    ENDFORM.                    "user_command

  • How to automlog into webside using username and password using java program

    I am trying to log in to a website using password and username. What libraries i can use. I searched online and came to know that i can use Apache's commons HttpClient library to do that. I am new to this please let me know what can i use.
    For starting purpose i wrote this code:
    public static void main(String[] args) throws URIException {
         try {
              HttpClient client = new HttpClient();
              GetMethod method = new GetMethod("http://www.google.com");
                   int returnCode = client.executeMethod(method);
                   System.err.println(method.getResponseBodyAsString());
              method.releaseConnection();
              } catch (HttpException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
    but this is giving me an error. please see below,
    java.net.UnknownHostException: www.google.com
         at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
         at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
         at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
         at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
         at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
         at com.verizon.zoeott.ingest.PropertyFileReader.main(PropertyFileReader.java:48)
    Another thing is that we use proxy to get internet connection. In internet explorer-->internet options-->LAN Settings-->using automatic configuration script to connect to the internet.
    I don't know how to configure this into java program. please help.
    Thanks,
    amol
    Edited by: 877846 on Jan 20, 2012 9:16 AM
    Edited by: 877846 on Jan 20, 2012 9:21 AM

    Also please let me know about how to connect internet through proxy server.As I said above, if you are using the Apache HTTP client, no we can't, as this is not an Apache forum. I also told you where to find that answer.
    If on the other hand you don't want to use that client any more, setting the system properties http.proxyHost and http.proxyPort will do it for java.net.HttpURLConnection. See the Java Custom Networking tutorial for examples.

  • Tutorial on how to update list items using ListData.svc

    Can you please point me to a tutorial which shows how to update a list item using listdata.svc and C#?
    Sorry if this is FAQ.
    I have found articles on read list... but I haven't found anything on update a list item.
    val it: unit=()

    when i try this I get an error 500
    I created an ASP.NET web application that allows the user to modify data that is stored in SharePoint I rather not go into the reasons why this application was created but focus more on why doesn't the listdata.svc allow me to update a task item that was
    created by a workflow collect data from user action.
    1. The workflow creates the item.
    I collect the item and update the item using the below code. This is not an OOTB approval workflow that is just the name I used. When I get to save changes I received the following error code.
    Dim getApprovalItem As ExpenseApprovalRuleBasedTasksItem = spContext.ExpenseApprovalRuleBasedTasks.Where(Function(i) i.Id = Pam.ApprovalItemID).FirstOrDefault
    If String.IsNullOrEmpty(getApprovalItem.AuditorApprovalValue) Then
    getApprovalItem.AuditingComments = approvalComments
    Select Case approvalDecision
    Case "Approved"
    getApprovalItem.AuditorApproval = ExpenseApprovalRuleBasedTasksAuditorApprovalValue.CreateExpenseApprovalRuleBasedTasksAuditorApprovalValue("Approved")
    getApprovalItem.AuditorApprovalValue = "Approved"
    Case "Rejected"
    getApprovalItem.AuditorApproval = ExpenseApprovalRuleBasedTasksAuditorApprovalValue.CreateExpenseApprovalRuleBasedTasksAuditorApprovalValue("Rejected")
    getApprovalItem.AuditorApprovalValue = "Rejected"
    End Select
    getApprovalItem.Outcome = "Completed"
    getApprovalItem.Status = ExpenseApprovalRuleBasedTasksStatusValue.CreateExpenseApprovalRuleBasedTasksStatusValue("Completed")
    getApprovalItem.StatusValue = "Completed"
    getApprovalItem.Complete = True
    spContext.UpdateObject(getApprovalItem)
    spContext.SaveChanges()
    End If

  • How to create list entries using ADM ?

    Hi All,
    I  want to create list box using ADM.
    Thanks

    Thanks for the reply.
    Sorry for the simple question.
    What is the theme used in Adobe Illustrator CS6?
    And then I started programming in Flash Builder 4.6 and the panel is obtained with the other buttons.
    Or how to move the theme Adobe Illustrator CS6 in my project?
    Thanks

  • How to Split the string using Substr and instr using loop condition

    Hi every body,
    I have below requirement.
    I need to split the string and append with single quotes('') followed by , (comma) and reassign entire values into another variable. so that i can use it where clause of update statement
    for example I am reciveing value as follows
    ALN varchar2(2000):=(12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434);
    Note: In the above variable i see 8 transactions, where as in real scenario i donot how many transaction i may recive.
    after modification i need above transactions should in below format
    ALTR Varchar2(2000):=('12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434');
    kindly help how to use substr and instr in normal loop or for loop or while loop while modifying the above transactions.
    Please help me to sort out this issue.
    Many Thanks.
    Edited by: user627525 on Dec 15, 2011 11:49 AM

    Try this - may not be the best way but...:
    create or replace type myTableType as table of varchar2(255)
    declare
    v_array mytabletype;
    v_new_str varchar2(4000);
    function str2tbl
             (p_str   in varchar2,
              p_delim in varchar2 default '.')
             return      myTableType
        as
            l_str        long default p_str || p_delim;
             l_n        number;
             l_data     myTableType := myTabletype();
        begin
            loop
                l_n := instr( l_str, p_delim );
                exit when (nvl(l_n,0) = 0);
                l_data.extend;
                l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
                l_str := substr( l_str, l_n+length(p_delim) );
            end loop;
            return l_data;
       end;
    begin
      v_array := str2tbl ('12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434', ',');
          FOR i IN 1 .. v_array.COUNT LOOP
             v_new_str := v_new_str || ''''||v_array(i)||'''' || ',';
          END LOOP;
       dbms_output.put_line(RTRIM(v_new_str, ','));
    end;  
    OUTPUT:
    =======
    '12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434'HTH
    Edited by: user130038 on Dec 15, 2011 12:11 PM

  • How to search for files using wildcards * and ?.

    Hi All,
    I've been searching the forum for a couple of hours now and have been unable to find a good example of how to search a directory (Windows OS) for a file using wildcards * and/or ?. Does anyone out there have a good example that they can share with me?
    Thanks

    Hi All,
    First of all I want to thank everyone for taking the time to respond to my question. All of your responses where greatly appreciated.
    I took the example code that was posted by rkconner, thanks rkconner, and modified it to allow me to search for files in a directory that contain * and/or ?. Yes, I said and/or! Meaning that you can use them both in the same file name, example: r??d*.t* would find readme.txt.
    I've posed my complete and thoroughly document code below. I hope it is very helpful to other as I have searched many forums and spent many hours today trying to resolve this problem.
    Enjoy
    * File Name: WildcardSearch.java
    * Date: Jan 9, 2004
    * This class will search all files in a directory using the
    * asterisk (*) and/or question mark (?) as wildcards which may be
    * used together in the same file name.  A File [] is returned containing
    * an array of all files found that match the wildcard specifications.
    * Command line example:
    * c:\>java WildcardSearch c:\windows s??t*.ini
    * New sWild: s.{1}.{1}t.*.ini
    * system.ini
    * Command line break down: Java Program = java WildcardSearch
    *                          Search Directory (arg[0]) = C:\Windows
    *                          Files To Search (arg[1]) = s??t*.ini
    * Note:  Some commands will not work from the command line for arg[1]
    *        such as *.*, however, this will work if you if it is passed
    *        within Java (hard coded)
    * @author kmportner
    import java.io.File;
    import java.io.FilenameFilter;
    public class WildcardSearch
         private static String sWild = "";
          * @param args - arg[0] = directory to search, arg[1] = wildcard name
         public static void main(String[] args)
              String sExtDir = args[0]; // directory to search
              sWild = args[1];   // wild card to use - example: s??t*.ini
              sWild = replaceWildcards(sWild);
              System.out.println("New sWild: " + sWild);
              File fileDir = new File(sExtDir);
              File[] arrFile = fileDir.listFiles(new FilenameFilter()
                   public boolean accept(File dir, String name)
                        return (name.toLowerCase().matches(sWild));
              for (int i = 0; i < arrFile.length; ++i)
                   System.out.println(arrFile.getName());
         }     // end main
         * Checks for * and ? in the wildcard variable and replaces them correct
         * pattern characters.
         * @param wild - Wildcard name containing * and ?
         * @return - String containing modified wildcard name
         private static String replaceWildcards(String wild)
              StringBuffer buffer = new StringBuffer();
              char [] chars = wild.toCharArray();
              for (int i = 0; i < chars.length; ++i)
                   if (chars[i] == '*')
                        buffer.append(".*");
                   else if (chars[i] == '?')
                        buffer.append(".{1}");
                   else
                        buffer.append(chars[i]);
              return buffer.toString();
         }     // end replaceWildcards method
    }     // end class

  • How to create a user using XML and specifying addional attributes that are objects

    I'm trying to create a user using XML and specifying some attributes that are objects and not sure how to do it. How would I set the DirectoryUserAcl to Public?
    Here's the xml file:
    <?xml version = '1.0' standalone = 'yes'?>
    <SimpleUser>
    <UserName>mike2</UserName>
    <Password>abc123</Password>
    <AdminEnabled>false</AdminEnabled>
    <HomeFolderRoot>/home</HomeFolderRoot>
    <HasContentQuota>false</HasContentQuota>
    <DirectoryUserAcl> ??? </DirectoryUserAcl>
    <DefaultAclBundleAcl> ??? </DefaultAclBundleAcl>
    <HomeFolderPolicyBundleAcl> ??? </HomeFolderPolicyBundleAcl>
    </SimpleUser>

    I figured out the answer:
    <?xml version = '1.0' standalone = 'yes'?>
    <SimpleUser>
    <UserName>mike2</UserName>
    <Password>abc123</Password>
    <AdminEnabled>false</AdminEnabled>
    <HomeFolderRoot>/home</HomeFolderRoot>
    <HasContentQuota>false</HasContentQuota>
    <DirectoryUserAcl classname="SystemAccessControlList" refType="name">Public</DirectoryUserAcl>
    </SimpleUser>
    null

  • How to creating pdf documents using c# and Adobe SDK

    I downloaded Adobe SDK and go through the samples given in sdk. But i couldn't find any sample code how to create PDF file using C# code.
    Please, help me with this.
    Thanks.

    For desktop-based solutions, look at the Adobe Acrobat SDK which enables development around Acrobat itself. Or if you wish a stand-alone solution (for either desktop or server), we offer the Adobe PDFLibrary, which is the same technology used by all of Adobe's applications.
    For the server, we have our LiveCycle products including LC Generator.
    Leonard

  • How to generate Java source using clientgen WL8.1?

    Hi, does anybody know how to generate Java source code using clientgen task on WL 8.1 Sp4 or SP5? I know WL 9.0 clientgen can do this, but we are still on SP5. Basically I want to look at the source code (I was wondering why it didn't work if I initialize a service impl by passing the WSDL URL string different than the URL specified in the original WSDL file that the clientgen is run against.)
    Does anybody also know how get web service client developed on Axis work on WebLogic without conficting the web service developed on WebLgoic that is running in the same box?
    Thanks for your help!

    hi ,
    As mentioned in the Question, I am unable to find the "Java Proxy Generattion" link in the Int builder.
    Also the help doc says:
    Java proxy generation is no longer supported in subsequent releases. For new developments or when making significant changes to a service interface, use Java proxy generation in SAP NetWeaver Studio instead. More information: Creating Outside-In Web Services, SAP NetWeaver Developer Studio.
    Does that mean that I can no longer generate java proxy from Int builder?
    regards,
    Piyush

  • How to create store procedure using cursor, and looping condition with exce

    Hi,
    I am new in pl/sql development , please help me for follwoing
    1. I have select query by joining few tables which returns lets say 100 records.
    2. I want to insert records into another table(lets say table name is tbl_sale).
    3. If first record is inserted into tbl_sale,and for next record if value is same as first then update into tbl_sale else
    insert new row
    4. I want to achieve this using store procedure.
    Please help me how to do looping,how to use cursor and all other necessary thing to achieve this.

    DECLARE
       b   NUMBER;
    BEGIN
       UPDATE tbl_sale
          SET a = b
        WHERE a = 1;
       IF SQL%ROWCOUNT = 0
       THEN
          INSERT INTO tbl_sale
                      (a
               VALUES (b
       END IF;
    END;note : handle exceptions where ever needed
    Regards,
    friend
    Edited by: most wanted!!!! on Mar 18, 2013 12:06 AM

  • How do I list Storage used by Individual MySites

    Is there a way to find out which user is utilising the most space in the MySite content DB?
    I know the size of the content database but I would like to find out who is using the most so I can keep an eye out for anyone that may be rapidly heading towards hitting storage limits.
    It would be really cool if it was possible to zero in on the libraries that have the most storage allocated so I can guide them to places that need to be pruned.
    Thanks in advance for any help given.
    Darren

    Hi,
    According to your post, my understanding is that you wanted to list Storage used by Individual MySites.
    There are two out of the box way to find the My Site size with SharePoint.
    Central admin>Application Managment>SiteCollection Quotas and Locks>close to the bottom of the page under quotas it shows the current size.
    Site actions> site Settings> under site actions > Site Collection Web Analytics reports, this gives you the total size for the collection.
    In addition, you can list site collection size using PowerShell. For more information, please refer to:
    Using PowerShell to find site collection size in SharePoint 2010
    Find All SharePoint 2010 Site Collections
    and Their Sizes Using PowerShell
    Here is a similar thread for your reference:
    http://community.spiceworks.com/topic/159522-sharepoint-2010-find-size-of-the-site-without-powershell
    Thanks,
    Linda Li
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • Very Urgent..How to create a report Using SQ01 and Sq02.

    Hi Friends,
    It's very urgent.pl help  me in generating a report using SQ01 and SQ02.
    Help is appreciated.
    thanks In advance.
    Regards,
    Nanditha.

    Check out these links...
    http://www.insightcp.com/res_15.htm
    http://www.ams.utoronto.ca/Assets/output/assets/adhoc_2990830.pdf.pdf
    Also, do basic search in this forum...you will find a lot of threads related to this.
    SKR

Maybe you are looking for

  • Problem with onBlur="window.focus()"

    Hi, inside the body tag of a popup widow i have used onBlur="window.focus()" and it is working fine i.e. when i tried to click on parent window the focus transfers back to popup window but i tried this by clicking like hundred times it fails i.e. the

  • How to use javascript and scriptlet simultaneously

    Hi all!! I have a jsp page on which there are two selection lists. One is for publisher names list and second is for journal names list corresponding to publisher selected in first selection list. When publisher name is selected in first selection li

  • How to cancel online request

    My IPad goes wrong. The home button does not work properly. I registered online sevices on the apple web but now I want to cancel the online request to go to on-site store. Please let me know how to cancel online request?

  • JavaScript within JSP

    Hi all !! I'm stuck up. Is there any way by which i can actually embed JavaScript within a JSP file that contains no JSP code. Actually it is file with .jsp extention but from within it holds only java script inside <script> tags. The prerequisite is

  • Linksys WRVS4400N Setup

    The way that we have our network set up is that the internet comes into one nic card and that on a second nic card it goes to the WRVS4400N. In this, the DHCP is controlled by the server not the router – in a sense the server acts like the ISP. So wi