Re: How to change Axis2 response character encoding

2009-03-12 Thread Sanat Mastan Kumar
Hi Andreas,
The service we are accessing is Omniture Sitecatalyst webservice, which i
think we (atleast i) dont have any control over them. they are claiming that
they are sending data in UTF-8 format, i accept it is we who are sending
these invalid characters(because our site has multi language support ) to
omniture which Omniture is storing in its database, but omniture should
takecare of normalizing them when sending data back in UTF-8 format.

I added following code to my client handler to bring required stream, i put
this handler in clients InFlow Address phase,

ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();
SOAPEnvelope se = msgContext.getEnvelope();
OMOutputFormat outputFormat = new OMOutputFormat();
outputFormat.setCharSetEncoding("ISO-8859-1"); //Also tried with
differnt formats
try{
se.serializeAndConsume(byteOutStr, outputFormat);
}catch (Exception e){
e.printStackTrace();
}

i got the byte stream but it is copy of the actual stream, the problem with
this is msgContext.getEnvelope() contains data until it reached invalid
UTF-8 character, so the same has been copied to ByteArrayOutputStream
because of this wehave only partial response, As soon as stream is coming
from the service axis2 is reading it using UTF8Reader as per below exception
stracktrace. so if we can somehow get the control of reading the actual
stream this will help us in normalizing the invalid characters before
converting it into a streamreader, can you please show how we can read raw
stream from message builder?

Thanks
Sanat.





The only place where you have access to the raw stream is in the
message builder.

I'm just curious: what is preventing you from having the issue fixed
by the people who implemented the service?

Andreas


On Thu, Mar 12, 2009 at 11:33 AM, Sanat Mastan Kumar
wrote:

> Hi Andreas thanks for your response,
>
> can you please suggest how we can take the raw response steam from axis2
> with out any char encoding applying to it?
>
> Sanat,
>
> It is the responsibility of the service to choose the encoding it
> wants to use in its response, and the service is expected to indicate
> the encoding in the Content-Type and then to use that encoding in the
> response. In your case the service fails to do so (unless you have
> discovered a very rare bug in Axis2) and violates the SOAP specs. You
> should collect the evidence for this by inspecting the response using
> TCPMon or Wireshark and tell the people who developed this service to
> fix it.
>
> Andreas
>
> On Wed, Mar 11, 2009 at 18:16, yskm  wrote:
> >
> > Hi,
> >
> > i am consuming a webservice (dont know the implementation of the service)
> > for this i have written my client using axis2 1.4 and rampart 1.4, this
> > client is working fine under normal response payload, if response
> contains
> > any special characters like "Hello world ai? " i.e invalid UTF-8
> characters
> > myclient is breaking... following is the stacktrace
> >
> > org.apache.axis2.AxisFault: Error in extracting message properties
> > � � � �at
> >
> org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:166)
> > � � � �at
> >
> org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
> > � � � �at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
> > � � � �at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
> > � � � �at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
> > � � � �at
> >
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:363)
> > � � � �at
> >
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
> > � � � �at
> >
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
> > � � � �at
> > org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> > � � � �at
> > org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)
> > � � � �at
> > org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
> > � � � �at
> >
> com.paypal.sparta.inbox.ws.OmnitureWSClient.callService(OmnitureWSClient.java:152)
> > � � � �at
> >
> com.paypal.sparta.inbox.ws.OmnitureWSClient.call2(OmnitureWSClient.java:88)
> > � � � �at
> com.paypal.sparta.inbox.ws.OmnitureReport.main(OmnitureReport.java:35)
> > Caused by: org.apache.rampart.RampartException: Error in extracting
> message
> > properties
> > � � � �at
> > org.apache.rampart.RampartMessageData.(RampartMessageData.java:322)
> > � � � �at org.apache.rampart.RampartEngine.process(RampartEngine.java:70)
> > � � � �at
> >
> org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
> > � � � �... 12 more
> > Caused by: org.apache.ws.security.WSSecurityException: Error in
> converting
> > SOAP Envelo

Re: Example for WS-SecurityPolicy in WSDL?

2009-03-12 Thread Dennis Sosnoski

Hi Alexis,

Yes, I'd seen your pleas for a working example when I checked my Axis2 
mail folder before sending this one. I figured I'd give another try with 
a more direct subject line in the hope that somebody might pick up on it.


Since the policy-in-WSDL support is supposed to be one of the new 
features of 1.4, I'm hoping one of the developers at some point actually 
tried it out. :-)


 - Dennis


Alexis Midon wrote:

similar question here [1], some examples would be appreciated.
Thanks!

[1] http://markmail.org/thread/qsn6t4qwepoialud

Alexis


On Thu, Mar 12, 2009 at 2:39 PM, Dennis Sosnoski > wrote:


I've been trying to use the client-side code generation support for
WS-SecurityPolicy in WSDL, with Axis2 1.4.1 and Rampart 1.4. I've
tried
several variations of where I place the policy in the WSDL, including
using reference and embedding it directly in the , but
each time I get:

   [java] Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: can't serialize the policy
..
   [java] at

org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)


   [java] at
org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
   [java] at
org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
   [java] Caused by:
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: can't serialize the policy
..
   [java] at

org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:534)


   [java] at

org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:260)


   [java] ... 2
more
   [java] Caused by: java.lang.RuntimeException: can't serialize the
policy ..
   [java] at

org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getInputElement(AxisServiceBasedMultiLanguageEmitter.java:2732)


   [java] at

org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2261)



   [java] at

org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2151)


   [java] at

org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForInterface(AxisServiceBasedMultiLanguageEmitter.java:1207)


   [java] at

org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeInterface(AxisServiceBasedMultiLanguageEmitter.java:1163)


   [java] at

org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:492)


   [java] ... 3
more
   [java] Java Result: 1

Has anyone been able to get the client-side generation for
WS-SecurityPolicy in WSDL to work? If so, can you supply an
example WSDL?

Thanks,

 - Dennis

-- 
Dennis M. Sosnoski

SOA and Web Services in Java
Axis2 Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117





Re: Example for WS-SecurityPolicy in WSDL?

2009-03-12 Thread Alexis Midon
similar question here [1], some examples would be appreciated.
Thanks!

[1] http://markmail.org/thread/qsn6t4qwepoialud

Alexis


On Thu, Mar 12, 2009 at 2:39 PM, Dennis Sosnoski  wrote:

> I've been trying to use the client-side code generation support for
> WS-SecurityPolicy in WSDL, with Axis2 1.4.1 and Rampart 1.4. I've tried
> several variations of where I place the policy in the WSDL, including
> using reference and embedding it directly in the , but
> each time I get:
>
>[java] Exception in thread "main"
> org.apache.axis2.wsdl.codegen.CodeGenerationException:
> org.apache.axis2.wsdl.codegen.CodeGenerationException:
> java.lang.RuntimeException: can't serialize the policy
> ..
>[java] at
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)
>
>
>[java] at
> org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
>[java] at
> org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
>[java] Caused by:
> org.apache.axis2.wsdl.codegen.CodeGenerationException:
> java.lang.RuntimeException: can't serialize the policy
> ..
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:534)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:260)
>
>
>[java] ... 2
> more
>[java] Caused by: java.lang.RuntimeException: can't serialize the
> policy ..
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getInputElement(AxisServiceBasedMultiLanguageEmitter.java:2732)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2261)
>
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2151)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForInterface(AxisServiceBasedMultiLanguageEmitter.java:1207)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeInterface(AxisServiceBasedMultiLanguageEmitter.java:1163)
>
>
>[java] at
> org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:492)
>
>
>[java] ... 3
> more
>[java] Java Result: 1
>
> Has anyone been able to get the client-side generation for
> WS-SecurityPolicy in WSDL to work? If so, can you supply an example WSDL?
>
> Thanks,
>
>  - Dennis
>
> --
> Dennis M. Sosnoski
> SOA and Web Services in Java
> Axis2 Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>


Example for WS-SecurityPolicy in WSDL?

2009-03-12 Thread Dennis Sosnoski

I've been trying to use the client-side code generation support for
WS-SecurityPolicy in WSDL, with Axis2 1.4.1 and Rampart 1.4. I've tried
several variations of where I place the policy in the WSDL, including
using reference and embedding it directly in the , but
each time I get:

[java] Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: can't serialize the policy
..
[java] at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271) 



[java] at
org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
[java] at
org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
[java] Caused by:
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: can't serialize the policy
..
[java] at
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:534) 



[java] at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:260) 



[java] ... 2
more
[java] Caused by: java.lang.RuntimeException: can't serialize the
policy ..
[java] at
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getInputElement(AxisServiceBasedMultiLanguageEmitter.java:2732) 



[java] at
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2261) 




[java] at
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2151) 



[java] at
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForInterface(AxisServiceBasedMultiLanguageEmitter.java:1207) 



[java] at
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeInterface(AxisServiceBasedMultiLanguageEmitter.java:1163) 



[java] at
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:492) 



[java] ... 3
more
[java] Java Result: 1

Has anyone been able to get the client-side generation for
WS-SecurityPolicy in WSDL to work? If so, can you supply an example WSDL?

Thanks,

 - Dennis

--
Dennis M. Sosnoski
SOA and Web Services in Java
Axis2 Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117




Re: How to change Axis2 response character encoding

2009-03-12 Thread Andreas Veithen
The only place where you have access to the raw stream is in the
message builder.

I'm just curious: what is preventing you from having the issue fixed
by the people who implemented the service?

Andreas

On Thu, Mar 12, 2009 at 07:03, Sanat Mastan Kumar  wrote:
> Hi Andreas thanks for your response,
>
> can you please suggest how we can take the raw response steam from axis2
> with out any char encoding applying to it?
>
> Sanat,
>
> It is the responsibility of the service to choose the encoding it
> wants to use in its response, and the service is expected to indicate
> the encoding in the Content-Type and then to use that encoding in the
> response. In your case the service fails to do so (unless you have
> discovered a very rare bug in Axis2) and violates the SOAP specs. You
> should collect the evidence for this by inspecting the response using
> TCPMon or Wireshark and tell the people who developed this service to
> fix it.
>
> Andreas
>
> On Wed, Mar 11, 2009 at 18:16, yskm  wrote:
>>
>> Hi,
>>
>> i am consuming a webservice (dont know the implementation of the service)
>> for this i have written my client using axis2 1.4 and rampart 1.4, this
>> client is working fine under normal response payload, if response contains
>> any special characters like "Hello world ai? " i.e invalid UTF-8
>> characters
>> myclient is breaking... following is the stacktrace
>>
>> org.apache.axis2.AxisFault: Error in extracting message properties
>> � � � �at
>>
>> org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:166)
>> � � � �at
>> org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
>> � � � �at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
>> � � � �at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
>> � � � �at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
>> � � � �at
>>
>> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:363)
>> � � � �at
>>
>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
>> � � � �at
>>
>> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
>> � � � �at
>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>> � � � �at
>> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)
>> � � � �at
>> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
>> � � � �at
>>
>> com.paypal.sparta.inbox.ws.OmnitureWSClient.callService(OmnitureWSClient.java:152)
>> � � � �at
>>
>> com.paypal.sparta.inbox.ws.OmnitureWSClient.call2(OmnitureWSClient.java:88)
>> � � � �at
>> com.paypal.sparta.inbox.ws.OmnitureReport.main(OmnitureReport.java:35)
>> Caused by: org.apache.rampart.RampartException: Error in extracting
>> message
>> properties
>> � � � �at
>> org.apache.rampart.RampartMessageData.(RampartMessageData.java:322)
>> � � � �at org.apache.rampart.RampartEngine.process(RampartEngine.java:70)
>> � � � �at
>> org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
>> � � � �... 12 more
>> Caused by: org.apache.ws.security.WSSecurityException: Error in converting
>> SOAP Envelope to Document; nested exception is:
>> � � � �org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxIOException:
>> Invalid
>> UTF-8 middle byte 0x66 (at char #57163, byte #56398)
>> � � � �at
>>
>> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:161)
>> � � � �at
>> org.apache.rampart.RampartMessageData.(RampartMessageData.java:158)
>> � � � �... 14 more
>> Caused by: org.apache.axiom.om.OMException:
>> com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte 0x66 (at char
>> #57163, byte #56398)
>> � � � �at
>>
>> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
>> � � � �at
>> org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:327)
>> � � � �at
>> org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:706)
>> � � � �at
>>
>> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:96)
>> � � � �... 15 more
>> Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte
>> 0x66
>> (at char #57163, byte #56398)
>> � � � �at
>> com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:683)
>> � � � �at
>> com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1086)
>> � � � �at
>>
>> org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:506)
>> � � � �at
>>
>> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:161)
>> � � � �... 18 more
>> Caused by: java.io.CharConversionException: Invalid UTF-8 middle byte 0x66
>> (at char #57163, byte #56398)
>> � � � �at
>> com.ctc.wstx.io.UTF8Reader.reportInvalidOther(UTF8Reader.java:313)
>> � � � �at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:204)
>> � � � �at com.ctc.wstx.io.MergedReader.read(MergedReader.java:101)

Re: [xdru...@ambarinformatica.com: Re: [OpenSAML] OpenSAML Integration with AXIOM]

