Re: client interceptor to send parameters with headers

2008-04-23 Thread Ulhas Bhole

Hi Olanga,

try skipping the SoapHeader creation and add the DOM element directly 
into the Header list like msg.getHeaders().add(param1).


-- Ulhas Bhole

olanga henry wrote:

Hi all, this was so easy in XFire with the handlers.  I am a bit struggling due to lack of clear examples.  I am trying to write a simple 
interceptor on the client side (am not clear on which abstractInterceptor to extend out of several available in cxf, so in this example I just 
extended AbstractSoapInterceptor) so that I can send some parameters in the soap headers.  Here is what I did:public class AddHeaderInterceptor 
extends AbstractSoapInterceptor {  public AddHeaderInterceptor() {super(Phase.WRITE);  }  public void handleMessage(SoapMessage msg) 
throws SoapFault { Document d = DOMUtils.createDocument(); Element param1 = d.createElement(my_param1); 
param1.setTextContent(my param1); SoapHeader sh_param1 = new SoapHeader(new QName(http://spring.demo;, 
HelloWorldImplPort), param1);  msg.getHeaders().add( sh_param1 );  }}Then I attached the interceptor to the factory in the actual 
client code:JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();factory.setServiceClass( HelloWorld.class 
);factory.setAddress( http://wsdev.adestagroup.com/services/HelloWorld; );
factory.getOutInterceptors().add(new AddHeaderInterceptor());//---HelloWorld client = (HelloWorld) 
factory.create();System.out.println( client.sayHi(test) );But I can't seem to intercept the headers 
at the server side.  What am I doing wrong here?Highly appreciate any help. Thanks
_
Make i'm yours.  Create a custom banner to support your cause.
http://im.live.com/Messenger/IM/Contribute/Default.aspx?source=TXT_TAGHM_MSN_Make_IM_Yours
  




IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: client interceptor to send parameters with headers

2008-04-23 Thread Ulhas Bhole

Hello Henry,

Sorry I forgot about the Header object creation. you are tying to add 
the interceptor in Phase.WRITE and for some reason it looks like it is 
getting called after the SoapOutInterceptor which does the header 
processing.


Try adding the following line to the constructor after super() :
addBefore(SoapOutInterceptor.class.getName());

This will make sure that the interceptor is called before the headers 
are being processed.


Regards,

Ulhas Bhole

olanga henry wrote:

Dan: I am afraid that I am still not seeing any headers on the server side even 
after I tried sending the Header the way you suggested.
 
I am using the following interceptor (as I found from the discussion threads) in the server side applied to JAX-WS HelloWorld service:
 
public class MySoapInterceptor extends AbstractSoapInterceptor {
 
public MySoapInterceptor() { super(Phase.UNMARSHAL);}
 
  public void handleMessage(SoapMessage msg) throws SoapFault {

  System.out.println(Interceptor  + this.getPhase());
  ListHeader lista = msg.getHeaders();for (Header h : lista) {  Element el = 
(Element) h.getObject();System.out.println(Header XML :);  
XMLUtils.printDOM(el);   Node node = DOMUtils.getChild(el, null);  
printNode(node);
  while ( ((node = DOMUtils.getNext(node, null, node.getNodeType()) ) != 
null) ) {  printNode(node);  }  }
 }
 
 public void printNode(Node node) {System.out.println(Node : ); System.out.println(node.getNodeName());  System.out.println(Node value : );  System.out.println(DOMUtils.getContent(node)); }

}
 
 
and here is my service config:
 
 
bean id=hello class=demo.spring.HelloWorldImpl /jaxws:endpoint   id=helloWorld   implementor=#hello   address=/services/HelloWorld jaxws:inInterceptorsref bean=myInterceptor /  /jaxws:inInterceptors  /jaxws:endpointThank you.




  

From: [EMAIL PROTECTED] To: cxf-user@incubator.apache.org Subject: Re: client interceptor to send parameters with headers Date: Wed, 23 Apr 2008 13:00:24 -0400 CC: [EMAIL PROTECTED]  On Wednesday 23 April 2008, sudip shrestha wrote:  Ulhas:   *In the method: public java.util.ListHeader  http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/headers /Header.html **getHeaders()   **as the list has the type of Header, the add method does not accept  org.w3c.dom.Element as the parameter.  Just do new Header( new QName(el.getNamespaceURI(), el.getLocalName()), el)  That should be it.  Dan   Thanks  * 
  On Wed, Apr 23, 2008 at 10:53 AM, Ulhas Bhole [EMAIL PROTECTED]  wrote:   Hi Olanga, try skipping the SoapHeader creation and add the DOM element   directly into the Header list like msg.getHeaders().add(param1). -- Ulhas Bhole olanga henry wrote:Hi all, this was so easy in XFire with the handlers. I am a bitstruggling due to lack of clear examples. I am trying to write asimple interceptor on the client side (am not clear on whichabstractInterceptor to extend out of several available in cxf, soin this example I just extended AbstractSoapInterceptor) so that I  
  can send some parameters in the soap headers. Here is what Idid:public class AddHeaderInterceptor extendsAbstractSoapInterceptor { public AddHeaderInterceptor() {super(Phase.WRITE); } public void handleMessage(SoapMessage msg)throws SoapFault { Document d = DOMUtils.createDocument(); Element param1 = d.createElement(my_param1); param1.setTextContent(my param1); SoapHeader sh_param1 = newSoapHeader(new QName(http://spring.demo;, HelloWorldImplPort),param1); msg.getHeaders().add( sh_param1 ); }}Then I attachedthe interceptor to the factory in the actual client 
code:JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();factory.setServiceClass( HelloWorld.class ); factory.setAddress(http://wsdev.adestagroup.com/services/HelloWorld; ); factory.getOutInterceptors().add(newAddHeaderInterceptor()); //---HelloWorld client = (HelloWorld) factory.create();System.out.println( client.sayHi(test) );But I can't seemto intercept the headers at the server side. What am I doingwrong here?Highly appreciate any help. Thanks_Make i'm yours. 
Create a custom banner to support your cause.   http://im.live.com/Messenger/IM/Contribute/Default.aspx?source=TXT   _TAGHM_MSN_Make_IM_Yours    IONA Technologies PLC (registered in Ireland)   Registered Number: 171387   Registered Address: The IONA Building, Shelbourne Road, Dublin 4,   Ireland--  J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog


_
Spell a grand slam in this game where word skill meets World Series. Get

Re: client interceptor to send parameters with headers

2008-04-23 Thread Ulhas Bhole
Just saw Dan's mail and his suggestion to move the interceptor to 
Phase.USER_LOGICAL is much cleaner than mine.


Regards,

Ulhas Bhole

Ulhas Bhole wrote:

Hello Henry,

Sorry I forgot about the Header object creation. you are tying to add 
the interceptor in Phase.WRITE and for some reason it looks like it is 
getting called after the SoapOutInterceptor which does the header 
processing.


Try adding the following line to the constructor after super() :
addBefore(SoapOutInterceptor.class.getName());

This will make sure that the interceptor is called before the headers 
are being processed.


Regards,

Ulhas Bhole

olanga henry wrote:
Dan: I am afraid that I am still not seeing any headers on the server 
side even after I tried sending the Header the way you suggested.
 
I am using the following interceptor (as I found from the discussion 
threads) in the server side applied to JAX-WS HelloWorld service:
 
public class MySoapInterceptor extends AbstractSoapInterceptor {
 
public MySoapInterceptor() { super(Phase.UNMARSHAL);}
 
  public void handleMessage(SoapMessage msg) throws SoapFault {

  System.out.println(Interceptor  + this.getPhase());
  ListHeader lista = msg.getHeaders();for (Header h : lista) 
{  Element el = (Element) h.getObject();
System.out.println(Header XML :);  
XMLUtils.printDOM(el);   Node node = 
DOMUtils.getChild(el, null);  printNode(node);
  while ( ((node = DOMUtils.getNext(node, null, 
node.getNodeType()) ) != null) ) {  printNode(node);  }  }

 }
 
 public void printNode(Node node) {System.out.println(Node : 
); System.out.println(node.getNodeName());  
System.out.println(Node value : );  
System.out.println(DOMUtils.getContent(node)); }

}
 
 
and here is my service config:
 
 
bean id=hello class=demo.spring.HelloWorldImpl /
jaxws:endpoint   id=helloWorld   
implementor=#hello   address=/services/HelloWorld 
jaxws:inInterceptorsref 
bean=myInterceptor /  
/jaxws:inInterceptors  /jaxws:endpointThank you.




 
From: [EMAIL PROTECTED] To: cxf-user@incubator.apache.org Subject: 
Re: client interceptor to send parameters with headers Date: Wed, 
23 Apr 2008 13:00:24 -0400 CC: [EMAIL PROTECTED]  On Wednesday 23 
April 2008, sudip shrestha wrote:  Ulhas:   *In the method: 
public java.util.ListHeader  
http://incubator.apache.org/cxf/javadoc/latest/org/apache/cxf/headers 
/Header.html **getHeaders()   **as the list has the type of 
Header, the add method does not accept  org.w3c.dom.Element as the 
parameter.  Just do new Header( new QName(el.getNamespaceURI(), 
el.getLocalName()), el)  That should be it.  Dan   
Thanks  *   On Wed, Apr 23, 2008 at 10:53 AM, Ulhas Bhole 
[EMAIL PROTECTED]  wrote:   Hi Olanga, try 
skipping the SoapHeader creation and add the DOM element   
directly into the Header list like msg.getHeaders().add(param1).  
   -- Ulhas Bhole olanga henry wrote:Hi all, 
this was so easy in XFire with the handlers. I am a bit
struggling due to lack of clear examples. I am trying to write a  
  simple interceptor on the client side (am not clear on which  
  abstractInterceptor to extend out of several available in cxf, 
soin this example I just extended AbstractSoapInterceptor) 
so that Ican send some parameters in the soap headers. Here 
is what Idid:public class AddHeaderInterceptor extends   
 AbstractSoapInterceptor { public AddHeaderInterceptor() {
super(Phase.WRITE); } public void handleMessage(SoapMessage msg)  
  throws SoapFault { Document d = DOMUtils.createDocument();
 Element param1 = d.createElement(my_param1); 
param1.setTextContent(my param1); SoapHeader sh_param1 = new   
 SoapHeader(new QName(http://spring.demo;, HelloWorldImplPort), 
   param1); msg.getHeaders().add( sh_param1 ); }}Then I attached 
   the interceptor to the factory in the actual client code:   
 JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();   
 factory.setServiceClass( HelloWorld.class ); factory.setAddress( 
   http://wsdev.adestagroup.com/services/HelloWorld; ); 
factory.getOutInterceptors().add(newAddHeaderInterceptor()); 
//---HelloWorld client = (HelloWorld) 
factory.create();System.out.println( client.sayHi(test) 
);But I can't seemto intercept the headers at the server 
side. What am I doingwrong here?Highly appreciate any help. 
Thanks
_  
  Make i'm yours. Create a custom banner to support your cause.  
 
http://im.live.com/Messenger/IM/Contribute/Default.aspx?source=TXT 
  _TAGHM_MSN_Make_IM_Yours 
   IONA Technologies PLC (registered 
in Ireland)   Registered Number: 171387   Registered Address: 
The IONA Building, Shelbourne Road, Dublin 4,   Ireland-- 
 J. Daniel Kulp Principal

Re: CXF with Clustered JMS using ActiveMQ Network of Brokers

2008-03-11 Thread Ulhas Bhole

Hi Ayush,

I haven't tried with Netowork of brokers but I know how we connect to 
the JMS broker and the configuration that you have provided in the mail 
should work although it hasn't been tested in CXF as of yet. We do not 
mess around the connection properties that are specific to JMS broker so 
should work just like the Pure JMS client connecting the Broker.


Regards,

Ulhas Bhole

Ayush Gupta wrote:

Has anyone here used CXF with a clustered JMS using ActiveMQ's Network of
Brokers? Before I get much further along in setting this up, I was hoping
to get some words of wisdom or hear cautionary tales from folks who have
already treaded down this path.

 


More specifically though, as long as I've configured the Network of
brokers as per http://activemq.apache.org/networks-of-brokers.html, is it
just a matter of specifying the java.naming.provider.url property to CXF
as:

. Either a hard coded list of URLs of the form
static:(tcp://localhost:61616,tcp://remotehost:61616,tcp://..)

. Or a multicast discovery URL of the form multicast://default

 


-ayush


  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: no luck with JMS transport

2008-03-06 Thread Ulhas Bhole

Are you sure you have activemq jars in your classpath for the application?

It looks to me like it is not getting the class while doing context lookup.

Regards,

Ulhas Bhole

Mac Case wrote:

http://cwiki.apache.org/CXF20DOC/jax-ws-java-first-with-jms-transport.ht
ml

 


I have tried using the approach described in the url above with
absolutely no luck; I even downloaded the sample code linked from that
page
(http://cwiki.apache.org/CXF20DOC/jax-ws-java-first-with-jms-transport.d
ata/cxf_java_first.zip).  The exception I always end up with is the
following:

 


java.lang.NullPointerException

  at javax.naming.InitialContext.getURLScheme(Unknown Source)

  at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown
Source)

  at javax.naming.InitialContext.lookup(Unknown Source)

  at
org.apache.cxf.transport.jms.JMSProviderHub.connect(JMSProviderHub.java:
76)

  at
org.apache.cxf.transport.jms.JMSProviderHub.connect(JMSProviderHub.java:
60)

  at
org.apache.cxf.transport.jms.JMSConduit.prepare(JMSConduit.java:85)

  at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Messag
eSenderInterceptor.java:46)

  at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:207)

  at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)

  at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)

  at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)

  at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)

  at $Proxy26.sayHi(Unknown Source)

  at test.client.ClientJMS.main(ClientJMS.java:37)

 


I do have ActiveMQ running, however I don't believe it's even getting
that far

 


Looking at the source of JMSProviderHub shows line 76 to be the
following:

 


QueueConnectionFactory qcf =

 
(QueueConnectionFactory)context.lookup(addrDetails.getJndiConnectionFact

oryName());

 


So obviously the null pointer exception is occurring because it's
passing in a null string for the connection factory.  This leads me to
believe that it's not even looking at the jms conduit/destination
definitions in cxf.xml.

 


Any help with this would be greatly appreciated.

 


Thanks


  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: no luck with JMS transport

2008-03-06 Thread Ulhas Bhole
I just gave a try to the sample code on the link and I am getting 
compilation failures as follows:

INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 6 source files to 
/local1/work/cxf/cxf_java_first/target/classes
[INFO] 


[ERROR] BUILD FAILURE
[INFO] 


[INFO] Compilation failure

/local1/work/cxf/cxf_java_first/src/main/java/test/service/impl/HelloWorldImpl.java:[7,1] 
annotations are not supported in -source 1.3

(try -source 1.5 to enable annotations)
@WebService

/local1/work/cxf/cxf_java_first/src/main/java/test/service/HelloWorld.java:[7,1] 
annotations are not supported in -source 1.3

(try -source 1.5 to enable annotations)
@WebService


Regards,

Ulhas Bhole


Ulhas Bhole wrote:
Are you sure you have activemq jars in your classpath for the 
application?


It looks to me like it is not getting the class while doing context 
lookup.


Regards,

Ulhas Bhole

Mac Case wrote:

http://cwiki.apache.org/CXF20DOC/jax-ws-java-first-with-jms-transport.ht
ml

 


I have tried using the approach described in the url above with
absolutely no luck; I even downloaded the sample code linked from that
page
(http://cwiki.apache.org/CXF20DOC/jax-ws-java-first-with-jms-transport.d
ata/cxf_java_first.zip).  The exception I always end up with is the
following:

 


java.lang.NullPointerException

  at javax.naming.InitialContext.getURLScheme(Unknown Source)

  at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown
Source)

  at javax.naming.InitialContext.lookup(Unknown Source)

  at
org.apache.cxf.transport.jms.JMSProviderHub.connect(JMSProviderHub.java:
76)

  at
org.apache.cxf.transport.jms.JMSProviderHub.connect(JMSProviderHub.java:
60)

  at
org.apache.cxf.transport.jms.JMSConduit.prepare(JMSConduit.java:85)

  at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Messag
eSenderInterceptor.java:46)

  at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:207)

  at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)

  at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)

  at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)

  at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)

  at $Proxy26.sayHi(Unknown Source)

  at test.client.ClientJMS.main(ClientJMS.java:37)

 


I do have ActiveMQ running, however I don't believe it's even getting
that far

 


Looking at the source of JMSProviderHub shows line 76 to be the
following:

 


QueueConnectionFactory qcf =

 
(QueueConnectionFactory)context.lookup(addrDetails.getJndiConnectionFact

oryName());

 


So obviously the null pointer exception is occurring because it's
passing in a null string for the connection factory.  This leads me to
believe that it's not even looking at the jms conduit/destination
definitions in cxf.xml.

 


Any help with this would be greatly appreciated.

 


Thanks


  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: QUESTION: where is the class file -- org.apache.cxf.jms_greeter.JMSGreeterPortType -- to be found???

2008-02-20 Thread Ulhas Bhole

Hi jw,
There should be ant build.xml in the sample so if you do ant build it 
should generated the class that you are seeing missing.


Regards,

Ulhas Bhole

jw wrote:
Hi 

 


I'm new to CXF and attempting to build the jms-queue example (found in the
samples folder with the CXF distribution - in my case this example is
located in the folder: C:\apache-cxf-2.0.4-incubator\samples\jms_queue).

 


I cannot successfully build the file
demo.jms_greeter.server.GreeterJMSImpl.java.

 


This is because  there is an import for class
org.apache.cxf.jms_greeter.JMSGreeterPortType which cannot be resolved.

 


QUESTION:   where is the class file --
org.apache.cxf.jms_greeter.JMSGreeterPortType  --  to be found???

 


Its not clear whether the examples are outdated or whether there is another
explanation. 


(I cannot locate it in any of the jars in the CXF_HOME lib folder)

 


Being new to the technology,  these sorts of issues make it difficult to get
up to speed quickly with a tool that I would like to begin using
productively.

 


Thanks for any help solving this issue.

 


jw

 

 

 

 

 

 

 

 

 

 

 



  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: Problem with POST

2008-02-06 Thread Ulhas Bhole
My guess is you are using wrapped doc-literal in which case the 
operation name is not sent. If you change to RPC-Literal then the 
operation name will be sent as part of SOAP message and will not get the 
first operation every time.


Regards,

Ulhas Bhole

Scott A wrote:

I have several operations in my service that take no parameters (ie, are
purely informational). When I do a GET operation, they work just fine, but
when I do a POST, I always get the response to the one that comes first
alphabetically.

Is there a way to tell CXF which operation I wanted to do, so it will not
try to infer it from the parameters? It does not appear to be looking at the
URL as it does in GET operations.
  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: jms header properties

2008-01-31 Thread Ulhas Bhole

Which option did you use?

you can use JAX-WS requstcontext and responsecontext to get the access 
to JMS headers at client side.


Regards,

Ulhas Bhole

Mayank Thakore wrote:

Hi Dan,

This worked very well! How can I do this on the client side?

Thanks!
Mayank

On 1/28/08, Daniel Kulp [EMAIL PROTECTED] wrote:
  

On Monday 28 January 2008, Mayank Thakore wrote:


Hi Daniel,

Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?
  

With 2.0.4, yes.   Internally, we just have a PROTOCOL_HEADERS thing in
the message that is completely protocol nuetral.   The JAX-WS frontend
just maps that onto the HTTP_PROTOCOL_HEADERS thing.



With 1st option:
At the server side, I had to add interceptor. So what I do (in the
service implementation) is to put the jms property in a threadlocal
variable. Then in an interceptor (invoked prior to send), I use the
code mentioned by Willem to put these properties into the message.

Do you think this is ok? Any better way?
  

Yes.  Inject the WebServiceContext into your service and just set them
there.   The key would be the class.getName() of the JMS context class.

Dan




Thanks!

Regards
Mayank

-Original Message-
From: Daniel Kulp [mailto:[EMAIL PROTECTED]
Sent: Monday, January 28, 2008 22:03
To: cxf-user@incubator.apache.org
Cc: Mayank Thakore
Subject: Re: jms header properties


There are two options:

1) the jms context stuff Willem mentioned.

2) The standard protocol header things from JAX-WS.

In the second case, the JMS transport maps the headers onto the
BindingProvider.HTTP_PROTOCOL_HEADERS map thing.   Thus, the normal
stuff applies.   HOWEVER: that only works with 2.0.4 (to be released
tomorrow) and the 2.1 snapshots.There was a bug that prevented
that from working in earlier versions.

Dan

On Sunday 27 January 2008, Mayank Thakore wrote:
  

Hi,

How to set header/property fields in outgoing jms messages?

There is lot of configuration examples to set jms destination
properties. But I didn't find any for message properties.

Thanks and Regards
Mayank



--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog





IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: jms header properties

2008-01-31 Thread Ulhas Bhole

If you check the following system test it will show you how to use context.

http://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java

Regards,

Ulhas Bhole

Mayank Thakore wrote:

on server side i used the server response context...
i noticed that it only copies the jms message properties, not the
header... for the header server request context seems to work... but
anyway, i needed only the message properties.

how to get the context on the client side? i want to set jms
properties on a per message basis.

On 1/31/08, Ulhas Bhole [EMAIL PROTECTED] wrote:
  

Which option did you use?

you can use JAX-WS requstcontext and responsecontext to get the access
to JMS headers at client side.

Regards,

Ulhas Bhole

Mayank Thakore wrote:


Hi Dan,

This worked very well! How can I do this on the client side?

Thanks!
Mayank

On 1/28/08, Daniel Kulp [EMAIL PROTECTED] wrote:

  

On Monday 28 January 2008, Mayank Thakore wrote:



Hi Daniel,

Will BindingProvider.HTTP_PROTOCOL_HEADERS work for JMS also?

  

With 2.0.4, yes.   Internally, we just have a PROTOCOL_HEADERS thing in
the message that is completely protocol nuetral.   The JAX-WS frontend
just maps that onto the HTTP_PROTOCOL_HEADERS thing.




With 1st option:
At the server side, I had to add interceptor. So what I do (in the
service implementation) is to put the jms property in a threadlocal
variable. Then in an interceptor (invoked prior to send), I use the
code mentioned by Willem to put these properties into the message.

Do you think this is ok? Any better way?

  

Yes.  Inject the WebServiceContext into your service and just set them
there.   The key would be the class.getName() of the JMS context class.

Dan





Thanks!

Regards
Mayank

-Original Message-
From: Daniel Kulp [mailto:[EMAIL PROTECTED]
Sent: Monday, January 28, 2008 22:03
To: cxf-user@incubator.apache.org
Cc: Mayank Thakore
Subject: Re: jms header properties


There are two options:

1) the jms context stuff Willem mentioned.

2) The standard protocol header things from JAX-WS.

In the second case, the JMS transport maps the headers onto the
BindingProvider.HTTP_PROTOCOL_HEADERS map thing.   Thus, the normal
stuff applies.   HOWEVER: that only works with 2.0.4 (to be released
tomorrow) and the 2.1 snapshots.There was a bug that prevented
that from working in earlier versions.

Dan

On Sunday 27 January 2008, Mayank Thakore wrote:

  

Hi,

How to set header/property fields in outgoing jms messages?

There is lot of configuration examples to set jms destination
properties. But I didn't find any for message properties.

Thanks and Regards
Mayank



--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog





IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland





IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: multiple responses in jms

2007-12-13 Thread Ulhas Bhole

Hi Mayank,

You would be better off writing new transport that serve your purpose.
It will not be that hard. You can't register partial transport files 
that you modified as such but you can write whole new transport and 
attach it to CXF. all you need to do is to tell CXF via Spring 
configuration which transport factory to pickup and the transport 
factory should take care of invoking your implementation.


Regards,

Ulhas Bhole



Mayank Thakore wrote:

Thanks for the answer Ulhas! This clears up the air. Though
unfortunately this is the answer I had anticipated.

We were earlier using XFire and ended up customizing the
JMSTransport/Channel classes to suit our needs. CXF has much better
support but with our requirements maturing we have to customize here
too.

One question. In XFire we were able to register the modified transport
files. Any such luck here? I wasn't able to find anything in google or
the user/arch guide.

Thanks again!

Regards
Mayank

On Dec 12, 2007 6:33 PM, Ulhas Bhole [EMAIL PROTECTED] wrote:
  

Hi Mayank,
Answer is NO. currently JMS transport only works on 1 request, 1reply
basis.
The workaround might be to use the pub/sub mechanism and have something
like client sending a request to a topic on server side and then server
doing the same thing other way round on some other topic where the
client side will also have topic listener on which it can accept the
replies.

Other option a bit complicated and time consuming is to extend the
existing JMS transport or write your own transport to suit your purpose.

Regards,

Ulhas Bhole


Mayank Thakore wrote:


Hi,

I need to be able to send multiple responses to a single request on jms
transport. Does CXF support this style of communication or is there a
workaround to achieve this? Any sample code?

Even if this cannot be done, would some experienced member on this list
please confirm it?

I have written some wsdl based web services but am not able to figure out
how to achieve this style.

Thanks a lot!

Regards
Mayank



  


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland





IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: multiple responses in jms

2007-12-12 Thread Ulhas Bhole

Hi Mayank,
Answer is NO. currently JMS transport only works on 1 request, 1reply 
basis.
The workaround might be to use the pub/sub mechanism and have something 
like client sending a request to a topic on server side and then server 
doing the same thing other way round on some other topic where the 
client side will also have topic listener on which it can accept the 
replies.


Other option a bit complicated and time consuming is to extend the 
existing JMS transport or write your own transport to suit your purpose.


Regards,

Ulhas Bhole

Mayank Thakore wrote:

Hi,

I need to be able to send multiple responses to a single request on jms
transport. Does CXF support this style of communication or is there a
workaround to achieve this? Any sample code?

Even if this cannot be done, would some experienced member on this list
please confirm it?

I have written some wsdl based web services but am not able to figure out
how to achieve this style.

Thanks a lot!

Regards
Mayank


  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: JMS performance

2007-11-26 Thread Ulhas Bhole

Hi Mayank,

I don't think anyone has done the benchmark on the cost of 
request/response on JMS transport.


Are you using static reply queue or using default temp. queue for response?

Regards,

Ulhas Bhole

Mayank Thakore wrote:

Hi,

I wrote a simple WSDL based web service.

