ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Java Compute Node with SoapInput Node

Post new topic  Reply to topic
 Java Compute Node with SoapInput Node « View previous topic :: View next topic » 
Author Message
gopi.balagala
PostPosted: Tue May 21, 2013 11:08 pm    Post subject: Java Compute Node with SoapInput Node Reply with quote

Newbie

Joined: 21 May 2013
Posts: 6

Hi,

I am very new to Message Broker,

I have developed one simple application with soap nodes.

1). Soapinput node to compute node(caculate values) and send response to SoapReply. Its working fine.

2). Same I tried with Java compute node with Soapinput, here what ever I am giving request in response also same coming, I didn't get caculated values, below of the java compute node code:

Compute Node Code:
-----------------------------
Code:

public void evaluate(MbMessageAssembly assembly)throws MbException{
   MbOutPutterminal out = getOutputTerminal("out");
   MbOutputTerminal alt = getOutputTerminal("alternate");

   MbMessage message = assembly.getMessage();
   MbMessage outMessage = new MbMessage();

   // Add user code below
   MbMessage inMessage = assembly.getMessage();
   MbElement root = inMessage.getRootElement();
   
   String firstElement = root.getLastchild().getFirstChild().getFirstChild().getValueAsString();
   Strubg secondElement = root.getLastChild().getFirstChild().getLastChild().getValueAsString();

   int a = Integer.parseInt(firstElement);
   int b = Integer.parseInt(secondElement);
   int c = a + b;
   String output = ""+c;

   MbElement outRoot = outMessage.getRootElement();
   MbElement messageRoot = outRoot.createElementAsLastChild("XMLNSC");
   MbElement outPut = messageRoot.createElementAsLAstChild(MbXMLNSC.FOLDER, "TOTAL", null);
   output.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"Final Value", output);

   //End of user code

   out.propagate(assembly);
}

-------------------------------------
Can you please help me any one what I did mistake.

Thanks,
Gopi.
Back to top
View user's profile Send private message
gopi.balagala
PostPosted: Tue May 21, 2013 11:10 pm    Post subject: Request and Response in Soap UI Reply with quote

Newbie

Joined: 21 May 2013
Posts: 6

and this is request soapinput xml file:
--------------------------------------
Code:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.myeclipseide.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:add>
         <arg0>10</arg0>
         <arg1>5</arg1>
      </ws:add>
   </soapenv:Body>
</soapenv:Envelope>

------------------------------
in response also same coming,

output Response:
-------------------------
Code:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
      <NS1:add xml:NS1="http://ws.myeclipseide.com/">
         <arg0>10</arg0>
         <arg1>5</arg1>
      </NS1:add>
   </soapenv:Body>
</soapenv:Envelope>

-----------------------

Same comig, pls help me any one.
Back to top
View user's profile Send private message
Esa
PostPosted: Tue May 21, 2013 11:17 pm    Post subject: Re: Java Compute Node with SoapInput Node Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

gopi.balagala wrote:

Code:

public void evaluate(MbMessageAssembly assembly)throws MbException{

        ...
   out.propagate(assembly);
}



You are propagating the input assembly...
Back to top
View user's profile Send private message
gopi.balagala
PostPosted: Tue May 21, 2013 11:23 pm    Post subject: Reply with quote

Newbie

Joined: 21 May 2013
Posts: 6

Hi Esa,

out.propagate(assembly);

Instead of this what I have to add here.

Thanks,
Gopi.
Back to top
View user's profile Send private message
Esa
PostPosted: Tue May 21, 2013 11:43 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

Create a dummy JCN in a flow, click Open Java and run the wizard with various options. Examine differences between the generated code snippets and you will get the idea.
Back to top
View user's profile Send private message
nukalas2010
PostPosted: Tue May 21, 2013 11:56 pm    Post subject: Reply with quote

Master

Joined: 04 Oct 2010
Posts: 220
Location: Somewhere in the World....

gopi.balagala wrote:
Hi Esa,

out.propagate(assembly);

Instead of this what I have to add here.

Thanks,
Gopi.


Instead of this, you have to pass as

Code:
out.propagate(outRoot );
Back to top
View user's profile Send private message
Esa
PostPosted: Wed May 22, 2013 12:16 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

nukalas2010 wrote:


Instead of this, you have to pass as

Code:
out.propagate(outRoot );


Sorry, nukalas2010, but that is wrong answer
Back to top
View user's profile Send private message
gopi.balagala
PostPosted: Wed May 22, 2013 12:21 am    Post subject: Reply with quote

Newbie

Joined: 21 May 2013
Posts: 6

Yes, I tried its showing error,

Still I am searching to my out put.

If u have any answer please reply me.

Thanks,
Gopi.
Back to top
View user's profile Send private message
gopi.balagala
PostPosted: Wed May 22, 2013 12:34 am    Post subject: Reply with quote

Newbie

Joined: 21 May 2013
Posts: 6

Thanks a lot for good repsonse,

Finally I resolved the issue.

I didn't created in my code outAssembly,
Just I added its getting exact response.

Thanks,
Gopi.
Back to top
View user's profile Send private message
gopi.balagala
PostPosted: Wed May 22, 2013 12:40 am    Post subject: Reply with quote

Newbie

Joined: 21 May 2013
Posts: 6

Code:
out.propagate(outAssembly);


Thanks,
Gopi.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed May 22, 2013 11:28 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Set a breakpoint between the input node and the JCN.
Look at the message tree (representing your InputRoot or InMessage.)

Remember WMB Message is quite different from SOAP Message.
The SOAP Message is at best a subset of the WMB Message.

You will then see why your
Code:
 String firstElement = root.getLastchild().getFirstChild().getFirstChild().getValueAsString();

is so wrong. This will show you the value of the first element of the header?

I am thinking here InputRoot.SOAP.Header....
And think that namespaces are often handled before the actual value and as such are children of the node they are actually declared in...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nukalas2010
PostPosted: Thu May 23, 2013 3:57 am    Post subject: Reply with quote

Master

Joined: 04 Oct 2010
Posts: 220
Location: Somewhere in the World....

Esa wrote:
nukalas2010 wrote:


Instead of this, you have to pass as

Code:
out.propagate(outRoot );


Sorry, nukalas2010, but that is wrong answer


sorry sorry for the wrong answer.. we should send like below..

Code:
MbMessageAssembly o u t A s s embly = new MbMessageAssembly(i n A s s e m b l y, outRoot);
out.propagate(outAssembly);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Java Compute Node with SoapInput Node
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.