2009-03-12 Thread Andreas Veithen
OMSource does Axiom -> SAX and the transformer will do SAX -> DOM. I
guess that the default transformer implementation is smart enough to
do that without going through another object model (or
serialization/deserialization step). Since SAX is just a sequence of
method calls, this means that no intermediate representation of the
XML will be created.

Andreas

On Thu, Mar 12, 2009 at 12:19, Xavier Drudis Ferran
 wrote:
>
> I've tried axiom-1.2.8 and OMSource, and works fine. (Andreas alternative #2).
>
> Unless I misunderstood something, this alternative does not
> need a copy of the XML text in memory for the SAML assertion in
> addition of the DOM tree, only the DOM tree for it (else I wouldn't
> be able to use OpenSAML, I think).  Not sure if the TransformerFactory
> is heavier enough to warrant a ThreadLocal, though. I think the transformer
> should go in the ThreadLocal ,not only the factory.
>
> new imports:
> import org.w3c.dom.Document;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerConfigurationException;
> import javax.xml.transform.TransformerException;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.dom.DOMResult;
> import org.apache.axiom.om.impl.jaxp.OMSource;
>
> new code:
>
>   private static final ThreadLocal transFac =  new 
> ThreadLocal() {
>           @Override
>        protected TransformerFactory initialValue() {
>             return TransformerFactory.newInstance();
>        }
>   };
>
>   public boolean assercioValida(OMElement assercio) {
>
>        OMSource source = new OMSource(assercio);
>        Element assercioSAMLDOM = null;
>        Transformer transformer;
>        try {
>            transformer = transFac.get().newTransformer();
>            DOMResult result = new  DOMResult();
>            transformer.transform(source, result);
>            assercioSAMLDOM = 
> ((Document)result.getNode()).getDocumentElement();                            
>                                                                
> logger.debug("obteained assertion DOM  \"on the fly\"");
>                                                                               
>          } catch (TransformerConfigurationException e2) {
>              logger.error(e2,e2);
>        } catch (TransformerException e) {
>              logger.error(e,e);
>        }
>
>        try {
>                if (assercioSAMLDOM==null) {
>            // worse solution, generates and parses XML (bytearray) but works 
> with axiom-1.2.7
>                 assercioSAMLDOM = XMLUtils.toDOM(assercio);
>                 logger.debug("obtained assertion DOM through XML (overhead)");
>          [...] Unmarshalling unchanged, as before
>            }
>  [...]
> }
>
>
>
>
> --
> Xavi Drudis Ferran
> xdru...@ambarinformatica.com
>


Re: [xdru...@ambarinformatica.com: Re: [OpenSAML] OpenSAML Integration with AXIOM]

2009-03-12 Thread Andreas Veithen
Thank you for the code. Can you also provide me an XML snippet that
should be processed successfully by the unmarshaller?

Andreas

On Thu, Mar 12, 2009 at 09:59, Xavier Drudis Ferran
 wrote:
> Thank you very much for your explanation.
>
> On Wed, Mar 11, 2009 at 10:02:07PM +0100, Andreas Veithen wrote:
>
>> I think there are three possible approaches to solve your issue:
>>
>> 1. We can try to fix specific issues you discover in DOOM to make it
>> work in your particular use case, as suggested by Ruchith.
>>
>
> Well, it's apparently the exact same case as Ruchith stated.
> But I see it's not a very promising alternative.
>
>> 2. Starting with version 1.2.8, Axiom has OMSource and OMResult
>> classes [1] which are implementations of JAXP's Source and Result
>> classes. You can use these to transform an Axiom tree into DOM (using
>> a standard implementation of DOM) and vice-versa. These two classes
>> are based on SAXSource and SAXResult, which means that you loose the
>> deferred parsing capabilities of Axiom, but in many cases this will be
>> acceptable.
>>
>
> Ok. I'll look into this. Thank you. Aarerntly this wouldn't involve
> much overhead, just the complete SAML assertion tree, but not all
> the SOAP message.
>
>> 3. Some time ago I started an alternative DOM implementation for Axiom
>> which relies on a different pattern than DOOM: it implements the DOM
>> nodes as lightweight proxies that are backed by an existing Axiom
>> implementation (typically the default LLOM implementation). This has
>> several advantages over DOOM, in particular the fact that instead of
>> converting from and to DOM (which is how DOOM is used in practice),
>> you can adapt an existing Axiom tree to DOM and create a new Axiom
>> tree through the DOM API. The goal is to have a really DOM compliant
>> implementation (including DOM 3), except for the part related to DTD
>> handling and validation. The implementation is not yet complete, but
>> already passes a large part of the W3C DOM test suite. I'm interested
>> in testing this on real world use cases, so I would be happy if you
>> could post the code that has an issue with DOOM so that I can test it.
>>
>
> How much code do you need ?
>
> My case is basically a web service server that has to valdidate
> SAML 2 assertions presents in a SOAP Header. But since they don't
> follow any SAML 2 profile precisely, nor WS-Security, I have to
> do some validation manually that I could otherwise use rampart
> or something to do for me.
>
> // [ quick summary of imports, in case it's relevant ]
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.impl.builder.StAXOMBuilder;
> import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.util.XMLUtils;
> import org.opensaml.Configuration;
> import org.opensaml.DefaultBootstrap;
> import org.opensaml.saml2.core.Assertion;
> import org.opensaml.xml.ConfigurationException;
> import org.opensaml.xml.XMLObject;
> import org.opensaml.xml.io.Unmarshaller;
> import org.opensaml.xml.io.UnmarshallerFactory;
> import org.opensaml.xml.io.UnmarshallingException;
> import org.opensaml.xml.parse.BasicParserPool;
>
>
> import org.opensaml.xml.validation.ValidationException;
> import org.w3c.dom.Element;
>
> import com.scs.pdcc.opensaml.FilesystemCredentialResolver;
>
> [...]
>
>  public boolean assercioValida(OMElement assercio) {
>
>        //Throws: java.lang.UnsupportedOperationException: T O D O at
>     // org.apache.axiom.om.impl.dom.TextImpl.getWholeText(TextImpl.java:587))
>        Element assercioSAMLDOOM = (Element) new 
> StAXOMBuilder(DOOMAbstractFactory.getOMFactory(), 
> assercio.getXMLStreamReader()).getDocumentElement();
>
>         // this should be irrelevant since it fails before, but ask for 
> details if needed
>        try {
>
>              // works but I believe it's not efficient.
>              // Element assercioSAMLDOOM = XMLUtils.toDOM(assercio);
>
>           // Ara ja tenim un node DOM, obtindrem una Assertion OpenSAML2
>          UnmarshallerFactory unmarshallerFactory = 
> Configuration.getUnmarshallerFactory();
>           Unmarshaller unmarshaller = 
> unmarshallerFactory.getUnmarshaller(Assertion.DEFAULT_ELEMENT_NAME);
>
>        Assertion ass = (Assertion) unmarshaller.unmarshall(assercioSAMLDOOM);
>         valida(ass);
>         return true;
>        } catch (ValidationException e) {
>           logger.warn(e, e);
>        } catch (Exception e1) {
>            logger.error(e1,e1);
>         }
>          return false;
>  }
>
>
> --
> Xavi Drudis Ferran
> xdru...@ambarinformatica.com
>


Re: Asynchronous service couldn't receive request from non-blocking client

2009-03-12 Thread Yong Yuan
On Thu, Mar 12, 2009 at 1:34 AM, Sagara Gunathunga <
sagara.gunathu...@gmail.com> wrote:

> Hi ,
> As you said the problem is client terminate without waiting for
> response ,one possible solution is  set a Thread with reasonable time
> out to hold the process  without  terminate.
>
> Callback callback = new Callback() {
>
>public void onComplete(AsyncResult result) {
>
>   //do something
>
>}
>
>
>
> --
> //wait till client get the response
>
> while (!callback.isComplete()) {
>
>Thread.sleep(1000);
>
>index++;
>
>if (index > 20) {
>
>throw new AxisFault("Time out");
>
>}
>
>}
>
>
>
> Thanks,
>
>
> Thanks, Partha. It looks there's a leaking abstraction here, though.
Shouldn't the Axis2 engine ensure all threads behave correctly, thus let a
callback object focus on business logic? At least the WSDL2Java can generate
proper code to manage threads(awkward, but at least hides enough details
from users).


How to get HTTP/1.0 401 error from AxisFault thrown from the module

2009-03-12 Thread Karel Gardas

Hello,

I'm writing custom authorization module which throws AxisFault in case
of user is not authorized to perform a given action. Now I would like to
turn this AxisFault from HTTP/1.0 500  to more
convenient HTTP/1.0 401 error. Is there any possible way how to do it?

So far I've tried this:
http://marc.info/?l=axis-user&m=119610195908463&w=2 but this does not help.

Thanks,
Karel



scope="soapsession" what causes destroy() to be called

2009-03-12 Thread Stadelmann Josef
Hi,

my web service runs in scope="soapsession"
up on a client request, call it session 1, the following functions are called 
in sequence for my login cycle
init(), login(), fktmap(), fktmap(), fktmap(),


then I start the next client, calle it session 2) and the following functions 
should becalled
init(), login(), fktmap(), fktmap(), fktmap(),
but the following functions are called in sequence
destroy(), init(), login(), fktmap(), fktmap(), fktmap(),

in bold the axis2 requierd functions one needs to implement for 
scope="soapsession"

destroy() is the bad guy which deletes me the previous created instance;
hence thereafter client 1 / session 1 is inoperable and returns a fault to the 
client telling me that ServicegroupId is invalid
but that is not true, as TcpMonitor proves the opposit for every more session 1 
calls to fktmap()

Question:
under which conditions, httpMessageRequestHeader issue, http protocol 
dependent, is destroy() called?

Note: with the primary call action="urn:login" the server responses with a 
setCooky and passes me the cooky=JSn...

what httpRequestMessageHeader must be there or absent that a first request from 
a new session does not call destry()

Only then will consecutive requests with the same ServiceGroupId in fact reach 
the old service instance to which it belongs;

So a request with action="urn:login" shall hit init(), then login(), in absence 
of a ServicegroupId, but at no time destroy()

Josef





RE: XMLBeans-Axis2 - Type naming differences

2009-03-12 Thread Martin.Barrs
Thanks Jeff

 

This is certainly one approach. However, there are many, many paths and
they change, making this approach impracticable.

 

I was hoping there's a switch, but I guess Axis2 is calling an XMLbeans
jar directly and passing it's own prefixes via method calls. 

 

It would certainly help if XMLBeans and Axis used the same standards ;)

 

