webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Putting java.String[] to IData as String List

  • 1.  Putting java.String[] to IData as String List

    Posted Wed May 15, 2013 08:17 AM

    Greetings,

    I have a flow service that has the following input structure:

    • unformatted_email [DOCUMENT]
      • unformatted_email.sender [StringList]
      • unformatted_email.mailBoxNames [StringList]
      • unformatted_email.subject [String]
      • unformatted_email.recvDate [String]

    I’m trying to call this service from a java application, and I’m bulding up its input IData like this:

            IData unformatted_email = IDataFactory.create();
    IDataCursor unformatted_email_cursor = unformatted_email.getCursor();
    String[] sender = {"\"Doe, John\" <John.Doe@t-systems.com>"};
    IDataUtil.put(unformatted_email_cursor, "sender", sender);
    
    String[] mailbx = {"\"Dane, John\" <John.Doe@t-systems.com>"};
    IDataUtil.put(unformatted_email_cursor, "mailBoxNames", mailbx);
    
    IDataUtil.put(unformatted_email_cursor, "subject", "ServiceTest");
    IDataUtil.put(unformatted_email_cursor, "recvDate", "Thu Mar 08 09:51:48 MET 2012");
    unformatted_email_cursor.destroy();
    IDataCursor input_cursor = input.getCursor();
    IDataUtil.put(input_cursor, "unformatted_email", unformatted_email);
    input_cursor.destroy();
    

    Now, one important note. Though “sender” and “mailBoxNames” are StringLists, they can only contain !!ONE!! item, or else the service will throw an error message. I know its poor but I’m unable to change the service, I only have to call it from a java application; and here comes my problem… As you can see my String only contains one single String, but when I try to call the service it throws the error:

    Exception: Invalid sender. An email can contain only one "from" address.
    

    like sender would contain more Strings. Am I passing String parameter badly? How can I pass String to StringList?


    #webMethods
    #webMethods-General
    #Integration-Server-and-ESB


  • 2.  RE: Putting java.String[] to IData as String List

    Posted Thu May 16, 2013 02:59 PM

    Just try passing only the email adresss John.Doe@t-systems.com to sender

    I think there is some syntax error in below statement…but not sure about it…
    {“"Dane, John" John.Doe@t-systems.com”};


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods