Author |
Message
|
boonus |
Posted: Thu Sep 28, 2006 1:58 am Post subject: WebService client with MQ transport cannot connect |
|
|
Newbie
Joined: 27 Sep 2006 Posts: 7
|
Hi!
I'm trying to call a webservice method(axis) from my ws client(axis) using MQ transport.
I got the WSDL defenition and generates the java proxy code with:
java com.ibm.mq.soap.util.RunWSDL2Java Test.wsdl
with no problems.
-----------WS Client code:
com.ibm.mq.soap.Register.extension();
TestServiceLocator locator = new TestServiceLocator();
String strURL = "jms:/queue?" +
"destination=REQUESTQUEUE@MQTESTQM" "&connectionFactory=(" +
"connectQueueManager(MQTESTQM)" +
"binding(client)" +
"clientChannel(SVRCONN)" +
"clientConnection(MQSERVER))" +
"&initialContextFactory=com.ibm.mq.jms.Nojndi" +
"&timeout=5000" +
"&persistence=0" +
"&priority=4" +
"&replyDestination=REPLYQUEUE";
TestService service = locator.getTestWS();
String message = service.getMessage();
-------------
When i call the method service.getMessage(); i get a RemoteException:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: cannotConnect; nested exception is:
java.lang.IllegalArgumentException: noCFName
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:myclient
This seems strange cause my connectionfactory options are set in the URI.
When i do som further debugging i find that the exception is thrown by the getConnectionFactory method in the JNDIVendorAdapter class cause the jndiName is not set.
I got both jndi.jar and nojndi.jar in my classpath
Any ideas?
Thanks
-bonus |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Sep 28, 2006 2:40 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
create a file context and setup queues and qcf factory in the context.
Then use it to retrieve the JNDI stuff. This should satisfy AXIS...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
boonus |
Posted: Thu Sep 28, 2006 5:12 am Post subject: |
|
|
Newbie
Joined: 27 Sep 2006 Posts: 7
|
Sorry..
create a file context with the jms:/queue string? Do you have an example or a link about making such file? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Sep 28, 2006 2:57 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Read the Using Java manual and find the section about JMSAdmin.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
boonus |
Posted: Fri Oct 27, 2006 2:31 am Post subject: |
|
|
Newbie
Joined: 27 Sep 2006 Posts: 7
|
Hello again,
I have gone thru the Using Java manual and did some further configuring with JMSAdmin.
JMSAdmin.config
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/C:/JNDI-Directory
sutupwsmqclient.scp
DEFINE QCF(MQConnectionFactory) TRANSPORT(CLIENT) HOST(MQSERVER) PORT(1414) CHANNEL(SVRCONN) QMGR(MQTESTQM)
DEFINE Q(REQUESTQUEUE) QU(REPLYQUEUE)
END
I have executed the scp script with JMSAdmin, generating a .bindings file in C:/JNDI-Directory
How do i use this JNDI-Directory? In client.config.wsdd?
I am afraid i'm stucked here.. any ideas? TU |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Oct 27, 2006 2:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You have to pass the information to your context factory:
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/C:/JNDI-Directory
and then retrieve the qcf and queue like
Code: |
Properties myhash = new Properties();
myhash.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
myhash.put(Context.PROVIDER_URL,"file:/C:/JNDI-Directory");
Context ctx = new InitialContext(myhash);
QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("MQConnectionFactory");
Queue myqueue = (Queue)ctx.lookup("REQUESTQUEUE"); |
Better double check the code as this is from memory...
Now it's up to you to configure Axis to do this for you...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|