Hi Eric,
Here is the sample attached of the old client that shows how it was
used.
I am not sure whether current code supports the same model to access JMS
context info. On other thing to clarify on the WSDL, configuration, and
JMS-context stuff is that JMS WSDL extensors can be configured via
Configuration but some configuration specific stuff like session pool
size cannot be set in WSDL and same holds true for context info. which
cannot be set via WSDL or configuration.
Regards,
Ulhas Bhole
On Fri, 2006-11-17 at 16:12 +0000, Ulhas Bhole wrote:
> Hi Eric,
>
> It needs to be set programmatically and very few of the attributes are
> settable. It is set through RequestContext and can be retrived from
> respose via ResponseContext.
>
> If you want the exact mechanism you will need to search for some old
> installer of celtix (pre-apache) and look at the JMS samples.
>
> Regards,
>
> Ulhas Bhole
>
> On Fri, 2006-11-17 at 10:30 -0500, Johnson, Eric wrote:
> > No it is a slightly different question.
> > I'm wondering how I go about setting the JMS header attributes such as
> > JMSPriority. Do I do it in the WSDL using the elements defined in the
> > jms-context namespace? Is there a way to do this programmatically?
> > Cheers,
> > Eric
> >
> > > -----Original Message-----
> > > From: Willem Jiang [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, November 16, 2006 8:40 PM
> > > To: [email protected]
> > > Subject: Re: JMS WSDL question
> > >
> > > Hi Eric,
> > >
> > > I do a quick look into the code, I think current CXF doesn't
> > > support get the header properties from configuration, because
> > > there is no header related beans in the generated code.
> > > I can fill a JIRA task for it and will get it done next week.
> > > One more question, I remember you had a mail for the JMS
> > > Context Mechanism.
> > > Is it the same question with this header issue?
> > > There are both "Context" related jms-context element and
> > > maybe some kind of Message context :)
> > >
> > > Cheers,
> > > Willem.
> > >
> > >
> > > Johnson, Eric wrote:
> > >
> > > >Willem,
> > > >So I can use the jms-context elements in the WSDL to specify the JMS
> > > >header properties? Can I also place them in the configuration file?
> > > >Are there examples?
> > > >Cheers,
> > > >Eric
> > > >
> > > >
> > > >
> > > >
> > > >>-----Original Message-----
> > > >>From: Willem Jiang [mailto:[EMAIL PROTECTED]
> > > >>Sent: Thursday, November 16, 2006 8:07 PM
> > > >>To: [email protected]
> > > >>Subject: Re: JMS WSDL question
> > > >>
> > > >>Hi Eric,
> > > >>
> > > >>You can find the schema of the jms WSDL extensions from
> > > >>trunk/common/schemas/src/main/resources/schemas/wsdl/jms-context.xsd
> > > >>and
> > > >>trunk/common/schemas/src/main/resources/schemas/wsdl/jms-conf.xsd
> > > >>
> > > >>
> > > >>Willem.
> > > >>
> > > >>Johnson, Eric wrote:
> > > >>
> > > >>
> > > >>
> > > >>>Can the elements defined in jms-conf and jms-context be
> > > used as WSDL
> > > >>>extensions? For example can I set the session pooling
> > > values or the
> > > >>>time-to-live in the WSDL for a JMS endpoint?
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>
> > > >>
> > > >
> > > >
> > > >
> > >
> > >
package demo.jms_greeter.client;
import java.io.File;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import org.objectweb.celtix.jms_greeter.JMSGreeterPortType;
import org.objectweb.celtix.jms_greeter.JMSGreeterService;
import org.objectweb.celtix.transports.jms.context.JMSMessageHeadersType;
import org.objectweb.celtix.transports.jms.context.JMSPropertyType;
public final class Client {
private static final QName SERVICE_NAME =
new QName("http://celtix.objectweb.org/jms_greeter", "JMSGreeterService");
private static final QName PORT_NAME =
new QName("http://celtix.objectweb.org/jms_greeter", "JMSGreeterPortType");
private Client() {
}
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.out.println("please specify wsdl");
System.exit(1);
}
File wsdl = new File(args[0]);
JMSGreeterService service = new JMSGreeterService(wsdl.toURL(), SERVICE_NAME);
JMSGreeterPortType greeter = (JMSGreeterPortType)service.getPort(PORT_NAME, JMSGreeterPortType.class);
System.out.println("Invoking sayHi...");
System.out.println("server responded with: " + greeter.sayHi());
System.out.println();
System.out.println("Invoking greetMe...");
System.out.println("server responded with: " + greeter.greetMe(System.getProperty("user.name")));
System.out.println();
System.out.println("Invoking greetMeOneWay...");
greeter.greetMeOneWay(System.getProperty("user.name"));
System.out.println("No response from server as method is OneWay");
System.out.println();
// Demonstration of JMS Context usage
InvocationHandler handler = Proxy.getInvocationHandler(greeter);
BindingProvider bp = null;
if (handler instanceof BindingProvider) {
bp = (BindingProvider)handler;
Map<String, Object> requestContext = bp.getRequestContext();
JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
requestHeader.setJMSCorrelationID("JMS_QUEUE_SAMPLE_CORRELATION_ID");
requestHeader.setJMSExpiration(3600000L);
JMSPropertyType propType = new JMSPropertyType();
propType.setName("Test.Prop");
propType.setValue("mustReturn");
requestHeader.getProperty().add(propType);
requestContext.put("org.objectweb.celtix.jms.client.request.headers", requestHeader);
//To override the default receive timeout.
requestContext.put("org.objectweb.celtix.jms.client.timeout", new Long(1000));
}
System.out.println("Invoking sayHi with JMS Context information ...");
System.out.println("server responded with: " + greeter.sayHi());
if (bp != null) {
Map<String, Object> responseContext = bp.getResponseContext();
JMSMessageHeadersType responseHdr = (JMSMessageHeadersType)responseContext.get(
"org.objectweb.celtix.jms.client.response.headers");
if (responseHdr == null) {
System.out.println("response Header should not be null");
System.out.println();
System.exit(1);
}
if ("JMS_QUEUE_SAMPLE_CORRELATION_ID".equals(responseHdr.getJMSCorrelationID())
&& responseHdr.getProperty() != null) {
System.out.println("Received expected contents in response context");
} else {
System.out.println("Received wrong contents in response context");
System.out.println();
System.exit(2);
}
} else {
System.out.println("Failed to get the binding provider cannot access context info.");
System.exit(3);
}
System.out.println();
System.exit(0);
}
}