THREAD,  OBJECTS,  FOR LOOP

HI FORM
I have a method which does some heavy duty mathametical validation and this
method accepts I/p args from a String[6] for ' n' times avaliable via a for loop .
1) How to assign this method to run in a threads in parallel ,so the validation is
avaliable at a same instance .
Please Do advise me with some code.
Thx in advance

I can give more Clarification to this if needed.I think I understand what you're trying to do. Sort of. Enough to suggest how you should do things at least :P
I'm not entirely sure really that threads are the best way to do this, but I also don't know what I/p stuff is :P
But if you do go with the threads still, here's how I'd do it.
for(int row=0; row < rows; row++){
    for (int col=0; col < col; col++) {
        /*this assumes that the textBoxes came from an array,  of the fashion TextBox[rows][cols] which I doubt                 they would.*/
        String text = textBox[row][col].getText()
        Whatever whatever = new Whatever(text);
        Thread t = new Thread(whatever);
        Thread.start();
}public class Whatever implements Runnable {
protected String text;
/** Creates a new instance of Whatever. */
public Whatever(String text) throws Exception{           
this.text= text;
//Whatever this whatever does.
public void run() {     
If you want to get the text as well in your whatever, you could pass it enough information to find it.
As for what you replace my imaginary TextBox array with? I haven't done much with JSPs, and it was quite awhile ago so my memory might be a little fuzzy, but I think you get a Map with key value pairs. In which case you'd do something like
for (String key: map.keySet()){
    String value=map.getValue(key);
    Whatever= new Whatever(text);
    Thread t = new Thread(whatever);
    Thread.start();
}Does that help?

Similar Messages

  • Shared Objects for Threads

    Hi,
    Currently studying for SCJP exam and wondering is there a different between the following codes
    public class Test extends Thread
    static Object obj = new Object();
    static int x, y;
    public void run()
       synchronized(obj)
         for(;;)
          x++; y++; System.out.println(x+" "+y);
    public static void main(String[] args)
       new Test().start();
       new Test().start();
    }and
    public class Test extends Thread
    Object obj = new Object();
    static int x, y;
    public void run()
       synchronized(obj)
         for(;;)
          x++; y++; System.out.println(x+" "+y);
    public static void main(String[] args)
       new Test().start();
       new Test().start();
    In the first code example, is there a shared object between created threads and the second example, is their still a shared object between threads or is a new object created for each thread?
    Cheers!

    Hi,
    In first case, you are acquiring lock on a static object that is of course shared (basic concept) by all instances(of Test). So, for any thread of any instance(of Test) to execute the synchronized block has to wait till any other thread of any other instance(of Test) comes out of synchronized block. It means, all the instances (of Test) are synchronized. In this scenario, you have infinite for loop within synchronized block and you are starting two threads. The thread which enters the synchronized block first will keep on executing and the other thread will never get chance to enter synchronized block.
    In second case, as you are acquiring lock on an object, all the threads of a particular instance (of Test) will be synchronized. In this scenario, again you have infinite for loop within synchronized block and you are starting two threads on two different instances. Hence, both the threads will keep on executing in parallel.
    I hope, you have already executed both the examples and observed output. And also hope that the above explanation will help you to understand the difference between two scenarios.
    Note: Use System.out.println(Thread.currentThread().getName() + " " + x + " " + y); in your synchronized block to track which thread is printing the output.
    Thanks,
    Mrityunjoy

  • Can I use a for loop to add anonymous ActionListener objects?

    I have a setListener() method that has the following inside:
    for(int k = 0; k < buttons.length; k++)
        buttons[k].addActionListener(new ActionListener()
            public void actionPerformed(ActionEvent e)
                g2.setColor(colors[k]);
    }I have a JButton array and a Color array and I was hoping I could add them quickly in one shot rather than manually adding an anonymous ActionListener 9 times (I have 9 components). It tells me I need to make k final for an inner class and when I tested it by removing the for loop and keeping k as a final integer, it works. Is there a medium such that I can achieve what I want more or less while respecting Java's syntax?
    Any input would be greatly appreciated!
    Thanks in advance!

    s3a wrote:
    The local variable exists on the stack for as long as the method is executing. Once the method ends, that variable no longer exists. The newly created object, however, can continue to exist long after the method has ended. So when it's referring to variable X, it cannot refer to the same X as the one in the method, because that variable may no longer exist.Sorry for picking on little details but I am still not fully satisfied.
    Earlier I questioned if the local variable changed, but now let's say that that variable no longer exists at all, why does that even matter if the inner class copied the value and is keeping it for itself? What do you mean? The variable that existed in the method ceased to exist when the method ended. The inner class, however, can continue to live on, and can continue to refer to what we see as the same variable. However, it obviously can't be the same variable, since, in the world of the inner class, it still exists, while in the world of the method, it does not.
    This is completely independent of whether the variable changes or not. Regardless or whether the variable changes we still need two copies--one that goes away when the method's stack frame is popped, and one that lives on as long as the inner object does.
    Then, because there are two copies, the designers decided that the variable has to be final, so that they wouldn't have to mess with the complexity of keeping two variables in sync.
    That explanation leads me to believe that there is no copy and that there is some kind of "permanent umbilical cord" between the inner class and the local variable.Wrong. There has to be a copy. How else could the inner class keep referring to it after the method ends?
    Also, does marking it as final force it to be a permanent constant "variable" even if it's not a field "variable"? Or, similarly, does making a "variable" final make Java pretend that it is a field "variable"?Making a variable final does exactly one thing: It means the value can't change after it's been initialized. This is true of both fields and locals.
    As for the "pointless" byte-counting, I really don't see how it's confusing unless you're an absolute beginner. If I see somebody using a byte, I assume they have a real reason to do so, not pointless byte-hoarding. Then when I see that it's just a loop counter, I wonder WTF they were thinking, and have to spend some time determining if there's a valid reason, or if they're just writing bad code. Using a byte for a loop counter is bad code.
    I could then ask, why are people not using long instead of int and saying that that's using int is too meticulous?Part of it is probably historical. Part of it is because at 4 bytes, and int is exactly on word on the vast majority of hardware that Java has targeted since it came out. 8-byte words are becoming more common (64-bit hardware) but still in the minority.

  • Help with a FOR loop and an object array

    I need to make a for loop that takes an array of objects that contain the parameters year, type, and model (all ints) and sort by year, then divide the array in all the objects with the same year and sort them by type, then divide the array again into the objects with the same year AND type and sort them by model.
    the object a Dress objects, the get methods are get+nameof parameter.
    the array is a 1D array called Dresses.
    I have made a paralell array to store the value of the parameters and sort that then move the array acording to that sorted array. The problem is in the division of the array.

    We'll give your request to do (or finish) your homework for you the attention it deserves.

  • How to terminate or exit a for loop when the user clicks on stop button

    Actually my problem is to stop a loop when i click on stop button.
    example:i have two buttons 'start' and 'stop'
    in start buttom i wrote a for loop as
    dim i as integer
    For i=1 To 100000
    print i
    Next
    when i click on start buuton it prints 'i' value up tp 100000.
    my question is when i click on 'Stop' button the for loop has to terminate or Exit from the  loop and should stops the execution.
    Is it possible to termianate or Exit the 'for loop'
    PS.Shakeer Hussain
    Hyderabad

    I am unable to stop the loop and application not at all allowing to Press the Stop button.
    It seems like Hung, any advise ?
    Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
            btnStop.Enabled = True
            btnSelectFile.Enabled = False
            btnStart.Enabled = False
            btnStop.Focus()
            Dim strFileName As String = txtFileName.Text.ToString
            Dim strLineText As String
            If System.IO.File.Exists(strFileName) = True Then
                Dim objReader As New System.IO.StreamReader(strFileName)
                While objReader.Peek() <> -1 And stopclick = False
                    strLineText = objReader.ReadLine()
                    MsgBox(strLineText, MsgBoxStyle.Information)
                    Application.DoEvents()
                    Thread.Sleep(My.Settings("strDelay") * 1000)
                    'System.Diagnostics.Process.Start(My.Settings("strFireFoxLocation"), strLineText)
                End While
            End If
        End Sub
        Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
            stopclick = True
            btnSelectFile.Enabled = True
            btnStart.Enabled = True
            btnStop.Enabled = False
        End Sub
    Raman Katwal
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Thread Objects?

    Hi, I need help on making thread objects. I have some code similar to this. It runs as an applet.
    //ThreadTest
    import java.awt.*;
    import java.applet.Applet;
    public class ThreadTest extends Applet {
         public void init() {
              new ThreadObject().start();
    public void paint(Graphics g) {
    g.drawstring(""+i,50,50)
    //this is a new file
    //ThreadObject
    public class ThreadObject extends Thread {
         public ThreadObject() {
              for (int i=0;i>9;i++) {
                   System.out.println(i);
    Im trying to make this thread just dispay the numbers 1-9 (I understand that it should only print 9 because it prints i to the coordinates 50,50, so the numbers will overlap)
    but the screen just stays grey. Ive tried changeing the programs tons of times, but I cant get it to work. Please help!

    Ok, first of all, when you extend Thread the code that will be run should be put in the run() method, second, the variable i is only relevent within the for loop, and has nothing to do with the applet, so your line g.drawString(""+i, 50, 50) will not draw i onto the applet, third, there is no code to repaint the applet when you make changes. Take a look at this... I haven't tested it, but it should be about right: //ThreadTest
    import java.awt.*;
    import java.applet.Applet;
    public class ThreadTest extends Applet {
    int var = 0; //This varable holds the number to display
      public void init() {
        new ThreadObject(this).start(); /* I'm having this object send a refference
                                        // to itself so the thread has a way to
                                        // call the repaint method */
      public void update(int i) {
        var = i;
        repaint();
      public void paint(Graphics g) {
        g.drawstring("" + var,50,50)
    public class ThreadObject extends Thread {
    Applet parent;
      public ThreadObject(Applet p) {
        parent = p;
      public void run() {
        for (int i=0;i>9;i++) {
          parent.update(i);
          try {
            Thread.currentThread().sleep(500);/*I'm having the Thread sleep
                                              //for 1/2 second between numbers
                                              */so you can see the numbers change
          } catch(Exception e){System.out.println("Exception: " + e);}
    }Like I said, I haven't tested this, so there may be some little problem, but I think that should be about it.
    Hope it helps
    webaf409java

  • Java - sleep in a for loop doesn't work (as desired)

    Hey all,
    I'm trying to get a draw animation when the mouse is released (after dragging an object to a set area on the screen) - hence I'm trying to do this via a for loop with a small sleep() delay. However it isn't working. The delay is there, but nothing changes until the end of the for loop and then you only see the final repaint() [i.e. instead of each iteration in the for loop]:
    // This program is concerned with this and the mouseDragged methods
         public void mouseReleased(MouseEvent e)
              for( int c = 0; c < xButton.length; c++)
                   if( xButton[c] >= xRandWeight && xButton[c] <= (xRandWeight+50) && yButton[c] >= yRandWeight && yButton[c] <= (yRandWeight+50) )
                        // Have an animation for the scales re-adjusting
                        if( c == 0 )
                             currWeight = (int)(scales.getWeight2());
                             desiredWeight = Integer.parseInt(b1.getLabel());
                             if( desiredWeight >= currWeight )
                                  // More efficient than putting this subtraction straight into for loop
                                  difference = desiredWeight - currWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight+count);
                                       repaint();
                                       try
                                            Thread.currentThread().sleep(100);
                                       catch (InterruptedException in)
                                            in.printStackTrace();
                             else
                                  difference = currWeight - desiredWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight-count);
                                       repaint();
         }Any ideas on how to fix this/meet the goal would be greatly appreciated :)
    Thanks,
    Tristan Perry
    Edited by: TristanPerry on Nov 16, 2008 12:36 PM

    My program isn't being written in SWINGFirst, it's Swing, not SWING. It's not an acronym.
    Perhaps you would like to tell us which windowing toolkit you are using, so that you can get better responses. Or is that a closely guarded secret? <sarcasm/>
    I'm very new to JavaSo ditch the GUI stuff and get a foundation first.
    db

  • How can I repeat a for loop, once it's terms has been fulfilled???

    Well.. I've posted 2 different exceptions about this game today, but I managed to fix them all by myself, but now I'm facing another problem, which is NOT an error, but just a regular question.. HOW CAN I REPEAT A FOR LOOP ONCE IT HAS FULFILLED IT'S TERMS OF RUNNING?!
    I've been trying many different things, AND, the 'continue' statement too, and I honestly think that what it takes IS a continue statement, BUT I don't know how to use it so that it does what I want it too.. -.-'
    Anyway.. Enought chit-chat. I have a nice functional game running that maximum allows 3 apples in the air in the same time.. But now my question is: How can I make it create 3 more appels once the 3 first onces has either been catched or fallen out the screen..?
    Here's my COMPLETE sourcecode, so if you know just a little bit of Java you should be able to figure it out, and hopefully you'll be able to tell me what to do now, to make it repeat my for loop:
    Main.java:
    import java.applet.*;
    import java.awt.*;
    @SuppressWarnings("serial")
    public class Main extends Applet implements Runnable
         private Image buffering_image;
         private Graphics buffering_graphics;
         private int max_apples = 3;
         private int score = 0;
         private GameObject player;
         private GameObject[] apple = new GameObject[max_apples];
         private boolean move_left = false;
         private boolean move_right = false;
        public void init()
            load_content();
            setBackground(Color.BLACK);
         public void run()
              while(true)
                   if(move_left)
                        player.player_x -= player.movement_speed;
                   else if(move_right)
                        player.player_x += player.movement_speed;
                   for(int i = 0; i < max_apples; i++)
                       apple.apple_y += apple[i].falling_speed;
                   repaint();
                   prevent();
                   collision();
              try
              Thread.sleep(20);
              catch(InterruptedException ie)
              System.out.println(ie);
         private void prevent()
              if(player.player_x <= 0)
              player.player_x = 0;     
              else if(player.player_x >= 925)
              player.player_x = 925;     
         private void load_content()
         MediaTracker media = new MediaTracker(this);
         player = new GameObject(getImage(getCodeBase(), "Sprites/player.gif"));
         media.addImage(player.sprite, 0);
         for(int i = 0; i < max_apples; i++)
         apple[i] = new GameObject(getImage(getCodeBase(), "Sprites/apple.jpg"));
         try
         media.waitForAll();     
         catch(Exception e)
              System.out.println(e);
         public boolean collision()
              for(int i = 0; i < max_apples; i++)
              Rectangle apple_rect = new Rectangle(apple[i].apple_x, apple[i].apple_y,
    apple[i].sprite.getWidth(this),
    apple[i].sprite.getHeight(this));
              Rectangle player_rect = new Rectangle(player.player_x, player.player_y,
    player.sprite.getWidth(this),
    player.sprite.getHeight(this));
              if(apple_rect.intersects(player_rect))
                   if(apple[i].alive)
                   score++;
                   apple[i].alive = false;
                   if(!apple[i].alive)
                   apple[i].alive = false;     
         return true;
    public void update(Graphics g)
    if(buffering_image == null)
    buffering_image = createImage(getSize().width, getSize().height);
    buffering_graphics = buffering_image.getGraphics();
    buffering_graphics.setColor(getBackground());
    buffering_graphics.fillRect(0, 0, getSize().width, getSize().height);
    buffering_graphics.setColor(getForeground());
    paint(buffering_graphics);
    g.drawImage(buffering_image, 0, 0, this);
    public boolean keyDown(Event e, int i)
         i = e.key;
    if(i == 1006)
    move_left = true;
    else if(i == 1007)
         move_right = true;
              return true;     
    public boolean keyUp(Event e, int i)
         i = e.key;
    if(i == 1006)
    move_left = false;
    else if(i == 1007)
         move_right = false;
    return true;
    public void paint(Graphics g)
    g.drawImage(player.sprite, player.player_x, player.player_y, this);
    for(int i = 0; i < max_apples; i++)
         if(apple[i].alive)
              g.drawImage(apple[i].sprite, apple[i].apple_x, apple[i].apple_y, this);
    g.setColor(Color.RED);
    g.drawString("Score: " + score, 425, 100);
    public void start()
    Thread thread = new Thread(this);
    thread.start();
    @SuppressWarnings("deprecation")
         public void stop()
         Thread thread = new Thread(this);
    thread.stop();
    GameObject.java:import java.awt.*;
    import java.util.*;
    public class GameObject
    public Image sprite;
    public Random random = new Random();
    public int player_x;
    public int player_y;
    public int movement_speed = 15;
    public int falling_speed;
    public int apple_x;
    public int apple_y;
    public boolean alive;
    public GameObject(Image loaded_image)
         player_x = 425;
         player_y = 725;
         sprite = loaded_image;
         falling_speed = random.nextInt(10) + 1;
         apple_x = random.nextInt(920) + 1;
         apple_y = random.nextInt(100) + 1;
         alive = true;
    And now all I need is you to answer my question! =)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    package forums;
    import java.util.Random;
    import javax.swing.Timer;
    import javax.imageio.ImageIO;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class VimsiesRetardedAppleGamePanel extends JPanel implements KeyListener
      private static final long serialVersionUID = 1L;
      private static final int WIDTH = 800;
      private static final int HEIGHT = 600;
      private static final int MAX_APPLES = 3;
      private static final Random RANDOM = new Random();
      private int score = 0;
      private Player player;
      private Apple[] apples = new Apple[MAX_APPLES];
      private boolean moveLeft = false;
      private boolean moveRight = false;
      abstract class Sprite
        public final Image image;
        public int x;
        public int y;
        public boolean isAlive = true;
        public Sprite(String imageFilename, int x, int y) {
          try {
            this.image = ImageIO.read(new File(imageFilename));
          } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("Bailing out: Can't load images!");
          this.x = x;
          this.y = y;
          this.isAlive = true;
        public Rectangle getRectangle() {
          return new Rectangle(x, y, image.getWidth(null), image.getHeight(null));
      class Player extends Sprite
        public static final int SPEED = 15;
        public Player() {
          super("C:/Java/home/src/images/player.jpg", WIDTH/2, 0);
          y = HEIGHT-image.getHeight(null)-30;
      class Apple extends Sprite
        public int fallingSpeed;
        public Apple() {
          super("C:/Java/home/src/images/apple.jpg", 0, 0);
          reset();
        public void reset() {
          this.x = RANDOM.nextInt(WIDTH-image.getWidth(null));
          this.y = RANDOM.nextInt(300);
          this.fallingSpeed = RANDOM.nextInt(8) + 3;
          this.isAlive = true;
      private final Timer timer = new Timer(200,
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            repaint();
      public VimsiesRetardedAppleGamePanel() {
        this.player = new Player();
        for(int i=0; i<MAX_APPLES; i++) {
          apples[i] = new Apple();
        setBackground(Color.BLACK);
        setFocusable(true); // required to generate key listener events.
        addKeyListener(this);
        timer.setInitialDelay(1000);
        timer.start();
      public void keyPressed(KeyEvent e)  {
        if (e.getKeyCode() == e.VK_LEFT) {
          moveLeft = true;
          moveRight = false;
        } else if (e.getKeyCode() == e.VK_RIGHT) {
          moveRight = true;
          moveLeft = false;
      public void keyReleased(KeyEvent e) {
        moveRight = false;
        moveLeft = false;
      public void keyTyped(KeyEvent e) {
        // do nothing
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        //System.err.println("DEBUG: moveLeft="+moveLeft+", moveRight="+moveRight);
        if ( moveLeft ) {
          player.x -= player.SPEED;
          if (player.x < 0) {
            player.x = 0;
        } else if ( moveRight ) {
          player.x += player.SPEED;
          if (player.x > getWidth()) {
            player.x = getWidth();
        //System.err.println("DEBUG: player.x="+player.x);
        Rectangle playerRect = player.getRectangle();
        for ( Apple apple : apples ) {
          apple.y += apple.fallingSpeed;
          Rectangle appleRect = apple.getRectangle();
          if ( appleRect.intersects(playerRect) ) {
            if ( apple.isAlive ) {
              score++;
              apple.isAlive = false;
        g.drawImage(player.image, player.x, player.y, this);
        for( Apple apple : apples ) {
          if ( apple.isAlive ) {
            g.drawImage(apple.image, apple.x, apple.y, this);
        g.setColor(Color.RED);
        g.drawString("Score: " + score, WIDTH/2-30, 10);
      private static void createAndShowGUI() {
        JFrame frame = new JFrame("Vimsies Retarded Apple Game");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new VimsiesRetardedAppleGamePanel());
        frame.pack();
        frame.setSize(WIDTH, HEIGHT);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args) {
        SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              createAndShowGUI();
    }Hey Vimsie, try resetting a dead apple and see what happens.

  • For loop stop in sub vi from main vi?

    Hi! I want to control from my main vi a sub vi consisting of a stepped sine function generator. This sub vi has a for loop. The problem is that I want to have the option of terminating the loop in the sub vi from the main vi. I tryed using global variables or an event stucture. The problem is that, in both cases, the "stop" variable in my main vi is only updated after the loop terminates in the sub vi. Can anyone please help me? Thank you very much.
    Best regards,
    Diogo Montalvão (Lisbon, Portugal)

    hong2011 wrote:
    I found this thread very helpful. May I ask one thing - what is the purpose of the Occurrence?? If I try it without implementing the Occurrence (neither in main VI or subVI), labview crashes when the subVI completes its task or is stopped from the mainVI.
    A lot of things changed in the last 6 years, so this thread is a bit stale and there are a few other ways to do it. (For example we can have a FOR loop with a conditional terminal).
    You don't provide enough information to answer your question why it crashes. It would be more interesting to know what you are "using" and not what you are "not using". This is not something we can guess by elimination.
    LabVIEW should never crash, so please show us the code that crashes so NI can fix it. What LabVIEW version are you using?
    LabVIEW Champion . Do more with less code and in less time .

  • Creating Activity object for a Service Request object...

    <b>[This thread was migrated from the On Demand Developer Forum in the old Siebel Community] </b>
    drangineni
    New Contributor
    Ho do we use Activity object of a Service Request object. I am trying to
    create an Activity object for a existing Service Request object.
    I am looking for some sample code.
    I greatly appreciate your help.
    Product: CRM OnDemand
    11-26-2006 12:40 PM
    Re: Creating Activity object for a Service Request object...
    BigSlick
    Valued Contributor
    drangineni, What programming language are you using?
    BS
    12-04-2006 10:56 AM
    Re: Creating Activity object for a Service Request object...
    drangineni
    New Contributor
    Hi, I am using C# .
    12-04-2006 07:40 PM
    Re: Creating Activity object for a Service Request object...
    BigSlick
    Valued Contributor
    drangineni, assuming you know the service requestid or externalId of the
    Sr you are dealin gwith you would first set that value.
    ServiceRequest1[] objSRList =new ServiceRequest1[1];
    objSRList[0] = new ServiceRequest1();
    objSRList[0].ServiceRequestId = <YourSRId>;
    Then you create an array of activities and initialize the first one:
    objSRList[0].ListOfActivity = new Activity[1];
    objSRList[0].ListOfActivity[0] = new Activity();
    Now set the data fields
    objSRList[0].ListOfActivity[0].Subject ="My Subject";
    objSRList[0].ListOfActivity[0].Description ="My Description";
    objSRList[0].ListOfActivity[0].Display = "Task"; //valid values are either
    "Task" or "Appointment"
    Then call the ServiceREquestInsertOrUpdate method on the ServiceRequest
    WebService and pass in the above variable.
    BS
    12-06-2006 12:36 PM
    Re: Creating Activity object for a Service Request object...
    drangineni
    New Contributor
    Thank you BigSlick.
    The following error is thrown when I use the
    ServiceRequestInsertOrUpdate(objInput)
    "No user key can be used for the Integration Component instance 'Service <br/>
    Request_Action'.(SBL-EAI-04397)"
    When I use the prxySrvcRequest.ServiceRequestInsert(objInput), no error is
    thrown and the Activity gets added, but a new Service Request object is
    created, but the Activity gets added to an existing Service Request
    object. I greatly appreciate your help.
    The following is the code:
    int ActivityLength = 0;
    WSOD_ServiceRequest.ServiceRequest1[] ServiceRequest = new
    WSOD_ServiceRequest.ServiceRequest1[1];
    ServiceRequest[0] = new WSOD_ServiceRequest.ServiceRequest1();
    ServiceRequest[0].ServiceRequestId = this.Request.QueryString["id"];
    ServiceRequest[0].ListOfActivity = new
    WebSelfService.WSOD_ServiceRequest.Activity[ActivityLength + 1];
    ServiceRequest[0].ListOfActivity[0] = new WSOD_ServiceRequest.Activity();
    ServiceRequest[0].ListOfActivity[ActivityLength].Description =
    this.txtDescription.Text;
    ServiceRequest[0].ListOfActivity[ActivityLength].Display = "Task";
    ServiceRequest[0].ListOfActivity[ActivityLength].Subject = "My Subject";
    WSOD_ServiceRequest.ServiceRequest prxySrvcRequest = new
    WebSelfService.WSOD_ServiceRequest.ServiceRequest();
    WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Input
    objInput = new
    WebSelfService.WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Input();
    WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Output
    objOutput = new
    WebSelfService.WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Output();
    objInput.ListOfServiceRequest = ServiceRequest;
    Session objSession;
    objSession = (Session) Application["Session"];
    prxySrvcRequest.Url = objSession.GetURL();
    try
    objOutput = prxySrvcRequest.ServiceRequestInsertOrUpdate(objInput);
    catch(Exception e)
    12-09-2006 09:53 AM
    Re: Creating Activity object for a Service Request object...
    drangineni
    New Contributor
    Thank you BigSlick.
    The following error is thrown when I use the
    ServiceRequestInsertOrUpdate(objInput)
    "No user key can be used for the Integration Component instance 'Service <br/>
    Request_Action'.(SBL-EAI-04397)"
    When I use the prxySrvcRequest.ServiceRequestInsert(objInput), no error is
    thrown and the Activity gets added, but a new Service Request object is
    created, but the Activity gets added to an existing Service Request
    object. I greatly appreciate your help.
    The following is the code:
    int ActivityLength = 0;
    WSOD_ServiceRequest.ServiceRequest1[] ServiceRequest = new
    WSOD_ServiceRequest.ServiceRequest1[1];
    ServiceRequest[0] = new WSOD_ServiceRequest.ServiceRequest1();
    ServiceRequest[0].ServiceRequestId = this.Request.QueryString["id"];
    ServiceRequest[0].ListOfActivity = new
    WebSelfService.WSOD_ServiceRequest.Activity[ActivityLength + 1];
    ServiceRequest[0].ListOfActivity[0] = new WSOD_ServiceRequest.Activity();
    ServiceRequest[0].ListOfActivity[ActivityLength].Description =
    this.txtDescription.Text;
    ServiceRequest[0].ListOfActivity[ActivityLength].Display = "Task";
    ServiceRequest[0].ListOfActivity[ActivityLength].Subject = "My Subject";
    WSOD_ServiceRequest.ServiceRequest prxySrvcRequest = new
    WebSelfService.WSOD_ServiceRequest.ServiceRequest();
    WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Input
    objInput = new
    WebSelfService.WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Input();
    WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Output
    objOutput = new
    WebSelfService.WSOD_ServiceRequest.ServiceRequestWS_ServiceRequestInsertOrUpdate_Output();
    objInput.ListOfServiceRequest = ServiceRequest;
    Session objSession;
    objSession = (Session) Application["Session"];
    prxySrvcRequest.Url = objSession.GetURL();
    try
    objOutput = prxySrvcRequest.ServiceRequestInsertOrUpdate(objInput);
    catch(Exception e)
    12-10-2006 08:49 AM
    Re: Creating Activity object for a Service Request object...
    BigSlick
    Valued Contributor
    Ah yes, I forgot you also need to specify a unquie Id for the activity.
    It's kinda strange.
    Try adding this:
    ServiceRequest[0].ListOfActivity[ActivityLength].ActivityId = "DummyId";
    //OD will overwrite this with a real Id
    Or if you have a unquie ID for your Activities you can use:
    ServiceRequest[0].ListOfActivity[ActivityLength].ExternalSystemId = <Your
    Unique Value>;
    Hope that helps,
    BS
    12-11-2006 10:52 AM
    Re: Creating Activity object for a Service Request object...
    surgientweb
    New Contributor
    Hi all,
    I have a similar problem, but mine is returning a message that field
    "Display" is required. Looking at this post and the documentation it is
    obvious that Display is a required field, but my WSDL did not include a
    field called "Display", so my proxy did not generate one.
    I tried adding a field called Display to the WSDL and the proxy class, but
    I get a different error... I figure I maybe cannot add it manually like
    that - but I think the bigger problem is it is not part of the WSDL that
    Siebel OD generates for me in my admin account.
    On top of that Display is not shown in the list of fields for Activity
    through the admin interface.. is it possible my account is bugged? Am I
    missing something simple here? BigSlick, I see you mention a .Display in
    your code sample so I thought you might understand what is wrong. Here is
    my code (I am trying to add a activity to a lead).
    Thanks for any insight into this!
    private void InsertLeadActivity(Session session, NameValueCollection data,
    string leadID)
    try
    if (blnDebug)
    Response.Write("Setting up Activity<br>";
    // instantiate the proxy service
    Activity_Service.Activity activityProxy = new Activity_Service.Activity();
    // set up the target URL
    activityProxy.Url = session.GetURL();
    activityProxy.CookieContainer = session.GetCookieContainer();
    // set up input argument
    ActivityNWS_Activity_Insert_Input input = new
    ActivityNWS_Activity_Insert_Input();
    input.ListOfActivity = new Activity1[1];
    input.ListOfActivity[0] = new Activity1();
    if (blnDebug)
    Response.Write("Getting Data<br>";
    // dg note: name value
    // input.ListOfActivity[0].MrMrs = data["MrMrs"];
    input.ListOfActivity[0].LeadId = leadID.ToString();
    input.ListOfActivity[0].Description = DataToString(data);
    input.ListOfActivity[0].Subject = "Website Submission Activity";
    input.ListOfActivity[0].Priority = "3-Low";
    //input.ListOfActivity[0].DueDate =
    DateTime.Now.AddDays(7).ToShortDateString();
    input.ListOfActivity[0].Owner = this.defaultLeadOwner;
    input.ListOfActivity[0].Type = "Call";
    //input.ListOfActivity[0].Display = "Task";
    input.ListOfActivity[0].ActivityId = "DummyId";
    input.ListOfActivity[0].ExternalSystemId = "web";
    activityProxy.Activity_Insert(input);
    catch (Exception exInsertActivity1)
    if (blnDebug)
    Response.Write("<br>Error inserting activity.<br><br>" +
    exInsertActivity1.ToString() + "<br>";
    01-06-2007 05:05 PM
    Re: Creating Activity object for a Service Request object...
    surgientweb
    New Contributor
    Figured it out.. the field "Display" is also known as "Activity"........
    Here are some notes for other people.. good luck and feel free to write me
    at raskawa-at-gmail-com if you want a code sample.
    Some unpublished nice to knows for Siebel On Demand Activities....
    In summary:
    - .Activity is also known as Display in documentation and on the error
    messages coming back from the WS. Also, it appears based on these boards
    some people actually have a .Display field. Maybe different accounts
    generate different WSDL's.... buggy.
    - If a error message is thrown saying "Description is required" it really
    means "Subject is required" (make sure .Subject has a value)
    - If a error message is thrown complaining that ActionType is not right..
    that is really .Type.. make sure it's lookup value is valid for the
    dropdown values in your CRM OD system.
    My code/values that worked..
    input.ListOfActivity[0].LeadId = leadID.ToString();
    input.ListOfActivity[0].Description = DataToString(data);
    input.ListOfActivity[0].Subject = "Website Submission Activity";
    input.ListOfActivity[0].Priority = "3-Low";
    //input.ListOfActivity[0].DueDate =
    DateTime.Now.AddDays(7).ToShortDateString();
    input.ListOfActivity[0].Owner = this.defaultLeadOwner;
    input.ListOfActivity[0].Type = "Call";
    input.ListOfActivity[0].ActivityId = "DummyId";
    input.ListOfActivity[0].ExternalSystemId = "web";
    //input.ListOfActivity[0].Display = "Task"; //doesn't work
    input.ListOfActivity[0].Activity = "Task"; //does work.
    01-06-2007 05:17 PM
    Re: Creating Activity object for a Service Request object...
    raskawa
    First Time Contributor
    Hi,
    This is surgientweb (under my own login now..)
    Anyway, I wanted to add that I figured out that there are two ways to add
    a Activity to a Lead. Via the Lead object (by getting a ListOfActivities)
    OR by creating a Activity directly and just adding your "LeadID" to it (or
    you can also add a "ContactID" to relate the activity to a Contact.)
    Feel free to email me for a code example (raskawa....at....gmail)
    -David
    01-09-2007 02:58 PM

    Hi Stephane,
    You can definitely read the categories using Tables in CRM. The logic is a bit complicated though.
    Use the following steps to retrieve Categories using Std. CRM Tables:
    1. Pass transaction GUID in field GUID of table CRMV_REPORT_SUBJ and get KATALOGART, CODEGRUPPE and CODE field values in lv_catalog, lv_codegrp and lv_code.
    2. Now you need to concatenate these 3 fields values carefully like this:
    CONCATENATE lv_catelog lv_codegrp '    ' lv_code into lv_category1.
    Remember there are 4 spaces between lv_codegrp and lv_code.
    3. Now pass this lv_category1 in field OBJEXT in table CRMC_ERMS_CAT_OK and get OBJGUID in field lv_objguid.
    4. Pass this lv_objguid in field OBJ_GUID and LNK_TYPE = 'IS_CODE' in table CRMC_ERMS_CAT_LN and get value of CAT_GUID in lv_cat_guid.
    5. Pass this lv_cat_guid in field CAT_GUID in table CRMC_ERMS_CAT_CA and get value of CAT_ID in field lv_cat_text.
    Remember this lv_cat_text is the text value of your last level of category of transaction.
    6. To get its upper cateogry level value, simply use table CRMC_ERMS_CAT_HI and get parent guid value and pass this as CAT_GUID again in table CRMC_ERMS_CAT_CA to get its text.
    Alternatively, you can also use class method cl_crm_ml_category_util=>get_parse_all to get all levels of categories.
    Hope this helps.
    Thanks
    Vishal

  • For loop- seems to be just going to last value

    Hi guys, carrying on from the thread I created yesterday I have managed to get the socket working between my server and my client, but I am having an issue when re-constructing a string that is being sent from the client to the server. I am talking about the for loop in line 151, which seems to just going straight to the last value of the for loop and thus the board isn't being reconstructed properly.
    I'm including both the server and client code which just needs to compiled (host is set to localhost on port 4500) and you will see what I mean after inputting a move from the client. Can anyone spot the problem?
    Server code
    import java.io.*;
    import java.net.*;
    import javax.swing.JOptionPane;
    class Server
         public static void main (String []args) throws IOException
              try
                   Server();     
              catch (IOException ex)
         public static void Server () throws IOException
              ServerSocket serverSocket=null;
              int portNo=4500;
              System.out.println("Starting");
              try
                   serverSocket=new ServerSocket(portNo);     
              catch (IOException ex)
                   System.err.println("Could not create socket on port" +portNo);
                   System.exit(1);
              System.out.println("Socket listening");
              Socket clientSocket=null;
              try
                   clientSocket=serverSocket.accept();
              catch (IOException ex)
                   System.out.println("Accept failed");
                   System.exit(1);
              PrintWriter out= new PrintWriter(clientSocket.getOutputStream(), true);
              BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
              //coordinates
              String coordinates[] [] = new String [8] [8];
              for (int i=0;i<8;i++)
                   for (int j=0;j<8;j++)
                        if ((i%2!=0)&&(j%2!=0))
                             coordinates[i] [j]="#";
                        else if ((i%2!=0)&&(j%2==0))
                             coordinates[i] [j]=" ";
                        else if ((i%2==0)&&(j%2!=0))
                             coordinates[i] [j]=" ";
                        else
                             coordinates[i] [j]="#";
              coordinates[0][0]="R";
              coordinates[0][1]="N";
              coordinates[0][2]="B";
              coordinates[0][3]="Q";
              coordinates[0][4]="K";
              coordinates[0][5]="B";
              coordinates[0][6]="N";
              coordinates[0][7]="R";
              for (int i=0;i<8;i++)
                   coordinates[1]="P";
              coordinates[7][0]="r";
              coordinates[7][1]="n";
              coordinates[7][2]="b";
              coordinates[7][3]="q";
              coordinates[7][4]="k";
              coordinates[7][5]="b";
              coordinates[7][6]="n";
              coordinates[7][7]="r";
              for (int i=0;i<8;i++)
                   coordinates[6][i]="p";
              Board board1=new Board(coordinates);
              boolean gameStart=true;
              String coord="";
              String originX="";
              String originY="";
              String destinationX="";
              String destinationY;
              while (gameStart)
                   System.out.println("trying to read from client");
                   String input="";
                   try
                        input=in.readLine();     
                        System.out.println(input);
                   catch (IOException ex)
                        System.out.println("Read failed");
                        System.exit(1);
                   originX=input.substring(65);
                   originY=input.substring(66);     
                   destinationX=input.substring(67);
                   destinationY=input.substring(68);
                   coord=input.substring(0,64);
                   System.out.println(coord);
                   for (int p=0;p<64;p++)
                        System.out.println(p);
                        for (int i=0;i<8;i++)
                             for (int j=0;j<8;j++)
                                  coordinates [i] [j]=coord.substring(p);
                                  if (i==(Integer.parseInt(originX))&&(j==(Integer.parseInt(originY))))
                                       String piece="";
                                       piece=coordinates [i] [j];
                                       if ((i%2!=0)&&(j%2!=0))
                                            coordinates[i] [j]="#";
                                       else if ((i%2!=0)&&(j%2==0))
                                            coordinates[i] [j]=" ";
                                       else if ((i%2==0)&&(j%2!=0))
                                            coordinates[i] [j]=" ";
                                       else
                                            coordinates[i] [j]="#";
                                       for (int s=0;s<8;s++)
                                            for (int t=0;t<8;t++)
                                                 if (s==(Integer.parseInt(destinationX))&&(t==(Integer.parseInt(destinationY))))
                                                      coordinates [s] [t]=piece;
                   board1.printBoard(coordinates);
              out.close();
              in.close();     
              clientSocket.close();
              serverSocket.close();          
    class Board
         boolean gameStart=true;
         public Board()
         public Board(String [] [] coordinates)
              printBoard(coordinates);
         String [] [] getCoOrdinates(String [] [] coordinates)
              return coordinates;
         public static void update (String coordinates [] [])
              printBoard(coordinates);
         public static void printBoard(String coordinates[] [])
              for (int i=0;i<8;i++)
                   for (int j=0;j<8;j++)
                        System.out.print(coordinates[i][j]);
                   System.out.println();
    }Client code:import java.io.*;
    import java.net.*;
    import javax.swing.JOptionPane;
    class Client
         public static void main (String [] args) throws IOException
              Socket socket=null;
              PrintWriter out=null;
              BufferedReader in=null;
              String serverLocation="localhost";
              int portNo=4500;
              System.out.println("Starting");
              try
                   socket= new Socket (serverLocation,portNo);
                   out= new PrintWriter(socket.getOutputStream(),true);
                   in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              catch (UnknownHostException ex)
                   System.out.println("Cannot find" + serverLocation);
                   System.exit(1);     
              catch (IOException ex1)
                   System.out.println("IO problem");
                   System.exit(1);
              System.out.println("Connected");
              //coordinates
              String coordinates[] [] = new String [8] [8];
              for (int i=0;i<8;i++)
                   for (int j=0;j<8;j++)
                        if ((i%2!=0)&&(j%2!=0))
                             coordinates[i] [j]="#";
                        else if ((i%2!=0)&&(j%2==0))
                             coordinates[i] [j]=" ";
                        else if ((i%2==0)&&(j%2!=0))
                             coordinates[i] [j]=" ";
                        else
                             coordinates[i] [j]="#";
              coordinates[0][0]="R";
              coordinates[0][1]="N";
              coordinates[0][2]="B";
              coordinates[0][3]="Q";
              coordinates[0][4]="K";
              coordinates[0][5]="B";
              coordinates[0][6]="N";
              coordinates[0][7]="R";
              for (int i=0;i<8;i++)
                   coordinates[1][i]="P";
              coordinates[7][0]="r";
              coordinates[7][1]="n";
              coordinates[7][2]="b";
              coordinates[7][3]="q";
              coordinates[7][4]="k";
              coordinates[7][5]="b";
              coordinates[7][6]="n";
              coordinates[7][7]="r";
              for (int i=0;i<8;i++)
                   coordinates[6][i]="p";
              Board board1=new Board(coordinates);
              boolean gameStart=true;
              String coord="";
              while (gameStart)
                   String originMove=JOptionPane.showInputDialog(null,"Client Origin Move","Enter in origin of piece",JOptionPane.QUESTION_MESSAGE);
                   String destinationMove=JOptionPane.showInputDialog(null,"Client Destination Move","Enter in destination of piece",JOptionPane.QUESTION_MESSAGE);
                   for (int i=0;i<8;i++)
                        for (int j=0;j<8;j++)
                             coord=coord+coordinates[i][j];
                   System.out.println(coord);
                   out.println(coord+originMove+destinationMove);
                   System.out.println("passed");
              out.close();
              in.close();
              socket.close();
    class Board
         boolean gameStart=true;
         public Board()
         public Board(String [] [] coordinates)
              printBoard(coordinates);
         String [] [] getCoOrdinates(String [] [] coordinates)
              return coordinates;
         public static void update (String coordinates [] [])
              printBoard(coordinates);
         public static void printBoard(String coordinates[] [])
              for (int i=0;i<8;i++)
                   for (int j=0;j<8;j++)
                        System.out.print(coordinates[i][j]);
                   System.out.println();
    }Cheers,
    Ben                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    jverd wrote:
    p595659 wrote:
    1) I don't think that even compiles. Since you're catching IOException, your throws clause is bogus--that method can never throw IOE.I have removed the try and catch statements in the main method. I cannot, however get rid of the throws IOException in the main method other my program won't compile.Right. Don't catch it, since you're not handling it. Just declare that it throws it.
    Indeed, this is what I have done :)
    >
    3) Don't name methods the same as your class name.See answer to 4.
    4) Start method names with lowercase letters.
    try
    serverSocket=new ServerSocket(portNo);     
    catch (IOException ex)
    System.err.println("Could not create socket on port" +portNo);
    System.exit(1);
    ServerSocket is a part of the java.net package. I am just creating an instance of it. http://java.sun.com/j2se/1.4.2/docs/api/java/net/ServerSocket.html
    I don't know what you're talking about. You had a class named Server and a method named Server. That's confusing.Changed- I didn't spot it, so I have named it startServer now.
    >
    5) There's almost no point to ever calling System.exit. Here, again, since you're not
    actually handling the exception, don't bother catcing it.Sorry, but this was how I was taught when I started java. My understanding is that System.exit properly terminated applications so this freed up memory so it's abit of a habit of mine, is this wrong to do in this instance?Calling it in response to an exception is wrong. It's not that method's job to decide to shut down the VM. Just let the exception bubble up (or else handle it properly). You do not need to call System.exit to free up memory. It's freed up automatically when the VM exits. The OS takes care of that, without any help from you.Removed- thanks for clearing that up for me :)
    JacobsB wrote:
    line 151 of the server code or client code?Line 151 of my server code. My client is working fine up to this step of the programming I have done- it's just the server part I'm having issues with. You can compile and run the client fine- you can compile the server but as explained in the original post, I'm having a logical error when redrawing the board when it gets the 68 charecter string from the client (first 64 charecters are for the board, then the original position (x and y respectively), followed up the new position (x and y respectively again).
    I'm including an updated version of the code, after all the comments above so we have an updated version for trying to solve the problem I'm having. The client code does not need to be updated as it has not changed yet, so you can use the code in the original post.
    import java.io.*;
    import java.net.*;
    import javax.swing.JOptionPane;
    class Server
         public static void main (String []args) throws IOException
              startServer();     
         public static void startServer () throws IOException
              ServerSocket serverSocket=null;
              int portNo=4500;
              System.out.println("Starting");
              try
                   serverSocket=new ServerSocket(portNo);     
              catch (IOException ex)
                   System.err.println("Could not create socket on port" +portNo);
                   ex.printStackTrace();
              System.out.println("Socket listening");
              Socket clientSocket=null;
              try
                   clientSocket=serverSocket.accept();
              catch (IOException ex)
                   System.out.println("Accept failed");
                   ex.printStackTrace();
              PrintWriter out= new PrintWriter(clientSocket.getOutputStream(), true);
              BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
              //coordinates
              String coordinates[] [] = new String [8] [8];
              for (int i=0;i<8;i++)
                   for (int j=0;j<8;j++)
                        if ((i%2!=0)&&(j%2!=0))
                             coordinates[i] [j]="#";
                        else if ((i%2!=0)&&(j%2==0))
                             coordinates[i] [j]=" ";
                        else if ((i%2==0)&&(j%2!=0))
                             coordinates[i] [j]=" ";
                        else
                             coordinates[i] [j]="#";
              coordinates[0][0]="R";
              coordinates[0][1]="N";
              coordinates[0][2]="B";
              coordinates[0][3]="Q";
              coordinates[0][4]="K";
              coordinates[0][5]="B";
              coordinates[0][6]="N";
              coordinates[0][7]="R";
              for (int i=0;i<8;i++)
                   coordinates[1]="P";
              coordinates[7][0]="r";
              coordinates[7][1]="n";
              coordinates[7][2]="b";
              coordinates[7][3]="q";
              coordinates[7][4]="k";
              coordinates[7][5]="b";
              coordinates[7][6]="n";
              coordinates[7][7]="r";
              for (int i=0;i<8;i++)
                   coordinates[6][i]="p";
              Board board1=new Board(coordinates);
              boolean gameStart=true;
              String coord="";
              String originX="";
              String originY="";
              String destinationX="";
              String destinationY;
              while (gameStart)
                   System.out.println("trying to read from client");
                   String input="";
                   try
                        input=in.readLine();     
                        System.out.println(input);
                   catch (IOException ex)
                        System.out.println("Read failed");
                        ex.printStackTrace();
                   coord=input.substring(0,64);                    
                   originX=input.substring(64,65);
                   originY=input.substring(65,66);     
                   destinationX=input.substring(66,67);
                   destinationY=input.substring(67,68);
                   System.out.println(coord);
                   for (int p=0;p<64;p++)
                        System.out.println(p);
                        for (int i=0;i<8;i++)
                             for (int j=0;j<8;j++)
                                  coordinates [i] [j]=coord.substring(p);
                                  if (i==Integer.parseInt(originX)&&(j==(Integer.parseInt(originY))))
                                       String piece="";
                                       piece=coordinates [i] [j];
                                       if ((i%2!=0)&&(j%2!=0))
                                            coordinates[i] [j]="#";
                                       else if ((i%2!=0)&&(j%2==0))
                                            coordinates[i] [j]=" ";
                                       else if ((i%2==0)&&(j%2!=0))
                                            coordinates[i] [j]=" ";
                                       else
                                            coordinates[i] [j]="#";
                                       for (int s=0;s<8;s++)
                                            for (int t=0;t<8;t++)
                                                 if (s==(Integer.parseInt(destinationX))&&(t==(Integer.parseInt(destinationY))))
                                                      coordinates [s] [t]=piece;
                   board1.printBoard(coordinates);
              out.close();
              in.close();     
              clientSocket.close();
              serverSocket.close();          
    class Board
         boolean gameStart=true;
         public Board()
         public Board(String [] [] coordinates)
              printBoard(coordinates);
         String [] [] getCoOrdinates(String [] [] coordinates)
              return coordinates;
         public static void update (String coordinates [] [])
              printBoard(coordinates);
         public static void printBoard(String coordinates[] [])
              for (int i=0;i<8;i++)
                   for (int j=0;j<8;j++)
                        System.out.print(coordinates[i][j]);          
                   System.out.println();
    }Ben                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How do I use For loop to check each node and import them to a new document?

    In my function I would like to use a For loop to get all the statutes (xml) inside the object
    objXmlBcaResponseDoc. In my case there are 2 statutes. I would like the output to look like the one I have posted here below. I am not sure how to do the For loop. The commented For loop is from another function but it is not working inside
    this function.
    The output is added into the **objXmlResponseMessageDoc** object and should look like this with 2 statutes (ns1:Statute) and a totalCount=2
    <BasicSearchQueryResponse xmlns="http://crimnet.state.mn.us/mnjustice/statute/service/4.0">
    <StatutesXml>
    <Statutes runType="Request" runDateTime="2015-03-17T10:23:04" totalCount="2">
    <ns1:Statute xmlns:ns1="http://crimnet.state.mn.us/mnjustice/statute/messages/4.0">
    <StatuteId xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">8471</StatuteId>
    <Chapter xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">60</Chapter>
    <Section xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">55</Section>
    <Subdivision xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0"/>
    </ns1:Statute>
    <ns1:Statute>
    <StatuteId xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">9722</StatuteId>
    <Chapter xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">90</Chapter>
    <Section xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">25</Section>
    <Subdivision xsi:nil="true" xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0"/>
    </ns1:Statute>
    </Statutes>
    </StatutesXml>
    </BasicSearchQueryResponse>
    My xml doc is found inside objXmlBcaResponseDoc Here is xml inside
    objXmlBcaResponseDoc object
    <BasicSearchQueryResponse xmlns="http://crimnet.state.mn.us/mnjustice/statute/service/4.0">
    <ns1:Statutes xmlns:ns1="http://crimnet.state.mn.us/mnjustice/statute/messages/4.0">
    <ns1:Statute>
    <StatuteId xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">8471</StatuteId>
    <Chapter xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">60</Chapter>
    <Section xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">55</Section>
    <Subdivision xsi:nil="true" xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0"/>
    </ns1:Statute>
    <ns1:Statute>
    <StatuteId xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">9722</StatuteId>
    <Chapter xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">90</Chapter>
    <Section xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0">25</Section>
    <Subdivision xsi:nil="true" xmlns="http://crimnet.state.mn.us/mnjustice/statute/4.0"/>
    </ns1:Statute>
    </BasicSearchQueryResponse>
    Here is my function
    Function GetStatutesByChapter(ByVal aobjXmlGetStatuteRequestNode As XmlNode, ByVal aobjXMLNameSpaceManager As XmlNamespaceManager, ByVal aobjBroker As ServiceCatalog.Library.v4.Broker) As XmlDocument
    Dim objXmlRequestMessageDoc As XmlDocument
    Dim objXmlResponseMessageDoc As XmlDocument
    Dim intCount As Integer
    aobjBroker.PostMessageWarehouseInformationalMessage("Chapter found.", 1)
    objXmlResponseMessageDoc = New XmlDocument
    'Add the first element into the document GetStatuteByChapter with its namespace
    objXmlResponseMessageDoc.AppendChild(objXmlResponseMessageDoc.CreateElement("BasicSearchQueryResponse", "http://crimnet.state.mn.us/mnjustice/statute/service/4.0"))
    'Build the initial response document
    objXmlResponseMessageDoc = New XmlDocument
    'Add the first element into the document GetStatutesResponse with its namespace
    objXmlResponseMessageDoc.AppendChild(objXmlResponseMessageDoc.CreateElement("GetStatutesResponse", "http://www.courts.state.mn.us/StatuteService/1.0"))
    'Add a child node to the GetStatutesResponse node
    objXmlResponseMessageDoc.SelectSingleNode("ss:GetStatutesResponse", aobjXMLNameSpaceManager).AppendChild(objXmlResponseMessageDoc.CreateElement("StatutesXml", "http://www.courts.state.mn.us/StatuteService/1.0"))
    objXmlResponseMessageDoc.SelectSingleNode("ss:GetStatutesResponse/ss:StatutesXml", aobjXMLNameSpaceManager).AppendChild(objXmlResponseMessageDoc.CreateElement("Statutes", "http://www.courts.state.mn.us/StatuteService/1.0"))
    'Convert the node Statutes into an element and set the runType attribute (runType="Request") by adding it's value Request
    CType(objXmlResponseMessageDoc.SelectSingleNode("ss:GetStatutesResponse/ss:StatutesXml/ss:Statutes", aobjXMLNameSpaceManager), System.Xml.XmlElement).SetAttribute("runType", "Request")
    'Convert the node Statutes into an element and set the attribute (runDateTime="2015-03-05T10:29:40") by adding it
    CType(objXmlResponseMessageDoc.SelectSingleNode("ss:GetStatutesResponse/ss:StatutesXml/ss:Statutes", aobjXMLNameSpaceManager), System.Xml.XmlElement).SetAttribute("runDateTime", Format(Now, "yyyy-MM-ddTHH:mm:ss"))
    'Create the BCA request message
    objXmlRequestMessageDoc = New XmlDocument
    objXmlRequestMessageDoc.AppendChild(objXmlRequestMessageDoc.CreateElement("ns:BasicSearchQueryRequest", aobjXMLNameSpaceManager.LookupNamespace("ns")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns1:BasicSearchCriteria", aobjXMLNameSpaceManager.LookupNamespace("ns1")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest/ns1:BasicSearchCriteria", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns2:Chapter", aobjXMLNameSpaceManager.LookupNamespace("st")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest/ns1:BasicSearchCriteria", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns2:Section", aobjXMLNameSpaceManager.LookupNamespace("st")))
    objXmlRequestMessageDoc.SelectSingleNode("ns:BasicSearchQueryRequest/ns1:BasicSearchCriteria", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns2:Subdivision", aobjXMLNameSpaceManager.LookupNamespace("st")))
    'Uncomment last working section below
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Chapter", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Chapter", aobjXMLNameSpaceManager).InnerText
    'check if there is a section and or subdivision if it is there then set the value
    If Not (aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Section", aobjXMLNameSpaceManager) Is Nothing) Then
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Section", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Section", aobjXMLNameSpaceManager).InnerText
    End If
    If Not (aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Subdivision", aobjXMLNameSpaceManager) Is Nothing) Then
    objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns1:BasicSearchCriteria/st:Subdivision", aobjXMLNameSpaceManager).InnerText = aobjXmlGetStatuteRequestNode.SelectSingleNode("ss:Statute/ss:Subdivision", aobjXMLNameSpaceManager).InnerText
    End If
    'check if there is a section and or subdivision if it is there then set the value
    aobjBroker.PostMessageWarehouseSnapshot(objXmlRequestMessageDoc.OuterXml, "Request Message", 1)
    'Call the BCA service
    intCount = 0
    'This is where I want to use a For loop to check for the statutes found using the Chapter
    'Loop through each Id
    'For Each objXmlStatuteIdNode In aobjXmlGetStatuteRequestNode.SelectNodes("ss:Statute/ss:StatuteId/ss:Id[string-length(.)>0]", aobjXMLNameSpaceManager)
    'Create the BCA request message
    'objXmlRequestMessageDoc = New XmlDocument
    'objXmlRequestMessageDoc.AppendChild(objXmlRequestMessageDoc.CreateElement("ns:SingleStatuteRequest", aobjXMLNameSpaceManager.LookupNamespace("ns")))
    'objXmlRequestMessageDoc.SelectSingleNode("ns:SingleStatuteRequest", aobjXMLNameSpaceManager).AppendChild(objXmlRequestMessageDoc.CreateElement("ns:statuteId", aobjXMLNameSpaceManager.LookupNamespace("ns")))
    'objXmlRequestMessageDoc.DocumentElement.SelectSingleNode("ns:statuteId", aobjXMLNameSpaceManager).InnerText = objXmlStatuteIdNode.InnerText aobjBroker.PostMessageWarehouseSnapshot(objXmlRequestMessageDoc.OuterXml, "Request Message", 1)
    'intCount = intCount + 1
    'objXmlBcaResponseDoc = New XmlDocument
    'File name is BCASearchQueryResponse.xml
    'objXmlBcaResponseDoc.Load("\\j00000swebint\mscapps\deve\appfiles\temp\BCASearchQueryResponse.xml")
    'objXmlResponseMessageDoc.DocumentElement.SelectSingleNode("ss:StatutesXml/ss:Statutes", aobjXMLNameSpaceManager).AppendChild(objXmlResponseMessageDoc.ImportNode(objXmlBcaResponseDoc.DocumentElement.SelectSingleNode("ns1:Statute", aobjXMLNameSpaceManager), True))
    'Next
    'Count how many Statute nodes found
    CType(objXmlResponseMessageDoc.SelectSingleNode("ss:BasicSearchQueryResponse/ss:StatutesXml/ss:Statutes", aobjXMLNameSpaceManager), System.Xml.XmlElement).SetAttribute("totalCount", CStr(intCount))
    Return objXmlResponseMessageDoc
    End Function

    What is XPath and what does it do that you're impressed with?
    Yes, I see your link, but give me the abbreviated elevator speech on what it is please. It has me curious.
    http://searchsoa.techtarget.com/definition/XPath
    http://www.techrepublic.com/article/easily-navigate-xml-with-vbnet-and-xpath/
    http://www.techrepublic.com/article/using-xpath-string-functions-in-xslt-templates/
    The way that all this is being used by me now on a project is the HTML controls on the screen are built by XML not only about what the controls are and their attributes,   but the data from from the database is XML too with both going through transfermations
    vis XSLT as the HTML controls are built dynamically by XML data for the controls and the XML database data with decision being made in the transfermation on the fly.
    There are many usages with Xpath not just this one I am talking about with Xpath. You can do the same kind of thing with XAML and WPF forms as they are dynamically built. But it goes well beyond what I am talking about and the usage of Xpath. Xpath 3.0
    is the latest version. 
    http://www.balisage.net/Proceedings/vol10/html/Novatchev01/BalisageVol10-Novatchev01.html
    Thanks - I'll look into that at some point.
    Still lost in code, just at a little higher level.

  • Passing an array in a for loop to a procedure

    I am trying to pass an array in a cursor for loop to a procedure which performs a table insert using the array's contents. Somehow I am missing something, or it is not possible. The compile error states: PLS-00306: wrong number or types in call to 'insert_address' I checked to be sure I am creating the arrays in both cases from similar data objects. Both address and work_address_table contain the same 4 columns with the same data types.
    create or replace package work_address as
    FUNCTION populate_address return boolean;
    procedure insert_address(in_address IN work_address_table%ROWTYPE);
    end work_address;
    create or replace package body work_address as
    function populate_address return boolean is
    cursor c1 is
    select 'H' as header,
    street1 as street
    city as city,
    NULL as state
    from address
    where city = 'HANOVER';
    TYPE addressT IS TABLE OF c1%ROWTYPE INDEX BY BINARY_INTEGER;
    rec1 addressT;
    BEGIN
    OPEN c1;
    FETCH c1 BULK COLLECT INTO rec1 LIMIT 500;
    FOR i IN 1..rec1.count LOOP
    rec1(i).state := 'US'
    insert_address(rec1(i));
    exit when c1%notfound;
    END LOOP;
    CLOSE c1;
    return TRUE;
    END populate_address;
    PROCEDURE insert_address(in_address IN work_address_table%ROWTYPE) IS
    BEGIN
    INSERT INTO work_address_table
    VALUES (in_address.header,
    in_address.street,
    in_address.city,
    in_address.state);
    COMMIT;
    END insert_address;
    END work address;
    /

    Both address and work_address_table contain the same 4 columns with the same data types.Are you 100% sure about this?
    SQL> declare
      cursor c1
      is
        select 1 deptno, dummy dname, 'Loc' location from dual;
      type addresst is table of c1%rowtype
        index by binary_integer;
      rec1   addresst;
      procedure p (d dept%rowtype)
      as
      begin
        dbms_output.put_line(d.dname);
      end p;
    begin
      rec1 (1).dname := 'z';
      p (rec1 (1));
    end;
    z
    PL/SQL procedure successfully completed.but changing just the first column of the cursor:
    SQL> declare
      cursor c1
      is
        select 'xy' deptno, dummy dname, 'Loc' location from dual;
      type addresst is table of c1%rowtype
        index by binary_integer;
      rec1   addresst;
      procedure p (d dept%rowtype)
      as
      begin
        dbms_output.put_line(d.dname);
      end p;
    begin
      rec1 (1).dname := 'z';
      p (rec1 (1));
    end;
    Error at line 3
    ORA-06550: line 20, column 3:
    PLS-00306: wrong number or types of arguments in call to 'P'
    ORA-06550: line 20, column 3:
    PL/SQL: Statement ignored

  • Calling a CAF program via web service generates QName cannot be null error, but only for 1/5 of the same call in a parallel for loop.

    I'm calling 5 identical web service calls using a parallel for loop in BPM. Obviously the data in each slightly differs. Why would this call suspend the process and give the following errors:
    handleCommunicationError( ErrorContextData, Throwable, TransitionTicket ): A technical error occurred.
    Interface namespace = myNamespace
    Interface name = myService
    Operation name = myOperation
    Connectivity type = WS
    Application name = myAppName
    Reference name = 8bd95deb-8cf1-453d-94e5-0576bb385149
    Message Id = null
    WS style = DOC
    Start time of WS call = 2014-02-26 17:51:23.297
    Return time of WS call = 2014-02-26 17:51:23.412
    Principal name = SAP_BPM_Service
    Root error message = local part cannot be "null" when creating a QName
    Error message = Could not invoke service reference name 8bd95deb-8cf1-453d-94e5-0576bb385149, component name myComp application name myappname
    com.sap.engine.interfaces.sca.exception.SCADASException: Could not invoke service reference name 8bd95deb-8cf1-453d-94e5-0576bb385149, component name
    myCompname
    at com.sap.engine.services.sca.das.SCADASImpl.invokeReference(SCADASImpl.java:341)
    at com.sap.glx.adapter.app.ucon.SCADASWrapperImpl.invoke(SCADASWrapperImpl.java:101)
    at com.sap.glx.adapter.app.ucon.UnifiedWebServiceCallObject.invokeWebServiceOperation(UnifiedWebServiceCallObject.java:101)
    at com.sap.glx.adapter.app.ucon.UnifiedWebServiceCallClass.invoke(UnifiedWebServiceCallClass.java:178)
    at com.sap.glx.core.dock.impl.DockObjectImpl.invokeMethod(DockObjectImpl.java:657)
    at com.sap.glx.core.kernel.trigger.config.Script$MethodInvocation.execute(Script.java:248)
    at com.sap.glx.core.kernel.trigger.config.Script.execute(Script.java:798)
    at com.sap.glx.core.kernel.execution.transition.ScriptTransition.execute(ScriptTransition.java:78)
    at com.sap.glx.core.kernel.execution.transition.Transition.commence(Transition.java:196)
    at com.sap.glx.core.kernel.execution.LeaderWorkerPool$Follower.run(LeaderWorkerPool.java:163)
    at com.sap.glx.core.resource.impl.common.WorkWrapper.run(WorkWrapper.java:58)
    at com.sap.glx.core.resource.impl.j2ee.J2EEResourceImpl$Sessionizer.run(J2EEResourceImpl.java:261)
    at com.sap.glx.core.resource.impl.j2ee.ServiceUserManager$ServiceUserImpersonator$1.run(ServiceUserManager.java:152)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:337)
    at com.sap.glx.core.resource.impl.j2ee.ServiceUserManager$ServiceUserImpersonator.run(ServiceUserManager.java:149)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:185)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:302)
    Caused by: java.lang.IllegalArgumentException: Could not process message for operation myOperation in web service plugin module.
    at com.sap.engine.services.sca.plugins.ws.WebServiceImplementationInstance.accept(WebServiceImplementationInstance.java:228)
    at com.sap.engine.services.sca.das.SCADASImpl.invokeReference(SCADASImpl.java:314)
    ... 19 more
    Caused by: java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName
    at javax.xml.namespace.QName.<init>(QName.java:246)
    at javax.xml.namespace.QName.<init>(QName.java:190)
    at com.sap.engine.services.webservices.espbase.client.dynamic.impl.DInterfaceImpl.getInterfaceInvoker(DInterfaceImpl.java:126)
    at com.sap.engine.services.webservices.espbase.wsdas.impl.WSDASImpl.<init>(WSDASImpl.java:43)
    at com.sap.engine.services.webservices.espbase.wsdas.impl.WSDASFactoryImpl.createWSDAS(WSDASFactoryImpl.java:39)
    at com.sap.engine.services.sca.plugins.ws.tools.wsdas.WsdasFactoryWrapper.createWsdas(WsdasFactoryWrapper.java:30)
    at com.sap.engine.services.sca.plugins.ws.WebServiceImplementationInstance.initWsdas(WebServiceImplementationInstance.java:256)
    at com.sap.
    Surely if it was the service group unassign then reassign issue then none of the calls would have worked?

    Hi David,
    While a random error is still an error it will be difficult for support to find a problem for an error which is not reproducible. It is always a faster resolution if you can determine how to provoke the error and provide those details. If we can reproduce an error on internal systems then we can fix the problem quickly and without having to access your system.
    regards, Nick

  • Need help in creating for loop

    Hi,
    I want to create two different Xquery transformation by checking attribute value in the input xml.
    <n:DIAMessage xsi:schemaLocation="http://pearson.com/DIA C:/shashi/rewrite/DIA/DIA_Schemas/DIA_new.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n="http://pearson.com/DIA">
    <n:Customer>
    <n:Account sourceClassName="Account" sourceInstanceID="01560900" sourceSystem="MDR">
    <n:hasAccountRelation sourceClassName="AccountRelation" sourceInstanceID="01560900" sourceSystem="MDR">
    <n:hasAccountPerson name="BRIAN C STRICKLAND" sourceClassName="Person" sourceInstanceID="01560900|$|00114" sourceSystem="MDR"/>
    </n:hasAccountRelation>
    </n:Account>
    <n:Account sourceClassName="Account" sourceInstanceID="01560900" sourceSystem="MDR">
    <n:hasAccountRelation sourceClassName="AccountRelation" sourceInstanceID="01560900" sourceSystem="MDR">
    <n:hasAccountPerson name="BRIAN C STRICKLAND" sourceClassName="Person" sourceInstanceID="01560900|$|00114" sourceSystem="MDR"/>
    </n:hasAccountRelation>
    </n:Account>
    <n:Person name="BRIAN C STRICKLAND" sourceClassName="Person" sourceInstanceID="01560900|$|00114" sourceSystem="MDR">
    <n:hasIdentifier sourceClassName="Identifier" sourceInstanceID="01560900|$|00114" sourceSystem="MDR">
    <n:IDType>GENDER</n:IDType>
    <n:IDTypeName>GENDER</n:IDTypeName>
    <n:IDValue>M</n:IDValue>
    </n:hasIdentifier>
    </n:Person>
    <n:Person name="BRIAN C STRICKLAND" sourceClassName="Person" sourceInstanceID="01560900|$|00114" sourceSystem="MDR">
    <n:hasIdentifier sourceClassName="Identifier" sourceInstanceID="01560900|$|00114" sourceSystem="MDR">
    <n:IDType>GENDER</n:IDType>
    <n:IDTypeName>GENDER</n:IDTypeName>
    <n:IDValue>M</n:IDValue>
    </n:hasIdentifier>
    </n:Person>
    </n:Customer>
    </n:DIAMessage>
    From the above Message i need to create two transformation by checking
    if (DIAMessage/Customer/Account/@sourceClassName="Account")
    then call {
    Xquery1
    if(DIAMessage/Customer/Person/@sourceClassName="Person")
    then call{
    Xquery2
    Constraint here is Account and Person block occurence will be many times.As they are in same hierarchy how to create a for loop concept here?
    Please anyone can help me on this?

    Hi,
    Create a numeric variable to act as While loop counter and assign value of 1. Create a boolean variable to act as a flag to exit loop and assign value of true.
    Create a while object with a condition that while flag variable is true loop.
    Then you can create a switch with a case for each of your scenarios, referencing the xth record (defined by loop counter variable) in xml using ora:getElement
    When the count of required elements in input xml is less than your loop variable, assign the variable to exit loop as false...otherwise increment counter by one to loop to next record.
    Hope this helps.

Maybe you are looking for

  • Is it possible to delete the records from LIS Table S601

    We have created some errorneous/unwanted  records in planning in table S601. Is there a way to delete these enties by Plant or material. Need your help urgently.. Please help. Thanks in Advance Rajesh

  • Save iGrid as image

    Greetings, Does anyone know how to save an iGrid as an image? We have Chart action block which takes Query Template and Display Template (only Charts) as inputs and saves that chart as image with the help of Image Saver. But for iGrid how to do this?

  • Rgegarding checkbox?

    Hi All, i have Alv report.in that i have a column of check box ,when user select any of the check box the entire row must be select.How can i get this?when user select a checkbox, that row have to be  update in database with action of confirmation bu

  • Wireless Remote Server Issues

    I have a wireless router set up with a home computer and while the desktop recieves the internet, my laptop is giving me the message that it is unable to connect to the remote server. In my network prefrences, it reads that I am connected to the netw

  • How to enable Intel VT-x in Windows 8 ?

    In VMware, I am getting error message about enabling Intel VT-x setting in bios ? I have no idea how to go to BIOS in windows 8 and how to enable it ? Could you please guide me how to enable VT-x in windows 8 ?