Hi Michal,
 
what you have to do is to call the messageContext.setTargetService Method on the 
MessageContext object( in your case with "MessageService" as parameter). How you find 
the servicename in a "real" application is up to you. we weren't able to find a 
"standard" for jms. If you want to look at some source code, have a look at the 
org.apache.axis.handlers.http.URLMapper. Here it is done for http.
 
I hope that help !
 
Oliver

        -----Ursprüngliche Nachricht----- 
        Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
        Gesendet: Mi 12.02.2003 18.37 Uhr 
        An: [EMAIL PROTECTED] 
        Cc: 
        Betreff: How to set JMS transport destination service
        
        
Hello,
I'm trying to implement JMS transport layer for SOAP messages using
openJMS provider.
I'm able to send SOAP message from client application using JMS. The
message is stored in JMS queue succesfully.
I wrote a second application (simillar to SimpleJMSListener) which
listens for incomming JMS messages. My own implementation of
onMessage function is succesfully invoked. But here comes a
problematic part. SimpleJMSWorker isn't able to find my service and
error is returned to client.

Here's piece of error message:
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.NoService
faultSubcode:
faultString: The AXIS engine could not find a target service to
invoke! targetService is null
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: AxisFault
faultCode: {http://xml.apache.org/axis/}Server.NoService
faultSubcode:
faultString: The AXIS engine could not find a target service to
invoke! targetService is null
faultActor:
faultNode:
faultDetail:
The AXIS engine could not find a target service to invoke!
targetService is null

I don't know how to let the SOAP message know what service should be
called after transfering to serverside using JMS transport.

For ilustration here's my client code:
...

String wsdd =
"<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\"; " +
"xmlns:java=\"" + WSDDConstants.URI_WSDD_JAVA + "\">\n" +
" <transport name=\"JMSTransport\"
pivot=\"java:org.apache.axis.transport.jms.JMSSender\"/>\n" +
" <service name=\"" + WSDDConstants.URI_WSDD + "\"
provider=\"java:MSG\">\n" +
" <parameter name=\"allowedMethods\" value=\"AdminService\"/>\n" +
" <parameter name=\"className\"
value=\"org.apache.axis.utils.Admin\"/>\n" +
" </service>\n" +
"</deployment>";

HashMap connectorMap = new HashMap();
HashMap cfMap = new HashMap();
cfMap.put
("transport.jms.ConnectionFactoryJNDIName","JmsQueueConnectionFactory"
);
cfMap.put(Context.PROVIDER_URL,"rmi://127.0.0.1:1099/JndiServer");
cfMap.put
(Context.INITIAL_CONTEXT_FACTORY,RmiJndiInitialContextFactory.class.ge
tName());

Service service = new Service(new XMLStringProvider(wsdd));
JMSTransport transport = new JMSTransport(connectorMap, cfMap);
Call call = (Call) service.createCall();
//call.setTargetEndpointAddress( new URL
("http://localhost:8080/axis/services/MessageService";));
call.setProperty(JMSConstants.DESTINATION, "queue1");
call.setTimeout(new Integer(10000));
call.setTransport(transport);

SOAPBodyElement[] input = new SOAPBodyElement[3];
input[0] = new SOAPBodyElement(XMLUtils.StringToElement
("urn:foo", "e1", "Hello"));
input[1] = new SOAPBodyElement(XMLUtils.StringToElement
("urn:foo", "e1", "World"));
DocumentBuilder builder = DocumentBuilderFactory.newInstance
().newDocumentBuilder();
Document doc = builder.newDocument();
Element cdataElem = doc.createElementNS("urn:foo", "e3");
CDATASection cdata = doc.createCDATASection("Text with\n\tImportant
<b> whitespace </b> and tags! ");
cdataElem.appendChild(cdata);

input[2] = new SOAPBodyElement(cdataElem);

Vector elems = (Vector) call.invoke( input );
....

And here's my server side code:
...
static final String wsdd =
"<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\"; " +
"xmlns:java=\"" + WSDDConstants.URI_WSDD_JAVA + "\">\n" +
" <service name=\"MessageService\" style=\"message\">\n" +
" <parameter name=\"className\"
value=\"samples.message.MessageService\"/>\n" +
" <parameter name=\"allowedMethods\" value=\"echoElements\"/>\n" +
" </service>\n" +
"</deployment>";

HashMap connectorMap = new HashMap();
HashMap cfMap = new HashMap();

String modeType = RmiJndiInitialContextFactory.class.getName();
cfMap.put
("transport.jms.ConnectionFactoryJNDIName","JmsQueueConnectionFactory"
);
cfMap.put(Context.PROVIDER_URL,"rmi://127.0.0.1:1099/JndiServer");
cfMap.put(Context.INITIAL_CONTEXT_FACTORY,modeType);
Service service = new Service(new XMLStringProvider(wsdd));

SimpleJMSListener listener = new SimpleJMSListener
(connectorMap,cfMap,"queue1","","",false);
listener.start();
....

And finaly my service
....
public class MessageService {
public Element[] echoElements(Element [] elems) {
return elems;
}
}
....
Thanks for any help.

Cheers,
Michal

--------------------
Poslouchejte Radio Impuls a vyhrajte víkendy pro dva v evropských
metropolích. Více na Radiu Impuls a http://www.netimpuls.cz!





<<winmail.dat>>

Reply via email to