In HTTP I am getting 1000 request/response in 19 secs.
But, in JMS 1000 request/response cost 110+ secs.

Is this OK? Are there any benchmarks?

Any pointers on what can be done for JMS?
I am using CXF 2.0.2 and OpenJMS.

Thanks!
Mayank
  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: JMS configuration for consumer

2007-11-07 Thread Ulhas Bhole

Hi Patrick,

you cannot use the snippet you used to connect to the service you are 
trying directly. You will need to have jms:address .../ configured 
with the appropriate info. from the location jms: address. This 
translation you can do it in configuration or modify the WSDL it's upto 
you. Another thing I noticed is the location starts with jms:/ and 
this won't tell CXF to use JMS transport at client side we need the 
location name starting from jms:// so you will need to modify WSDL 
anyway.

Regards,

Ulhas Bhole

Patrick Mulligan wrote:

Hi,
 
In the JMS configuration docuement (for consumer only in this case), it specified that the configuration can be done either by WSDL or configuration file.  
 
Can this be mixed with a portion in wsdl and configuration?
 
Is the WSDL configuration for JMS consumers standard?  That is, is the syntax of the port element contents standardized or are they specific to a JMS impl?
 
This is a snip from a commercial JMS that I need to connect to:
 
wsdl:port binding=tns:ESB_VehicleManagementSOAP_JMS_Binding name=SOAP_JMS_Port

soap:address 
location=jms:/queue?destination=jms/SoapOutputamp;connectionFactory=jms/outboundSoapJmsQCFamp;replyToDestination=jms/SoapInputamp;targetService=ESB_VehicleManagement_DialogPlus/
/wsdl:port
 
Does a cxf jms consumer need to know the cxf JMS namespace if definded by wsdl?
 
BTW, we want to have the default tempory queue setup for request/reply.

_
Peek-a-boo FREE Tricks  Treats for You!
http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us
  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: cxf jms with java first

2007-10-26 Thread Ulhas Bhole

Hi Christian,

Only requirement on the address is that it should start with jms:// 
rest of the stuff is all ignored currently. All the required stuff is 
pulled out from jms:address wsdl Extensor which can be configured via 
configuration the way you did.


once you set the address starting with jms:// CXF runtime will find the 
appropriate transport factor in this case JMSTransportFactory and will 
inject the Spring config that your xml configuration file.


Regards,

Ulhas Bhole

Christian Schneider wrote:
I have found some clues to the necessary configuration. You need to 
configure a jms:conduit. And of course your JaxWsProxyFactoryBean.
But what I did not yet find out is how to connect the two. What I know 
is that your setAddress Parameter in the factory has to start with 
jms://.


Has anyone an idea how to go on from there?

Best regards,

Christian

mule1 schrieb:

Hello,

I wanted to configure cxf jms in xml with my java first service
implementation. Can you provide me the sample cxf jms configuration?
  

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
   factory.getInInterceptors().add(new LoggingInInterceptor());
   factory.getOutInterceptors().add(new LoggingInInterceptor());
   factory.setServiceClass(IHello.class);
   
