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 » Issue calling webservice suing Javacomput node

Post new topic  Reply to topic
 Issue calling webservice suing Javacomput node « View previous topic :: View next topic » 
Author Message
Frnd
PostPosted: Thu Apr 07, 2011 5:30 am    Post subject: Issue calling webservice suing Javacomput node Reply with quote

Apprentice

Joined: 04 Jun 2007
Posts: 33

Hi
I am trying to call a Java Webservice from WMB Java comput node.Below is the code I have used.

package com.package;

import com.ibm.broker.javacompute.MbJavaComputeNode;
import com.ibm.broker.plugin.*;

import com.package.Test315MarchService.*;
import javax.xml.ws.BindingProvider;

public class Test315MarchServiceClient extends MbJavaComputeNode {

public void evaluate(MbMessageAssembly contact admin) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
//MbOutputTerminal alt = getOutputTerminal("alternate");

MbMessage inMessage = contact admin.getMessage();

// create new message
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin,
outMessage);

try {
// optionally copy message headers
copyMessageHeaders(inMessage, outMessage);

// ----------------------------------------------------------
// Add user code below
int a = 4 ;
int b = 3 ;
Test315MarchServiceService service = new Test315MarchServiceService();
Test315MarchService port = service.getTest315MarchServicePort ();

((BindingProvider)port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,"user");
((BindingProvider)port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,"pwd");
System.out.printf ( "a+b=%d\n", port.add(a, b ) );


// End of user code
// ----------------------------------------------------------

// The following should only be changed
// if not propagating message to the 'out' terminal
out.propagate(outAssembly);

} finally {

// clear the outMessage even if there's an exception
outMessage.clearMessage();
}
}

public void copyMessageHeaders(MbMessage inMessage, MbMessage outMessage)
throws MbException {
MbElement outRoot = outMessage.getRootElement();

// iterate though the headers starting with the first child of the root
// element
MbElement header = inMessage.getRootElement().getFirstChild();
while (header != null && header.getNextSibling() != null) // stop before
// the last
// child
// (body)
{
// copy the header and add it to the out message
outRoot.addAsLastChild(header.copy());
// move along to next header
header = header.getNextSibling();
}
}

}


It doesn't seem to post the message.Instead the message is going to the faiure terminal of the Java comput node. n debug mode also, could not find much details on the error.Can someone please help me to understand the reason for the faiilure ?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Apr 07, 2011 6:07 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So presumably the part of the code that actually attempts to call the WebService is buried inside the code for the Test315MarchServiceService() object.

In general, you are trying to treat broker as if it was a standard JVM or a JEE app server, and are ignoring the native function provided by Broker to make SOAP Requests.

Is there a particular reason for this, or have you just not been provided training on Broker?
Back to top
View user's profile Send private message
rekarm01
PostPosted: Thu Apr 07, 2011 11:01 am    Post subject: Re: Issue calling webservice using JavaCompute node Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

[code] tags make it easier to read posted code.

The web service call doesn't seem to use inMessage or outMessage. Where does the web service request message come from? Where does the web service response message go? Why does outMessage have only message headers, but no message body?

Frnd wrote:
In debug mode also, could not find much details on the error. Can someone please help me to understand the reason for the failure?

A usertrace may be more useful than debug mode.
Back to top
View user's profile Send private message
Frnd
PostPosted: Thu Apr 07, 2011 8:47 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2007
Posts: 33

Hi al,

In this case,webservice is created in an External Application ( jar format). The requirement is to call that webservice by importing the jar provided by this application. So we have imported the jar in WMB and trying to invoke it using javacompute node from WMB.

I am not very clear on the Inmessage and Outmessgae parts. That was auto generated when I selected create new message in the Java Comput node properties/ I edited the code to include the usercode to use a sample service to add two numbers.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Apr 08, 2011 12:58 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You have not yet shown that you have the training or skills to complete this task. Perhaps you should discuss this with your manager or a senior developer on your team.

You haven't provided any information that anyone can use to help you.

You haven't, for example, even mentioned whether or not the Jar file is built at the same level of Java that your Broker is using.
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 » Issue calling webservice suing Javacomput 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.