I'll log a bug.

 

 

Thanks

 

Martin

 

 

 

From: Jeff Martin [mailto:jmar...@telecomsys.com] 
Sent: Thursday, March 12, 2009 8:51 AM
To: axis-user@ws.apache.org
Subject: RE: XMLBeans-Axis2 - Type naming differences

 

Martin,

 

The workaround is that you need to specify an .xsdconfig file.  This
lets you take control of how XMLBeans generates package names, rather
then relying on the defaults.  In addition, Axis2's wsdl2java also uses
the .xsdconfig file.

 

You can find the XML schema definitions for the .xsdconfig syntax in
xmlconfig.xsd (this link
  is to the web SVN version)

 

You'd have an xsdconfig file something like this:

 



http://xml.apache.org/xmlbeans/2004/02/xbean/config";>

 

http://example.com/testService/2009/03"; >

com.example.testService.x2009.x03



 



 

The above results in exactly the same XMLBeans-generated names as
XMLBeans would generate without the file.  The main reason to have this
file is that you can tell wsdl2java to use these names:

 

   % wsdl2java.sh -d xmlbeans -xsdconfig example.xsdconfig ...

 

Definitely feels like a bug in 'wsdl2java.sh -d xmlbeans', that Axis2
doesn't use the same conventions even though you say '-d xmlbeans'.

 

-- Jeff

 

 

  _  

From: martin.ba...@wellsfargo.com 
Sent: Wednesday, March 11, 2009 6:16 PM
To: axis-user@ws.apache.org
Subject: XMLBeans-Axis2 - Type naming differences

 

Hello,

I am using Axis2 1.4 and XMLBeans 2.4. I would like to use XMLBeans ant
task to generate all the XMLBeans artifacts and use Axis2 to just
generate the skels and stubs. This is because I have a mix of .wsdl's
and .xsd's I need to generate and would like to normalize the resource
files.

What I've found is, though, that the Axis2 tasks and XMLBeans tasks name
entities differently when a span in the entity path starts with a
number. For example:

Element namespace - com/example/testService/2009/03

Schema - com/example/testService/2009/03/myTestSchema 

XMLBeans generated element -
com.example.testService.x2009.x03.myTestSchema

Axis2 generated element - com.example.testService._2009._03.myTestSchema

Note that XMLbeans prepends 'x' and Axis2 '_' to numeric paths.

This difference changes the resource index mapping making it impossible
to use the separately generated files. 

 

Can anyone tell me how to normalize the naming between Axis2 and
XMLBeans?

 

Thanks in advance,

Martin

 

CONFIDENTIALITY NOTICE: The information contained in this message may be
privileged and/or confidential. If you are not the intended recipient,
or responsible for delivering this message to the intended recipient,
any review, forwarding, dissemination, distribution or copying of this
communication or any attachment(s) is strictly prohibited. If you have
received this message in error, please notify the sender immediately,
and delete it and all attachments from your computer and network.



jar in aar file failed to be loaded

2009-03-12 Thread hping

Hello,

I am constructing an axis2 server using the axis2 library, and we pretty
much followed the steps in: http://wso2.org/library/585 by using Creating
ConfigurationContext using Custom AxisConfigurator.

It works great for most of the cases, but had problem to load the jar file
inside aar lib directory. For example, we have a EchoService, where the
EchoServiceSkeleton.java needs the Testee.jar which in the lib dir of the
aar. So the strcture of aar file is like:
  META-INF/
  META-INF/MANIFEST.MF
  META-INF/EchoService.wsdl
  META-INF/services.xml
  lib/
  lib/Testee.jar
  org/
...
  org/apache/axis2/EchoService/EchoServiceSkeleton.class
  org/example1/
...
  org/example1/example1/Echo.class...


We always got: java.lang.NoClassDefFoundError:
sample/for_lib_in_aar/Testing. 

While debuging this problem, I noticed that when the service was populated,
the jar file was extracted at tmp/_axis2 directory, and I even can see the
path is correctly listed inside the ucp of DeploymentClassLoader. So the I
believe the DeploymentClassLoader was correctly.

But when axis2 server invokeBusinessLogic(messageCtx), it always using the
URLClassLoader from AxisConfiguration, but not the DeploymentClassLoader
which associated with the specific service.

I also tried the  composite for
services.xml, but no difference.

Can anyone give me some idea?
-- 
View this message in context: 
http://www.nabble.com/jar-in-aar-file-failed-to-be-loaded-tp22478921p22478921.html
Sent from the Axis - User mailing list archive at Nabble.com.



RE: XMLBeans-Axis2 - Type naming differences

2009-03-12 Thread Jeff Martin
Martin,

 

The workaround is that you need to specify an .xsdconfig file.  This
lets you take control of how XMLBeans generates package names, rather
then relying on the defaults.  In addition, Axis2's wsdl2java also uses
the .xsdconfig file.

 

You can find the XML schema definitions for the .xsdconfig syntax in
xmlconfig.xsd (this link
  is to the web SVN version)

 

You'd have an xsdconfig file something like this:

 



http://xml.apache.org/xmlbeans/2004/02/xbean/config";>

 

http://example.com/testService/2009/03"; >

com.example.testService.x2009.x03



 



 

The above results in exactly the same XMLBeans-generated names as
XMLBeans would generate without the file.  The main reason to have this
file is that you can tell wsdl2java to use these names:

 

   % wsdl2java.sh -d xmlbeans -xsdconfig example.xsdconfig ...

 

Definitely feels like a bug in 'wsdl2java.sh -d xmlbeans', that Axis2
doesn't use the same conventions even though you say '-d xmlbeans'.

 

-- Jeff

 

 



From: martin.ba...@wellsfargo.com 
Sent: Wednesday, March 11, 2009 6:16 PM
To: axis-user@ws.apache.org
Subject: XMLBeans-Axis2 - Type naming differences

 

Hello,

I am using Axis2 1.4 and XMLBeans 2.4. I would like to use XMLBeans ant
task to generate all the XMLBeans artifacts and use Axis2 to just
generate the skels and stubs. This is because I have a mix of .wsdl's
and .xsd's I need to generate and would like to normalize the resource
files.

What I've found is, though, that the Axis2 tasks and XMLBeans tasks name
entities differently when a span in the entity path starts with a
number. For example:

Element namespace - com/example/testService/2009/03

Schema - com/example/testService/2009/03/myTestSchema 

XMLBeans generated element -
com.example.testService.x2009.x03.myTestSchema

Axis2 generated element - com.example.testService._2009._03.myTestSchema

Note that XMLbeans prepends 'x' and Axis2 '_' to numeric paths.

This difference changes the resource index mapping making it impossible
to use the separately generated files. 

 

Can anyone tell me how to normalize the naming between Axis2 and
XMLBeans?

 

Thanks in advance,

Martin

 


CONFIDENTIALITY NOTICE: The information contained in this message may be 
privileged and/or confidential. If you are not the intended recipient, or 
responsible for delivering this message to the intended recipient, any review, 
forwarding, dissemination, distribution or copying of this communication or any 
attachment(s) is strictly prohibited. If you have received this message in 
error, please notify the sender immediately, and delete it and all attachments 
from your computer and network.


Problem with Axis2 Code Generator - Java2WSDL

2009-03-12 Thread Michael
Not long ago I posted that I was was having a problem generating a WSDL file 
from my Java code using the Axis2 Code Generator.

An answer was provided which seemed very promising.  The answer that was given 
is provided below:

This is a known bug.  Here is the solution with explanation:

http://blogiterox.wordpress.com/2008/10/24/exploring-apache-axis2-and-eclipse-plug-in-development/

Solution: Copy the jar for stax and for backport to the plug-in directory 
(\plug-ins\\lib) and then add the backport jar 
to the plugin.xml file.

I went to the link provided and followed the directions provided there (these 
are summarized in the solution given above) and tried to generate a WSDL file 
from my code.

I encountered the exact same problem.  A description of that problem is 
provided below:

When I launch the Axis2 Code Generator (v1.3.0) Wizard, enter the fully 
qualified class name and the location of the class file and then select the 
button to test loading the class I keep getting a 
java.lang.ClassNotFoundException.

Can anyone provide any additional help?

Thanks
Mike


Fwd: Adding security header to STSClient in rahas

2009-03-12 Thread Håkon Sagehaug
-- Forwarded message --
From: Håkon Sagehaug 
Date: 2009/3/12
Subject: Re: Adding security header to STSClient in rahas
To: rampart-...@ws.apache.org


Hi

what I read out of the code is that if username and password is set in
options it should be picked up, but I set it in option and still no
unsername token header.

Here is my policy, if anyone sees something wrong it's highly appreciated

http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"; xmlns:sp="
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>





http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";>






















http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>

http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";
/>





http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";>







http://ws.apache.org/rampart/policy
">
client
service

PWCBHandler



JKS

   clientTrustStore.jks

pass






2009/3/11 Martin Gainty 


>/**
> * Sets the crypto information required to process the RSTR.
> *
> * @param cryptoCrypto information
> * @param cbHandler Callback handler to provide the private key password
> to
> *  decrypt
> */
>public void setCryptoInfo(Crypto crypto, CallbackHandler cbHandler) {
>this.crypto = crypto;
>this.cbHandler = cbHandler;
>}
>
> Test Harness from RampartUtil:
> public static String getToken(RampartMessageData rmd, OMElement
> rstTemplate,
>String issuerEpr, String action, Policy issuerPolicy) throws
> RampartException {
>
>try {
>//First check whether the user has provided the token
>MessageContext msgContext = rmd.getMsgContext();
>String customTokeId = (String) msgContext
>
>  .getProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN);
>if(customTokeId != null) {
>return customTokeId;
>} else {
>
>Axis2Util.useDOOM(false);
>
>STSClient client = new STSClient(rmd.getMsgContext()
>.getConfigurationContext());
>// Set request action
>client.setAction(action);
>
>client.setRstTemplate(rstTemplate);
>
>// Set crypto information
>Crypto crypto =
> RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(),
>
>  rmd.getMsgContext().getAxisService().getClassLoader());
>CallbackHandler cbh = RampartUtil.getPasswordCB(rmd);
>client.setCryptoInfo(crypto, cbh);
>
> which is called from BindingBuilder:
>  protected WSSecUsernameToken addUsernameToken(RampartMessageData rmd)
> throws RampartException {
>
>log.debug("Adding a UsernameToken");
>
>RampartPolicyData rpd = rmd.getPolicyData();
>
>//Get the user
>//First try options
>Options options = rmd.getMsgContext().getOptions();
>String user = options.getUserName();
>if(user == null || user.length() == 0) {
>//Then try RampartConfig
>if(rpd.getRampartConfig() != null) {
>user = rpd.getRampartConfig().getUser();
>}
>}
>
>if(user != null && !"".equals(user)) {
>log.debug("User : " + user);
>
>//Get the password
>
>//First check options object for a password
>String password = options.getPassword();
>
>if((password == null || password.length() == 0) &&
>rpd.getRampartConfig() != null) {
>
>//Then try to get the password from the given callback
> handler
>CallbackHandler handler = RampartUtil.getPasswordCB(rmd);
>
> where RampartPolicyData has mutator method for recipientToken
> /*** @param recipientToken The recipientToken to set. */
>public void setRecipientToken(Token recipient

Re: [xdru...@ambarinformatica.com: Re: [OpenSAML] OpenSAML Integration with AXIOM]

2009-03-12 Thread Xavier Drudis Ferran

I've tried axiom-1.2.8 and OMSource, and works fine. (Andreas alternative #2).
 
Unless I misunderstood something, this alternative does not 
need a copy of the XML text in memory for the SAML assertion in 
addition of the DOM tree, only the DOM tree for it (else I wouldn't
be able to use OpenSAML, I think).  Not sure if the TransformerFactory 
is heavier enough to warrant a ThreadLocal, though. I think the transformer
should go in the ThreadLocal ,not only the factory. 

new imports: 
import org.w3c.dom.Document;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import org.apache.axiom.om.impl.jaxp.OMSource;

new code:

   private static final ThreadLocal transFac =  new 
ThreadLocal() {
   @Override
protected TransformerFactory initialValue() {
 return TransformerFactory.newInstance();
}
   };

   public boolean assercioValida(OMElement assercio) {

OMSource source = new OMSource(assercio); 
Element assercioSAMLDOM = null;
Transformer transformer;
try {
transformer = transFac.get().newTransformer();
DOMResult result = new  DOMResult();
transformer.transform(source, result);
assercioSAMLDOM = 
((Document)result.getNode()).getDocumentElement();  
 
logger.debug("obteained assertion DOM  \"on the fly\"");

} catch (TransformerConfigurationException e2) {
  logger.error(e2,e2);
} catch (TransformerException e) {
  logger.error(e,e);
}

try {
if (assercioSAMLDOM==null) {
// worse solution, generates and parses XML (bytearray) but works 
with axiom-1.2.7
 assercioSAMLDOM = XMLUtils.toDOM(assercio);
 logger.debug("obtained assertion DOM through XML (overhead)");
  [...] Unmarshalling unchanged, as before
}
 [...]  
}




-- 
Xavi Drudis Ferran
xdru...@ambarinformatica.com


Re: [xdru...@ambarinformatica.com: Re: [OpenSAML] OpenSAML Integration with AXIOM]

2009-03-12 Thread Xavier Drudis Ferran
Thank you very much for your explanation. 

On Wed, Mar 11, 2009 at 10:02:07PM +0100, Andreas Veithen wrote:

> I think there are three possible approaches to solve your issue:
> 
> 1. We can try to fix specific issues you discover in DOOM to make it
> work in your particular use case, as suggested by Ruchith.
>

Well, it's apparently the exact same case as Ruchith stated. 
But I see it's not a very promising alternative. 
 
> 2. Starting with version 1.2.8, Axiom has OMSource and OMResult
> classes [1] which are implementations of JAXP's Source and Result
> classes. You can use these to transform an Axiom tree into DOM (using
> a standard implementation of DOM) and vice-versa. These two classes
> are based on SAXSource and SAXResult, which means that you loose the
> deferred parsing capabilities of Axiom, but in many cases this will be
> acceptable.
>

Ok. I'll look into this. Thank you. Aarerntly this wouldn't involve 
much overhead, just the complete SAML assertion tree, but not all 
the SOAP message. 
 
> 3. Some time ago I started an alternative DOM implementation for Axiom
> which relies on a different pattern than DOOM: it implements the DOM
> nodes as lightweight proxies that are backed by an existing Axiom
> implementation (typically the default LLOM implementation). This has
> several advantages over DOOM, in particular the fact that instead of
> converting from and to DOM (which is how DOOM is used in practice),
> you can adapt an existing Axiom tree to DOM and create a new Axiom
> tree through the DOM API. The goal is to have a really DOM compliant
> implementation (including DOM 3), except for the part related to DTD
> handling and validation. The implementation is not yet complete, but
> already passes a large part of the W3C DOM test suite. I'm interested
> in testing this on real world use cases, so I would be happy if you
> could post the code that has an issue with DOOM so that I can test it.
>

How much code do you need ?

My case is basically a web service server that has to valdidate
SAML 2 assertions presents in a SOAP Header. But since they don't
follow any SAML 2 profile precisely, nor WS-Security, I have to 
do some validation manually that I could otherwise use rampart 
or something to do for me. 

// [ quick summary of imports, in case it's relevant ]
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.util.XMLUtils;
import org.opensaml.Configuration;
import org.opensaml.DefaultBootstrap;
import org.opensaml.saml2.core.Assertion;
import org.opensaml.xml.ConfigurationException;
import org.opensaml.xml.XMLObject;
import org.opensaml.xml.io.Unmarshaller;
import org.opensaml.xml.io.UnmarshallerFactory;
import org.opensaml.xml.io.UnmarshallingException;
import org.opensaml.xml.parse.BasicParserPool;


import org.opensaml.xml.validation.ValidationException;
import org.w3c.dom.Element;

import com.scs.pdcc.opensaml.FilesystemCredentialResolver;

[...]
  
  public boolean assercioValida(OMElement assercio) {

//Throws: java.lang.UnsupportedOperationException: T O D O at
 // org.apache.axiom.om.impl.dom.TextImpl.getWholeText(TextImpl.java:587))
Element assercioSAMLDOOM = (Element) new 
StAXOMBuilder(DOOMAbstractFactory.getOMFactory(), 
assercio.getXMLStreamReader()).getDocumentElement();   

 // this should be irrelevant since it fails before, but ask for 
details if needed
try {

  // works but I believe it's not efficient.
  // Element assercioSAMLDOOM = XMLUtils.toDOM(assercio);

   // Ara ja tenim un node DOM, obtindrem una Assertion OpenSAML2
  UnmarshallerFactory unmarshallerFactory = 
Configuration.getUnmarshallerFactory();
   Unmarshaller unmarshaller = 
unmarshallerFactory.getUnmarshaller(Assertion.DEFAULT_ELEMENT_NAME);

Assertion ass = (Assertion) unmarshaller.unmarshall(assercioSAMLDOOM);
 valida(ass);
 return true;
} catch (ValidationException e) {
   logger.warn(e, e);
} catch (Exception e1) {
logger.error(e1,e1);
 }
  return false; 
  }


-- 
Xavi Drudis Ferran
xdru...@ambarinformatica.com


Re: Asynchronous service couldn't receive request from non-blocking client

2009-03-12 Thread Sagara Gunathunga
Hi ,
As you said the problem is client terminate without waiting for
response ,one possible solution is  set a Thread with reasonable time
out to hold the process  without  terminate.

Callback callback = new Callback() {

public void onComplete(AsyncResult result) {

   //do something

}



--
//wait till client get the response

while (!callback.isComplete()) {

Thread.sleep(1000);

index++;

if (index > 20) {

throw new AxisFault("Time out");

}

}



Thanks,



On Thu, Mar 12, 2009 at 12:44 PM, Parthasarathy Kesavaraj
 wrote:
> I also have the same issue. I am calling a third party BPEL process that
> sends the callback response.
> I could see the process sends the callback but the client already exited
> without receiving the callback.
> Also i could not find any doc on async callback. Is it supported and how to
> implement the client for a service with async callback
> Thanks
> Partha
>
> On Thu, Mar 12, 2009 at 12:37 PM, Yong Yuan  wrote:
>>
>> Hi,
>> I generated my asynchronous Axis2 client and service using WSDL2Java Ant
>> task(i.e., I set asynconly to true when calling the ant task). When I sent a
>> request to the service using the client, the client always exited
>> successfully. However, the server never received any request, and the
>> client's callback method never got called. The strange thing is, if I
>> stepped through the client in a debugger slowly, the server would receive
>> the request, but failed to return the response because the client had
>> already terminated.
>> Here is how I called the client, and it always exited successfully:
>> MyServiceStub stub = new
>> MyServiceStub("http://localhost:8080/axis2/services/myservice";);
>> GetResultsRequest request = new GetResultsRequest();
>> //Set a number of request parameters here
>> stub.startGetResults(request, new MyServiceCallbackHandler(){
>> public void receiveResultGetResults(GetResultsResponse result) {
>> System.out.println(result.getMessage());
>> }
>> });
>> I turned on logging of axis2, and found if the server didn't receive any
>> request, the client-side log would end with the following traces:
>>
>> (ConfigurationContext.java:329) 2009-03-11 22:19:00,350 DEBUG
>> registerOperationContext (false):
>> org.apache.axis2.context.operationcont...@10f0625 with key:
>> urn:uuid:4CA907BDD68BB1F7B81236835140359
>> (OutInAxisOperation.java:167) 2009-03-11 22:19:16,610 DEBUG Entry:
>> OutInAxisOperationClient::execute, false
>> (OutInAxisOperation.java:197) 2009-03-11 22:19:23,781 DEBUG
>> OutInAxisOperationClient: useAsyncOption null
>> (ConfigurationContext.java:329) 2009-03-11 22:21:13,352 DEBUG
>> registerOperationContext (false):
>> org.apache.axis2.context.operationcont...@10f0625 with key:
>> urn:uuid:4CA907BDD68BB1F7B81236835140359
>> (ConfigurationContext.java:336) 2009-03-11 22:21:13,352 DEBUG msgContext:
>> [MessageContext: logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] action:
>> http://myservice.services.my.com/GetResults
>> (Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
>> Phase "OperationOutPhase"
>> (Phase.java:305) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
>> "OperationOutPhase"
>> (Phase.java:328) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
>> phase "OperationOutPhase"
>> (Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
>> Phase "RMPhase"
>> (Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "RMPhase"
>> (Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
>> phase "RMPhase"
>> (Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
>> Phase "PolicyDetermination"
>> (Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
>> "PolicyDetermination"
>> (Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
>> phase "PolicyDetermination"
>> (Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
>> Phase "MessageOut"
>> (Phase.java:305) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
>> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "MessageOut"
>> (Phase.java:328) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
>> logID=urn:uui

Re: OMElement cast exception

2009-03-12 Thread Arjan Broer
Well, i've got this figured out.
Axis2 simply does not support ArrayLists and other java specific
constructs as these are not native to the webservice schemas. Just
create getters and setters that act like arrays and all is fine. I am
still using the arraylist as private attributes, only changed the
getters and setters.

Regards,
  Arjan

On Wed, 2009-03-11 at 10:47 +0100, Arjan Broer wrote:
> Hi,
> 
> For a webservice project i'm using the axis2 framework (1.4.1) with a
> pojo service. That service takes a complex object as input and should
> return a other complex object after some calculations.
> 
> The input object looks like this.
> 
> Order (Serializable)
>   ArrayList placements
> 
> Placement (Serializable)
>   Date publishdate
> 
> But when i send this object and try to loop through the array list i get
> an ClassCast exception:
> Exception in thread "main" org.apache.axis2.AxisFault:
> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to
> mypackage.model.Placement
> 
> I realy have no idea how this can occur as i am using generics
> everywhere. Any hints for me??
> 
> Regards,
>   Arjan


Re: Asynchronous service couldn't receive request from non-blocking client

2009-03-12 Thread Parthasarathy Kesavaraj
I also have the same issue. I am calling a third party BPEL process that
sends the callback response.
I could see the process sends the callback but the client already exited
without receiving the callback.
Also i could not find any doc on async callback. Is it supported and how to
implement the client for a service with async callback
Thanks
Partha

On Thu, Mar 12, 2009 at 12:37 PM, Yong Yuan  wrote:

> Hi,
> I generated my asynchronous Axis2 client and service using WSDL2Java Ant
> task(i.e., I set asynconly to true when calling the ant task). When I sent a
> request to the service using the client, the client always exited
> successfully. However, the server never received any request, and the
> client's callback method never got called. The strange thing is, if I
> stepped through the client in a debugger slowly, the server would receive
> the request, but failed to return the response because the client had
> already terminated.
>
> Here is how I called the client, and it always exited successfully:
>
>  MyServiceStub stub = new MyServiceStub("
> http://localhost:8080/axis2/services/myservice";);
>  GetResultsRequest request = new GetResultsRequest();
>
> //Set a number of request parameters here
>
> stub.startGetResults(request, new MyServiceCallbackHandler(){
> public void receiveResultGetResults(GetResultsResponse result) {
> System.out.println(result.getMessage());
> }
> });
>
> I turned on logging of axis2, and found if the server didn't receive any
> request, the client-side log would end with the following traces:
>
> (ConfigurationContext.java:329) 2009-03-11 22:19:00,350 DEBUG
> registerOperationContext (false):
> org.apache.axis2.context.operationcont...@10f0625 with key:
> urn:uuid:4CA907BDD68BB1F7B81236835140359
> (OutInAxisOperation.java:167) 2009-03-11 22:19:16,610 DEBUG Entry:
> OutInAxisOperationClient::execute, false
> (OutInAxisOperation.java:197) 2009-03-11 22:19:23,781 DEBUG
> OutInAxisOperationClient: useAsyncOption null
> (ConfigurationContext.java:329) 2009-03-11 22:21:13,352 DEBUG
> registerOperationContext (false):
> org.apache.axis2.context.operationcont...@10f0625 with key:
> urn:uuid:4CA907BDD68BB1F7B81236835140359
> (ConfigurationContext.java:336) 2009-03-11 22:21:13,352 DEBUG msgContext:
> [MessageContext: logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] action:
> http://myservice.services.my.com/GetResults
> (Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
> Phase "OperationOutPhase"
> (Phase.java:305) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
> "OperationOutPhase"
> (Phase.java:328) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
> phase "OperationOutPhase"
> (Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
> Phase "RMPhase"
> (Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "RMPhase"
> (Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
> phase "RMPhase"
> (Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
> Phase "PolicyDetermination"
> (Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
> "PolicyDetermination"
> (Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
> phase "PolicyDetermination"
> (Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
> Phase "MessageOut"
> (Phase.java:305) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "MessageOut"
> (Phase.java:328) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
> phase "MessageOut"
> (Phase.java:292) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
> Phase "Security"
> (Phase.java:305) 2009-03-11 22:21:13,359 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "Security"
> (Phase.java:328) 2009-03-11 22:21:13,359 DEBUG [MessageContext:
> logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
> phase "Security"
>
> If the server did get the request from the client, the client-side log
> would end with the following trace in addition to the traces mentioned
> above:
>
> (SOAPMessageFormatter.java:133) 2009-03-11 22:21

Asynchronous service couldn't receive request from non-blocking client

2009-03-12 Thread Yong Yuan
Hi,
I generated my asynchronous Axis2 client and service using WSDL2Java Ant
task(i.e., I set asynconly to true when calling the ant task). When I sent a
request to the service using the client, the client always exited
successfully. However, the server never received any request, and the
client's callback method never got called. The strange thing is, if I
stepped through the client in a debugger slowly, the server would receive
the request, but failed to return the response because the client had
already terminated.

Here is how I called the client, and it always exited successfully:

MyServiceStub stub = new MyServiceStub("
http://localhost:8080/axis2/services/myservice";);
GetResultsRequest request = new GetResultsRequest();

//Set a number of request parameters here

stub.startGetResults(request, new MyServiceCallbackHandler(){
public void receiveResultGetResults(GetResultsResponse result) {
System.out.println(result.getMessage());
}
});

I turned on logging of axis2, and found if the server didn't receive any
request, the client-side log would end with the following traces:

(ConfigurationContext.java:329) 2009-03-11 22:19:00,350 DEBUG
registerOperationContext (false):
org.apache.axis2.context.operationcont...@10f0625 with key:
urn:uuid:4CA907BDD68BB1F7B81236835140359
(OutInAxisOperation.java:167) 2009-03-11 22:19:16,610 DEBUG Entry:
OutInAxisOperationClient::execute, false
(OutInAxisOperation.java:197) 2009-03-11 22:19:23,781 DEBUG
OutInAxisOperationClient: useAsyncOption null
(ConfigurationContext.java:329) 2009-03-11 22:21:13,352 DEBUG
registerOperationContext (false):
org.apache.axis2.context.operationcont...@10f0625 with key:
urn:uuid:4CA907BDD68BB1F7B81236835140359
(ConfigurationContext.java:336) 2009-03-11 22:21:13,352 DEBUG msgContext:
[MessageContext: logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] action:
http://myservice.services.my.com/GetResults
(Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "OperationOutPhase"
(Phase.java:305) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
"OperationOutPhase"
(Phase.java:328) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "OperationOutPhase"
(Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "RMPhase"
(Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "RMPhase"
(Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "RMPhase"
(Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "PolicyDetermination"
(Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
"PolicyDetermination"
(Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "PolicyDetermination"
(Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "MessageOut"
(Phase.java:305) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "MessageOut"
(Phase.java:328) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "MessageOut"
(Phase.java:292) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "Security"
(Phase.java:305) 2009-03-11 22:21:13,359 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "Security"
(Phase.java:328) 2009-03-11 22:21:13,359 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "Security"

If the server did get the request from the client, the client-side log would
end with the following trace in addition to the traces mentioned above:

(SOAPMessageFormatter.java:133) 2009-03-11 22:21:13,433 DEBUG contentType
from the OMOutputFormat =text/xml
(SOAPMessageFormatter.java:158) 2009-03-11 22:21:13,434 DEBUG contentType
returned =text/xml; charset=UTF-8
(AbstractContext.java:407) 2009-03-11 22:21:13,441 DEBUG ==
(AbstractContext.java:408) 2009-03-11 22:21:13,441 DEBUG  Property set on
object org.apache.axis2.context.messagecont...@3cbb4b
(AbstractContext.java:409) 2009-03-11 22:21:13,441 DEBUG   Key
=HTTP_METHOD_OBJECT
(AbstractContext.java:413) 2009-03-11 22:21:13,441 DEBUG   Value Class =
org.apache.commons.httpclient.methods.PostMethod
(Ab