factory.setAddress(jms://{http://service.test/}IHelloService.jms-conduit;); 
// This dows not seem correct... what is the right address for jms?

   //factory.setAddress(http://localhost:9000/Hello;);
   IHello client = (IHello) factory.create();
String reply = client.sayHi(HI);


?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:cxf=http://cxf.apache.org/core;
   xmlns:soap=http://cxf.apache.org/bindings/soap;
   xmlns:jaxws=http://cxf.apache.org/jaxws;
   xmlns:jms=http://cxf.apache.org/transports/jms;
   xsi:schemaLocation=http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

   http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
   http://cxf.apache.org/bindings/soap 
http://cxf.apache.org/schema/bindings/soap.xsd

   http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
   http://cxf.apache.org/transports/jms 
http://cxf.apache.org/schemas/configuration/jms.xsd

   

   import resource=classpath:META-INF/cxf/cxf.xml /
   import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /
   import resource=classpath:META-INF/cxf/cxf-extension-local.xml /
   import resource=classpath:META-INF/cxf/cxf-extension-http.xml /
   import resource=classpath:META-INF/cxf/cxf-servlet.xml /
   import resource=classpath:META-INF/cxf/cxf-extension-jms.xml /

   jms:conduit
   name={http://service.test/}IHelloService.jms-conduit;
   jms:clientConfig clientReceiveTimeout=500
   messageTimeToLive=500 /
   jms:runtimePolicy messageType=binary /
   jms:sessionPool lowWaterMark=10 highWaterMark=5000 /
   jms:address destinationStyle=queue
   jndiConnectionFactoryName=MockConnectionFactory
   jndiDestinationName=myOwnDestination
   jndiReplyDestinationName=myOwnReplyDestination
   connectionUserName=testUser 
connectionPassword=testPassword

   jms:JMSNamingProperty name=java.naming.factory.initial
   
value=org.apache.activemq.jndi.ActiveMQInitialContextFactory /

   jms:JMSNamingProperty name=java.naming.provider.url
   value=tcp://localhost:61616 /
   /jms:address
   /jms:conduit

/beans




IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: Setting SOAP header in SOAP response

2007-10-26 Thread Ulhas Bhole


Are you checking for the DOM elements? Don't expect to see it in string 
format.


you need to get the handle onto the Header list and go through the list 
to check the DOM elements and you would find it there.


Sorry, didn;t read the complete message it looks like your interceptor 
kicks in after the header processing is done. If you have no dependency 
on any interceptors to be finished you can add it before Phase.WRITE.


you can add following lines to your interceptor's constructor and it 
should make sure that the interceptor gets called before the header 
processing happens.


super(Phase.WRITE);
addBefore(SoapOutInterceptor.class.getName());


Regards,

Ulhas

Ronald Pieterse wrote:

Right, The header I'm setting is not appearing when I check the response in
e.g. SoapUI. The only requirement I have is that I would like to see the
header in my response one way or the other :-)
I also have a System.out.println in my interceptor so I know it kicks in and
no exceptions are thrown so I wonder where the header went...
The response looks like this:

soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;
   soap:Body
  ns1:getDatabaseFieldsResponse xmlns:ns1=http://some.namespace/;
 databaseFields
  ...
 /databaseFields
  /ns1:getDatabaseFieldsResponse
   /soap:Body
/soap:Envelope


As you can see there's no headers available at all. Any ideas?


Ulhas Bhole wrote:
  

Hi Roland,

It's upto your requirement at which phase it should be added. I don't 
see any problem in the way you are setting header. Do you mean to say 
that interceptor kicks in but you don't see soap header other side?


Regards,

Ulhas Bhole

Ronald Pieterse wrote:


Hello,

I'm trying to set a header in the SOAP response of all my calls.This
header
must just contain the version of my service implementation. I'm trying to
do
this using an OUT interceptor (extends AbstractSoapInterceptor) which is
defined in my spring file:


bean id=soapHeaderSetter
class=my.package.SoapHeaderSetter /

cxf:bus
cxf:inInterceptors /
cxf:outInterceptors
ref bean=soapHeaderSetter /
/cxf:outInterceptors
cxf:inFaultInterceptors /
/cxf:bus


The interceptor kicks in alright when I go back to the client but it's
unclear which Phase I need to be in to add the header and also how to set
the header. Do I just get the headers (btw there are no response headers
available - is that correct?) and then add one to the list like this:


soapMsg.getHeaders().add(new Header(new
QName(http://some.namespace;), api.version=1.7));


I suspect that the way I set this header is not entirely correct :-) I
could
use some help here. THNX

  
  


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland





  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: Setting SOAP header in SOAP response

2007-10-26 Thread Ulhas Bhole

Hi Roland,

It's upto your requirement at which phase it should be added. I don't 
see any problem in the way you are setting header. Do you mean to say 
that interceptor kicks in but you don't see soap header other side?


Regards,

Ulhas Bhole

Ronald Pieterse wrote:

Hello,

I'm trying to set a header in the SOAP response of all my calls.This header
must just contain the version of my service implementation. I'm trying to do
this using an OUT interceptor (extends AbstractSoapInterceptor) which is
defined in my spring file:


bean id=soapHeaderSetter
class=my.package.SoapHeaderSetter /

cxf:bus
cxf:inInterceptors /
cxf:outInterceptors
ref bean=soapHeaderSetter /
/cxf:outInterceptors
cxf:inFaultInterceptors /
/cxf:bus


The interceptor kicks in alright when I go back to the client but it's
unclear which Phase I need to be in to add the header and also how to set
the header. Do I just get the headers (btw there are no response headers
available - is that correct?) and then add one to the list like this:


soapMsg.getHeaders().add(new Header(new
QName(http://some.namespace;), api.version=1.7));


I suspect that the way I set this header is not entirely correct :-) I could
use some help here. THNX

  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: WSS4JOutInterceptor reusing request security header

2007-10-26 Thread Ulhas Bhole

Hi Mayank,

Can you try using latest CXF version? The problem looks more related to 
piggybacking of the security headers which I fixed sometime back.
Take a look at the JIRA issue  
http://issues.apache.org/jira/browse/CXF-790 


Regards,

Ulhas Bhole

Mayank Mishra wrote:

Hi all,

I am using wss4j-1.5.3 and CXF 2.0.

I am trying to secure both incoming and outgoing message from web 
service client to service. Hence, I configured both incoming and 
outgoing interceptors on both client and server.


The incoming request gets secured by WSS4JOutInterceptor on client and 
accordingly get verified by the WSS4JInInterceptor on server. But, 
problem comes in response message from Server to Client. In creating 
the response message on Server, after invoking the service and 
creating right response element, the WSS4JOutInterceptor is putting 
the same security header which was in incoming request (from Client to 
Server) and then adding Security Elements (as configured  in 
WSS4JOutInterceptor configuration).


This happens even WSS4JOutInterceptor is configured for 
Action=NoSecurity, the Outgoing return message contains 
SecurityHeader and security element.


In Signature case:
If the incoming message has following, the return message from server 
also shows the same (obviously no element is found with the URI number)
ds:Reference URI=#id-24924329 
xmlns:ds=http://www.w3.org/2000/09/xmldsig#;


For X509 token,  the same X509SerialNumber is used in response message 
(which is like signing/encrypting using the same key/cert which client 
used in request message)


and for Timestamp same client side timestamp creation and expiry 
values are used.


I am using org.apache.cxf.jaxws.EndpointImpl class to get endpoints of 
service and to configure service Interceptors. On the client side, I 
am using ClientProxy to get endpoint and configure properties on it.


Please let me know, why server interceptor is behaving in such a way.

With Regards,
Mayank









IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: Setting SOAP header in SOAP response

2007-10-26 Thread Ulhas Bhole

Hi Ronald,

I take back my statement from first mail that the header you are setting 
is ok. I had a quick look through the code.


Header expects the data binding that can marshal the header object you 
set or if no databinding specified then the DOM element.
So, instead of adding simple string create a DOM element and add the DOM 
element to the header and you should see the exception disappearing.


Regards,

Ulhas Bhole

Ronald Pieterse wrote:

Ok, at least it seems to respond now but I get a ClassCast exception on the
Object I try to put in the header. I try to do something like this:

soapMsg.getHeaders().add(new Header(new QName(http://api.tripolis.com;),
version=2.0));

for (Header header : soapMsg.getHeaders()) {
 System.out.println(header:  + header.getName());
}

After setting the header I read it out of the message and it looks alright
but further on the exception is thrown like this:

[16:04:59.764] Interceptor has thrown exception, unwinding now
[16:04:59.764] java.lang.ClassCastException: java.lang.String
[16:04:59.764]  at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:120)
...

I'm almost there - I can feel it...


Ulhas Bhole wrote:
  
Are you checking for the DOM elements? Don't expect to see it in string 
format.


you need to get the handle onto the Header list and go through the list 
to check the DOM elements and you would find it there.


Sorry, didn;t read the complete message it looks like your interceptor 
kicks in after the header processing is done. If you have no dependency 
on any interceptors to be finished you can add it before Phase.WRITE.


you can add following lines to your interceptor's constructor and it 
should make sure that the interceptor gets called before the header 
processing happens.


super(Phase.WRITE);
addBefore(SoapOutInterceptor.class.getName());


Regards,

Ulhas

Ronald Pieterse wrote:


Right, The header I'm setting is not appearing when I check the response
in
e.g. SoapUI. The only requirement I have is that I would like to see the
header in my response one way or the other :-)
I also have a System.out.println in my interceptor so I know it kicks in
and
no exceptions are thrown so I wonder where the header went...
The response looks like this:

soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;
   soap:Body
  ns1:getDatabaseFieldsResponse xmlns:ns1=http://some.namespace/;
 databaseFields
  ...
 /databaseFields
  /ns1:getDatabaseFieldsResponse
   /soap:Body
/soap:Envelope


As you can see there's no headers available at all. Any ideas?


Ulhas Bhole wrote:
  
  

Hi Roland,

It's upto your requirement at which phase it should be added. I don't 
see any problem in the way you are setting header. Do you mean to say 
that interceptor kicks in but you don't see soap header other side?


Regards,

Ulhas Bhole

Ronald Pieterse wrote:



Hello,

I'm trying to set a header in the SOAP response of all my calls.This
header
must just contain the version of my service implementation. I'm trying
to
do
this using an OUT interceptor (extends AbstractSoapInterceptor) which
is
defined in my spring file:


bean id=soapHeaderSetter
class=my.package.SoapHeaderSetter /

cxf:bus
cxf:inInterceptors /
cxf:outInterceptors
ref bean=soapHeaderSetter /
/cxf:outInterceptors
cxf:inFaultInterceptors /
/cxf:bus


The interceptor kicks in alright when I go back to the client but it's
unclear which Phase I need to be in to add the header and also how to
set
the header. Do I just get the headers (btw there are no response
headers
available - is that correct?) and then add one to the list like this:


soapMsg.getHeaders().add(new Header(new
QName(http://some.namespace;), api.version=1.7));


I suspect that the way I set this header is not entirely correct :-) I
could
use some help here. THNX

  
  
  


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
Ireland




  
  


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland





  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland


Re: Adding headers to soap request

2007-09-11 Thread Ulhas Bhole
Hi Ryan,

The problem you are seeing might be because he Header processing is
getting the expectation of header from Service model generated from
WSDL. However, the actual header insertion is not happening because the
generated method signature is not containing the header parameter.

You can take a look at the system tests related to SOAP Headers.

Regards,

Ulhas Bhole

Ryan Moquin wrote:
 I was able to get this to work now with my scaled down test wsdl, but not
 the full wsdl that I need it to work with, I'll do my best to help you with
 what I know about this.

 I did notice your thread that sounded familiar.  Apparently if you add the
 -exsh true parameter to wsdl2java, you'll end up with an extra parameter in
 your method signature of your port class implementation.  This extra
 parameter is the header specified in your wsdl.  If you don't add the exsh,
 you won't get the parameter and end up with an IndexOutOfBounds error
 because cxf is expecting the header.  I'm not sure why cxf would assume you
 are including the header if you never generated your classes to accept one.

 I know my classes weren't setting the header because when I did a find
 usages on my AuthCredentials class, which is put in the header, it wasn't
 used anywhere.  Actually the generated client code, didn't even actually
 make calls to invoke the webservice.  It would just create a response object
 set to null and return it, and that was it.  So the generated client in my
 opinion was useless anyhow.

 On 9/11/07, Gamble, Wesley (WG10) [EMAIL PROTECTED] wrote:
   
 Ryan,

 All I
 get currently is an IndexOutOfBoundsException when CXF tries to create
 the
 header of the SOAP message to send,

 sounds suspiciously like my problem (thread: Can't get at SOAP error
 from Web service...).  I'm getting an index out of bounds exception as
 well on the header processing.

 What is the -exsh flag on wsdl2java supposed to do for you?  What does
 Enables or disables processing of extended soap header message
 binding. mean?  How would I know the difference between a regular and
 an extended soap header message?

 How do you know that the generated client classes do NOT set the header
 that is specified in the binding?

 Wes

 -Original Message-
 From: Ryan Moquin [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 11, 2007 9:36 AM
 To: cxf-user@incubator.apache.org
 Subject: Adding headers to soap request

 I'm writing this as a new message, but I'm hoping that it's answer will
 solve my other issue I'm writing about.  I think I'm having having
 trouble
 understanding how to add a header to my request using cxf.  In short, I
 have
 a WSDL that defines this element:

 s:element name=AuthCredentials type=tns:AuthCredentials/
   s:complexType name=AuthCredentials
 s:sequence
   s:element minOccurs=0 maxOccurs=1 name=username
 type=s:string/
   s:element minOccurs=0 maxOccurs=1 name=password
 type=s:string/
 /s:sequence
   /s:complexType

 and then defines a binding that uses it:

 wsdl:operation name=sendNotification
   soap:operation
 soapAction=urn://testnotification/sendNotification
 style=document/
   wsdl:input
 soap:body use=literal/
 soap:header message=tns:sendNotificationAuthCredentials
 part=AuthCredentials use=literal/
   /wsdl:input
   wsdl:output
 soap:body use=literal/
   /wsdl:output
 /wsdl:operation

 When I run this WSDL through wsdltojava using -exsh true, the generated
 client classes do NOT set the header that is specified in the binding,
 which
 is what I thought that the -exsh is supposed to do for you.  So
 basically,
 I'm trying to figure out how I would add this element to my request.
 Here
 is what WSDL to java generated, how do I add the AuthCredentials element
 to
 the messagingPort class so that my request will go through with it? All
 I
 get currently is an IndexOutOfBoundsException when CXF tries to create
 the
 header of the SOAP message to send, I'm guessing because I don't know
 how to
 add the header.  I looked at the CXF examples on it, but it doesn't look
 like the headers are being added as a header:

 public void sendNotification() {
 NotificationService messagingService = null;
 NotificationServicePort messagingPort = null;

 messagingService = new NotificationService(wsdl, SERVICE_NAME);
 messagingPort = messagingService.getNotificationServicePort();

 System.out.println(Invoking sendNotification...);
 java.lang.String _sendNotification_parametersVal = ;
 javax.xml.ws.Holderjava.lang.String _sendNotification_parameters =
 new
 javax.xml.ws.Holderjava.lang.String(_sendNotification_parametersVal);
 messagingPort.sendNotification(_sendNotification_parameters);
 System.out.println(sendNotification._sendNotification_parameters=
 +
 _sendNotification_parameters.value);
   }

 

   



IONA Technologies PLC (registered in Ireland)
Registered Number

Re: WSS4J implementation in CXF

2007-07-24 Thread Ulhas Bhole(IONA)
Hi Fred,

I was involved in Header support stuff so I am looking into CXF--790.

One alternative I am trying to see if it can be fixed in general with
some kind of marking for application specific headers and CXF headers
and filtering them while copying into JAX-WS responseContext  or
WebServiceContext so that only application specific headers can be sent
to application layer and it won't contain any internal CXF headers.

Regards,

Ulhas Bhole

Fred Dushin wrote:
 Thanks, Dan.

 There's an issue with the WSS4J interceptor, which I encountered when
 testing interop with WCF-3.0 WS-Sec 1.0 scenarios.

 The issue resulted in my posting

 http://issues.apache.org/jira/browse/CXF-790

 but I'm told this behavior in CXF is by design, and hence (I suspect)
 may not be fixed in general, so we may need to modify the WSS4J
 interceptor, itself.

 The problem boils down to the fact that the CXF runtime is copying
 headers that are sent from the client, and processed in the server on
 the inbound side, onto the outbound response context.  As a
 consequence, the client gets back headers it sent to the server.  Some
 of these headers have things like key references (which in general the
 client can't resolve), or they reference protected parts which can't
 be resolved, because the wsu:id refers to elements in the input, not
 in the output.

 The solution should probably be to remove any security headers from
 the message on the inbound side, after they have been processed,
 though this will have consequences for entities downstream from the
 WSS4J interceptor; this in interceptor is typically fairly close to
 the wire, so anyone who previously may have had an interest in these
 headers will be sunk.  (I know of no such entities, but I don't know
 all deployments.)  It's also sometimes difficult to figure out which
 headers to remove, since the return values from WSS4J may not be
 sufficiently informative.

 There are some other issues with the checkReceiverResults operation,
 which our WSS4J in-interceptor inherits from WSHandler -- it's
 particularly sensitive to the ordering of elements, in cases where it
 probably doesn't need to be, and which introduces issues when trying
 to service requests from multiple toolkits, which all have their own
 peculiar ordering characteristics.  Something we're looking at, in WSS4J.

 -Fred

 On Jul 21, 2007, at 12:09 PM, Dan Diephouse wrote:

 Hiya,
 Thanks for reporting this. I've fixed this in SVN now. You can either
 compile from SVN or I can ping you once a new snapshot is uploaded
 (probably
 monday).

 Cheers,
 - Dan

 On 7/21/07, Dale Peakall [EMAIL PROTECTED] wrote:

 No, this won't work.  I posted an e-mail on the dev list about this
 yesterday.  The problem is the WSS4JInInterceptor doesn't accept a
 MapString, Object only a MapString, String so there is no way to
 ref
 an instantiated object.

 Julio Arias wrote:
  Hello -
 
  You could use something like this, but there is a bug in the
  WSS4JInInterceptor https://issues.apache.org/jira/browse/CXF-819 that
  needs to be address beffore you can use a password callback by
 reference
 
  jaxws:endpoint id=metadataService address=/MetadataService
  implementor=#metadataServiceImpl
  jaxws:inInterceptors
  bean
  class=org.apache.cxf.binding.soap.saaj.SAAJInInterceptor/
  bean
  class=org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor
  property name=properties
  map
  entry key=action value=UsernameToken/
  entry key=passwordType
 value=PasswordText/
  entry key=passwordCallbackRef
  value-ref=authenticationCallbackHandler/
  /map
  /property
  /bean
  /jaxws:inInterceptors
  /jaxws:endpoint
 
  On Jul 20, 2007, at 2:32 PM, gdprao wrote:
 
 
  I have used spring and Xfire combination to configure WSS4J for user
  authentication with WSS4JInHandler.  I would like to know whether
 it is
  supported in CXF.  Appreciate if someone could help me out on
 this.  My
  current configuration is as follows:
 
  property name=inHandlers
  list
  bean
  class=org.codehaus.xfire.util.dom.DOMInHandler /
  bean
 
  class=org.codehaus.xfire.security.wss4j.WSS4JInHandler
  property name=properties
  map
  entry key=passwordCallbackRef
  bean
 
  class=com.mydomain.security.PasswordHandler
  /bean
  /entry
  entry key=action
 value=UsernameToken
 /
  /map
  /property
 
  /bean
  bean
 
  class=com.mydomain.security.ValidateUserTokenHandler /
  /list
  /property
  --
  View this message in context:
 
 http://www.nabble.com/WSS4J

Re: Add SOAP HEADER value

2007-07-20 Thread Ulhas Bhole(IONA)

Hi Davide,

Are you trying to add soap headers that are not defined in WSDL? 
(Out-of-band Header) If yes then here is the code snippet that does the 
same.


For adding header :
   InvocationHandler handler  = Proxy.getInvocationHandler(portType);
   BindingProvider  bp = null;

   try {
   if (handler instanceof BindingProvider) {
   bp = (BindingProvider)handler;
   MapString, Object requestContext = bp.getRequestContext();
  
   OutofBandHeader ob = new OutofBandHeader();

   ob.setName(testOobHeader);
   ob.setValue(testOobHeaderValue);
   ob.setHdrAttribute(testHdrAttribute);

   JAXBElementOutofBandHeader job = new 
JAXBElementOutofBandHeader(
   new QName(TEST_HDR_NS, TEST_HDR_REQUEST_ELEM), 
OutofBandHeader.class, null, ob);

   Header hdr = new Header(
   new QName(TEST_HDR_NS, TEST_HDR_REQUEST_ELEM),
   job,
   new JAXBDataBinding(ob.getClass()));

   ListHeader holder = new ArrayListHeader();
   holder.add(hdr);
  
   //Add List of headerHolders to requestContext.

   requestContext.put(Header.HEADER_LIST, holder);
   }
   } catch (JAXBException ex) {
   //System.out.println(failed to insert header into request 
context : + ex);

   }
  



For Accessing the headers received from server :

   InvocationHandler handler  = Proxy.getInvocationHandler(portType);
   BindingProvider  bp = null;
   if (handler instanceof BindingProvider) {
   bp = (BindingProvider)handler;
   MapString, Object responseContext = bp.getResponseContext();
   OutofBandHeader hdrToTest = null;
   List oobHdr = (List) responseContext.get(Header.HEADER_LIST);
   if (oobHdr == null) {
   fail(Should have got List of out-of-band headers ..);
   }
  
   if (oobHdr != null  oobHdr instanceof List) {

   Iterator iter = oobHdr.iterator();
   while (iter.hasNext()) {
   Object hdr = iter.next();
   if (hdr instanceof Header) {
   Header hdr1 = (Header) hdr;
   if (hdr1.getObject() instanceof Node) {
   //System.out.println(Node conains :  + 
hdr1.getObject().toString());

   try {
   JAXBElement job = (JAXBElement) 
JAXBContext.newInstance(ObjectFactory.class)

   .createUnmarshaller()
   .unmarshal((Node) hdr1.getObject());
   hdrToTest = (OutofBandHeader) 
job.getValue();
// System.out.println(oob-hdr contains 
: \nname = 

//   + hdrToTest.getName()
//   +   \nvalue =  + 
hdrToTest.getValue()
//   +  \natribute =  + 
hdrToTest.getHdrAttribute());

   } catch (JAXBException ex) {
   //
   ex.printStackTrace();
   }
   }
   }
   }
   }


This code snippet is from the System test and it uses JAXB generated 
class for headers but is not limited to JAXB.


Regards,

Ulhas Bhole

Pirola Davide wrote:

Hi,

anyone know how to add some value to Soap Header in cxf?

I have generated a client code with wsdl2java, but I don't know how to
add this values to the soap header of the message.

I tried with this code:

 


  MapString, Object soapHeaders = new HashMapString, Object();

List h1 = new ArrayList();

h1.add(value1);

soapHeaders.put(parameter1, h1);

List h2 = new ArrayList();

h2.add(parameter2);

soapHeaders.put(value2, h2);

 ...

 ...

requestContext.put(MessageContext.HTTP_REQUEST_HEADERS,
soapHeaders);

 


but, this seems that they are ignored by the server part of the web
services.

 


Thanks

Davide


  



IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland