What to free after a SOAP request (Axis2/C ADB)

2008-12-15 Thread Sérgio Gomes
Hi there!

I'm using the ADB generated code to write some small apps (samples for
an API). I'd like to make this code as correct as possible, since
developers will be using it as a reference, but I can't find anything
in the documentation as to what exactly I'm supposed to free or not.

In the samples I start by creating the environment, some headers, the
service and a request. I assume I have to free all of these, since I
created them.
However, I'm not so sure about anything created by the framework
(namely, the service response). Is it safe to free these myself or
will the framework try to, at some point? Anything else I should look
out for?

Looks like the code samples included with Axis don't do any freeing,
so it's hard to tell what's the right procedure.

Thanks in advance!

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047


Re: What to free after a SOAP request (Axis2/C ADB)

2008-12-15 Thread Dimuthu Gamage
Hi Sérgio Gomes,

If you are writing clients, you need to free the stub, request and response
adbs and the env.

If you are writing services, you don't need to free any adb. But if you do
custom malloc or strdups you have to free them.

Thanks
Dimuthu

On Mon, Dec 15, 2008 at 10:26 PM, Sérgio Gomes sgo...@google.com wrote:

 Hi there!

 I'm using the ADB generated code to write some small apps (samples for
 an API). I'd like to make this code as correct as possible, since
 developers will be using it as a reference, but I can't find anything
 in the documentation as to what exactly I'm supposed to free or not.

 In the samples I start by creating the environment, some headers, the
 service and a request. I assume I have to free all of these, since I
 created them.
 However, I'm not so sure about anything created by the framework
 (namely, the service response). Is it safe to free these myself or
 will the framework try to, at some point? Anything else I should look
 out for?

 Looks like the code samples included with Axis don't do any freeing,
 so it's hard to tell what's the right procedure.

 Thanks in advance!

 Cheers,
 Sérgio

 ---
 Sérgio Gomes
 Developer Relations

 Google | Gordon House | Barrow Street | Dublin 4 | Ireland
 Registered in Dublin, Ireland | Registration Number: 368047




-- 
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org


Re: Registering new handlers programmatically with Axis2

2008-12-15 Thread Deepak Vishwakarma
Thanks for your response.
But, will this approach work in IBM WebSphere Application Server 6.1v?


--- On Wed, 3/12/08, Amila Suriarachchi amilasuriarach...@gmail.com wrote:

 From: Amila Suriarachchi amilasuriarach...@gmail.com
 Subject: Re: Registering new handlers programmatically with Axis2
 To: axis-...@ws.apache.org, vdeepa...@yahoo.co.in
 Cc: axis-user axis-user@ws.apache.org
 Date: Wednesday, 3 December, 2008, 8:35 PM
 On Wed, Dec 3, 2008 at 12:33 PM, Deepak Vishwakarma
 vdeepa...@yahoo.co.inwrote:
 
  Hi,
 
   Currently Axis2 registers the handlers specified in
 the axis2.xml
  configuration file.
   Is there a way to programmatically register new
 custom handlers with Axis2
  runtime i.e. i don't want to use the axis2.xml
 approach? How can this be
  achieved?
 
 
 see
 
 addRequestBlockingHandlerToInFlows() method of this[1]
 class.
 
 thanks,
 Amila.
 
 [1]
 http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesClusterManager.java?view=markup
 
 
 
  Thanks,
  Deepak.
 
 
   Add more friends to your messenger and enjoy! Go
 to
  http://messenger.yahoo.com/invite/
 
 
 -
  To unsubscribe, e-mail:
 axis-dev-unsubscr...@ws.apache.org
  For additional commands, e-mail:
 axis-dev-h...@ws.apache.org
 
 
 
 
 -- 
 Amila Suriarachchi
 WSO2 Inc.
 blog: http://amilachinthaka.blogspot.com/


  Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/


Axis 1.3 - Problem with Handler

2008-12-15 Thread Harikrishna Vemula
Hi,
   I have a Webservice for that i implemented a Handler to validate
input request with XSD. Whenever any exception occurs in invoke method i'm
throwing AxisFault. But client doesn't want to have exception as return
value even though any exception occurs.
Client is expecting to recieve a normal SOAP response with ErrorCode 
ErrorMsg parameters in the response.

How can i send response with ErrorCode  ErrorMsg when any exception raised
in Handlers?

Please help me out, this is an urgent requirement.
Thanks in advance...
-- 
Hari Krishna Vemula


Unexpected subelement issue when using Axis2 and eclipse

2008-12-15 Thread Menahem Elgavi
Hi All

I`m having a Unexpected subelement getMetaDataResponse exception when 
calling my web service. the WS was created from a POJO using the Axis2 
eclipse plugin.
im using Apache Tomcat as my web server.

i followed the code in the generated stub class , and it fails when doing:
if(reader.getAttributeValue(http://www.w3.org/2001/XMLSchema-instance,type;)!=null)
 
The condition eval`s to false , and the code just looks on for the return , 
while the reader is still on getMetaDataResponse .

below is some data i think might help.

Can anyone help ? 
Thanks in advance

Mena


this is the request i captured:
(i dont mind the service returning null)

?xml version='1.0' encoding='UTF-8'?
soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
soapenv:Body
ns3:getMetaData 
xmlns:ns3=http://ws.collector.pn.xor.com/xsd;ns3:strIPAddresses 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:nil=1 //ns3:getMetaData/soapenv:Body/soapenv:Envelope

This is the response from the web server:

?xml version='1.0' encoding='UTF-8'?soapenv:Envelope 
xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;
soapenv:Bodyns:getMetaDataResponse 
xmlns:ns=http://ws.collector.pn.xor.com/xsd; 
//soapenv:Body/soapenv:Envelope

my WSDL looks like this (also created using Axis2, using the eclipse plugin 
wizard.) 

- wsdl:definitions xmlns:axis2=http://ws.collector.pn.xor.com; 
xmlns:mime=http://schemas.xmlsoap.org/wsdl/mime/; 
xmlns:http=http://schemas.xmlsoap.org/wsdl/http/; 
xmlns:ns0=http://configuration.collector.pn.xor.com/xsd; 
xmlns:soap12=http://schemas.xmlsoap.org/wsdl/soap12/; 
xmlns:ns1=http://ws.collector.pn.xor.com/xsd; 
xmlns:ns2=http://elements.collector.pn.xor.com/xsd; 
xmlns:xs=http://www.w3.org/2001/XMLSchema; 
xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; 
xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; 
targetNamespace=http://ws.collector.pn.xor.com;
  wsdl:documentationPlease Type your service description 
here/wsdl:documentation 
- wsdl:types
- xs:schema xmlns:ns=http://ws.collector.pn.xor.com/xsd; 
attributeFormDefault=qualified elementFormDefault=qualified 
targetNamespace=http://ws.collector.pn.xor.com/xsd;
- xs:element name=getMetaData
- xs:complexType
- xs:sequence
  xs:element maxOccurs=unbounded name=strIPAddresses nillable=true 
type=xs:string / 
  /xs:sequence
  /xs:complexType
  /xs:element
- xs:element name=getMetaDataResponse
- xs:complexType
- xs:sequence
  xs:element maxOccurs=unbounded name=return nillable=true 
type=ns2:AgentMetaData / 
  /xs:sequence
  /xs:complexType
  /xs:element
  /xs:schema
  xs:element name=AgentMetaData type=ax24:AgentMetaData / 
- xs:complexType name=AgentMetaData
- xs:sequence
  xs:element name=iPAddress nillable=true type=xs:string / 
  xs:element maxOccurs=unbounded name=objData nillable=true 
type=xs:string / 
  /xs:sequence
  /xs:complexType
  /xs:schema
  /wsdl:types
- wsdl:message name=getMetaDataMessage
  wsdl:part name=part1 element=ns1:getMetaData / 
  /wsdl:message
- wsdl:message name=getMetaDataResponse
  wsdl:part name=part1 element=ns1:getMetaDataResponse / 
  /wsdl:message
- wsdl:portType name=CollectorWSPortType
- wsdl:operation name=getMetaData
  wsdl:input xmlns:wsaw=http://www.w3.org/2006/05/addressing/wsdl; 
message=axis2:getMetaDataMessage wsaw:Action=urn:getMetaData / 
  wsdl:output message=axis2:getMetaDataResponse / 
  /wsdl:operation
  /wsdl:portType
- wsdl:binding name=CollectorWSSOAP11Binding 
type=axis2:CollectorWSPortType
  soap:binding transport=http://schemas.xmlsoap.org/soap/http; 
style=document / 
- wsdl:operation name=getMetaData
  soap:operation soapAction=urn:getMetaData style=document / 
- wsdl:input
  soap:body use=literal / 
  /wsdl:input
- wsdl:output
  soap:body use=literal / 
  /wsdl:output
  /wsdl:operation
  /wsdl:binding
- wsdl:binding name=CollectorWSSOAP12Binding 
type=axis2:CollectorWSPortType
  soap12:binding transport=http://schemas.xmlsoap.org/soap/http; 
style=document / 
- wsdl:operation name=getMetaData
  soap12:operation soapAction=urn:getMetaData style=document / 
- wsdl:input
  soap12:body use=literal / 
  /wsdl:input
- wsdl:output
  soap12:body use=literal / 
  /wsdl:output
  /wsdl:operation
  /wsdl:binding
- wsdl:binding name=CollectorWSHttpBinding 
type=axis2:CollectorWSPortType
  http:binding verb=POST / 
- wsdl:operation name=getMetaData
  http:operation location=getMetaData / 
- wsdl:input
  mime:content type=text/xml / 
  /wsdl:input
- wsdl:output
  mime:content type=text/xml / 
  /wsdl:output
  /wsdl:operation
  /wsdl:binding
- wsdl:service name=CollectorWS
- wsdl:port name=CollectorWSSOAP11port_http 
binding=axis2:CollectorWSSOAP11Binding
  soap:address 
location=http://127.0.0.1:8080/HPOMCollector/services/CollectorWS; / 
  /wsdl:port
- wsdl:port name=CollectorWSSOAP12port_http 
binding=axis2:CollectorWSSOAP12Binding
  soap12:address 
location=http://127.0.0.1:8080/HPOMCollector/services/CollectorWS; / 
  /wsdl:port
- wsdl:port name=CollectorWSHttpport 

RE: Axis2/Rampart Signature Validation

2008-12-15 Thread Hassel, Maik
The error message indicates that the server doesn't know the client's
certificate... did you add the CA that signed the client's certificate
OR the client certificate itself to the server's keystore?



-Original Message-
From: Thorsten Deelmann [mailto:th.deelm...@gmail.com] 
Sent: Sunday, December 14, 2008 4:08 PM
To: axis-user@ws.apache.org
Subject: Axis2/Rampart Signature Validation

Hi all,

I've got the following Signature of a SOAP-Header built with Rampart:
ds:Signature xmlns:ds=http://www.w3.org/2000/09/xmldsig#;
Id=Signature-30721078
ds:SignedInfo
ds:CanonicalizationMethod
Algorithm=http://www.w3.org/2001/10/xml-exc-c14n#/
ds:SignatureMethod
Algorithm=http://www.w3.org/2000/09/xmldsig#hmac-sha1/
ds:Reference URI=#Id-6935595
ds:Transforms
ds:Transform
Algorithm=http://www.w3.org/2001/10/xml-exc-c14n#/
/ds:Transforms
ds:DigestMethod
Algorithm=http://www.w3.org/2000/09/xmldsig#sha1/

ds:DigestValuezo9esKQnicy3e5eQidwJBZs1c4E=/ds:DigestValue
/ds:Reference
ds:Reference URI=#Timestamp-13983828
ds:Transforms
ds:Transform
Algorithm=http://www.w3.org/2001/10/xml-exc-c14n#/
/ds:Transforms
ds:DigestMethod
Algorithm=http://www.w3.org/2000/09/xmldsig#sha1/

ds:DigestValuejGS8NoS39F6SNr9YWjSmXmeOYAA=/ds:DigestValue
/ds:Reference
/ds:SignedInfo

ds:SignatureValuetRIOHs2UgyJLwTj2hRh4QOeoc1I=/ds:SignatureValue
ds:KeyInfo Id=KeyId-27120092
wsse:SecurityTokenReference
xmlns:wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse
curity-secext-1.0.xsd
xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssec
urity-utility-1.0.xsd
wsu:Id=STRId-3996874
wsse:Reference
URI=#EncKeyId-urn:uuid:EC1EA7F6B5126BB58312292966622658
ValueType=http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1
.0#EncryptedKey/
/wsse:SecurityTokenReference
/ds:KeyInfo
/ds:Signature

But when when the SignatureProcessor tries to verify it, I get the
following stack trace:
org.apache.axis2.AxisFault: The signature or decryption was invalid
at
org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault
(RampartReceiver.java:166)
at
org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:9
5)
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.transport.http.HTTPTransportUtils.processHTTPPostReques
t(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:174)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
74)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:87
4)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:81)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:689)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.ws.security.WSSecurityException: The signature
or decryption was invalid
at
org.apache.ws.security.processor.SignatureProcessor.verifyXMLSignature(S
ignatureProcessor.java:419)
at
org.apache.ws.security.processor.SignatureProcessor.handleToken(Signatur
eProcessor.java:85)
at
org.apache.ws.security.WSSecurityEngine.processSecurityHeader(WSSecurity
Engine.java:311)
at
org.apache.ws.security.WSSecurityEngine.processSecurityHeader(WSSecurity
Engine.java:228)
at

RE: thread safe axis2 client stub

2008-12-15 Thread Paul French
I would have thought making the client stub thread safe would be the
superior solution.
 
If this cannot be done then I would opt for the pooling solution.
 
Out of interest is this a general problem due a specific API that axis2 has
implemented or is it an axis2 design problem?
 
Is there another web service stack out there that can create thread safe
clients?
 
Thanks

  _  

From: Martin Gainty [mailto:mgai...@hotmail.com] 
Sent: 15 December 2008 02:01
To: paul.fre...@kirona.com
Subject: RE: thread safe axis2 client stub


If you have a ThreadedPool approach for client stub you can submit the code
to axis-dev

As the majority of implementations I've seen are single desktop and or
browserclient
as the majority of clients start in public static main(String args)
and refactor the the service code to a 'thread-safe'  client 

I would start by changing the command line parameters at
org.apache.axis2.wsdl.WSDL2Code.java

the annotations are handled at
org.apache.axis2.wsdl.codegen.emitter.jaxws.AnnotationElementBuilder
static Element buildWebServiceClientAnnotationElement(String name, String
targetNS, String wsdlLocation,Document doc) 
(notice the static signature)so  I would try to change this

but the real heart of the client stub writer sits at
org.apache.axis2.wsdl.codegen.emitter
public class CEmitter extends AxisServiceBasedMultiLanguageEmitter
specifically writeFile e.g.
 /*** Writes the Stub.** @throws Exception */
protected void writeCStub() throws Exception 
   {
// first check for the policies in this service and write them
Document interfaceImplModel =
createDOMDocumentForInterfaceImplementation();

CStubHeaderWriter writerHStub =
new
CStubHeaderWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(
),
 
codeGenConfiguration.getSourceLocation()),
 
codeGenConfiguration.getOutputLanguage());

writeFile(interfaceImplModel, writerHStub);


CStubSourceWriter writerCStub =
new
CStubSourceWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(
),
 
codeGenConfiguration.getSourceLocation()),
 
codeGenConfiguration.getOutputLanguage());

writeFile(interfaceImplModel, writerCStub);
}

//and the final writer code is in AxisServiceBasedMultiLanguageEmitter
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter
/**
 * A resusable method for the implementation of interface and
implementation writing.
 * @param model
 * @param writer
 * @throws java.io.IOException
 * @throws Exception
 */
protected void writeFile(Document model, FileWriter writer) throws
IOException, Exception 
   {
writer.loadTemplate();

String packageName =
model.getDocumentElement().getAttribute(package);
String className = model.getDocumentElement().getAttribute(name);

writer.createOutFile(packageName, className);

// use the global resolver

//at this point you will want to make sure the statics are now class
are now objects plenty of logging will be helpful
writer.parse(model, resolver);
}

HTH
Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and Sender
does not endorse distribution to any party other than intended recipient.
Sender does not necessarily endorse content contained within this
transmission. 





  _  

From: paul.fre...@kirona.com
To: axis-user@ws.apache.org
Subject: RE: thread safe axis2 client stub
Date: Sun, 14 Dec 2008 21:35:05 +


Bump! Anyone?
 
If Axis2 is to be performant then can someone from the Axis2 development
team explain the best way to call a web service using Axis2 client stubs? We
have a web application where a user interaction initiates a web service
call. Are we expected to store one client stub per thread in a thread local
or create a pool of client stubs?
 
I would also like to know why a client stub is not thread safe?
 
Thanks.

  _  

From: Paul French [mailto:paul.fre...@kirona.com] 
Sent: 10 December 2008 12:37
To: 'axis-user@ws.apache.org'
Subject: RE: thread safe axis2 client stub


Can anyone comment on this? It is a major issue for us.
 
Why is the client stub created not thread safe?
 
If it cannot be made thread safe then how can you avoid the huge overhead of
instantiating a new client stub per web service call?

  _  

From: Shehan Simen [mailto:ssi...@itree.com.au] 
Sent: 10 December 2008 01:24
To: axis-user@ws.apache.org
Subject: RE: thread safe axis2 client stub



Yes, I am expecting an answer from someone who develop the axis2. It is very
inefficient to create a stub for each call.

 

Regards,

Shehan

 

From: Paul French [mailto:paul.fre...@kirona.com] 
Sent: 2008-12-10 03:29
To: axis-user@ws.apache.org; 'David Ojeda'
Subject: RE: thread safe 

get Resource inside .aar?

2008-12-15 Thread Seem

Hi,

I still have problems to access a file inside an .aar. I tried to extend the
simple quickstart example from the axis2 repository, but I won't get
access?!?!?!

The .aar folder structure is
META-INF/
samples/...
res/stock.txt


here is my code:

#
package samples.quickstart.service.pojo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;


public class StockQuoteService
{
private HashMap map = new HashMap();

public double getPrice(String symbol) {
StockQuoteService i = new StockQuoteService();
InputStream a =
i.getClass().getClassLoader().getResourceAsStream(res/stock.txt);

//  Thread thread = Thread.currentThread();
//  ClassLoader loader = thread.getContextClassLoader();
//  thread.setContextClassLoader(i.getClass().getClassLoader());
//  InputStream a =
Thread.currentThread().getContextClassLoader().getResourceAsStream(res/stock.txt);


return Double.valueOf(i.convertStreamToString(a)).doubleValue();
}
  
private String convertStreamToString(InputStream a)
{
BufferedReader reader = new BufferedReader(new InputStreamReader(a));
.}

}
#
-- 
View this message in context: 
http://www.nabble.com/get-Resource-inside-.aar--tp21019445p21019445.html
Sent from the Axis - User mailing list archive at Nabble.com.



RE: [axis2] chunked encoding

2008-12-15 Thread Marc Lefebvre
Cant seem to turn off Chunked encoding.  I have removed 
 
parameter name=Transfer-Encodingchunked/parameter
 
 
from my axis2.xml file, and I restarted my tomcat/axis2 server.   I sent a test 
message and it still comes back chunked.
 
Am I missing something?
__
Marc Lefebvre, Principle Software Engineer
Akimeka, 1305 N. Holopono Street, Kihei, HI 96753 
Phone: (808)442-7168, Email: mlefeb...@akimeka.com
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq' | dc



From: Sameera Jayasoma [mailto:sameera.madus...@gmail.com]
Sent: Sun 12/14/2008 5:59 PM
To: axis-user@ws.apache.org
Subject: Re: [axis2] chunked encoding


hi Marc

Following link may help you. 

http://wso2.org/library/209

Sameera

On Sat, Dec 13, 2008 at 7:55 AM, Marc Lefebvre mlefeb...@akimeka.com wrote:


How do I disable chunked encoding in Axis?  I am running on HTTP1.1 and 
have an XML appliance that is not handling responses from Axis properly that 
are Chunked encoded.  Any pointers, links, or advice is appreciated.

__
Marc Lefebvre, Principle Software Engineer
Akimeka, 1305 N. Holopono Street, Kihei, HI 96753
Phone: (808)442-7168, Email: mlefeb...@akimeka.com
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq' | dc





-- 
Sameera
http://sameera-jayasoma.blogspot.com/
http://www.flickr.com/photos/sameera-jayasoma



Re: get Resource inside .aar?

2008-12-15 Thread Deepal jayasinghe
Seem wrote:
 Hi,

 I still have problems to access a file inside an .aar. I tried to extend the
 simple quickstart example from the axis2 repository, but I won't get
   
Try this

MessageContext.getCurrentMessageContext().getAxisService().getClassLoader().getResourceAsSteam();

Thank you!
Deepal
 access?!?!?!

 The .aar folder structure is
 META-INF/
 samples/...
 res/stock.txt


 here is my code:

 #
 package samples.quickstart.service.pojo;

 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.HashMap;


 public class StockQuoteService
 {
 private HashMap map = new HashMap();

 public double getPrice(String symbol) {
   StockQuoteService i = new StockQuoteService();
   InputStream a =
 i.getClass().getClassLoader().getResourceAsStream(res/stock.txt);
   
 //Thread thread = Thread.currentThread();
 //ClassLoader loader = thread.getContextClassLoader();
 //thread.setContextClassLoader(i.getClass().getClassLoader());
 //InputStream a =
 Thread.currentThread().getContextClassLoader().getResourceAsStream(res/stock.txt);
   

   return Double.valueOf(i.convertStreamToString(a)).doubleValue();
 }
   
 private String convertStreamToString(InputStream a)
   {
   BufferedReader reader = new BufferedReader(new InputStreamReader(a));
 .}

 }
 #
   


-- 
Thank you!


http://blogs.deepal.org



Re: Axis 1.3 - Problem with Handler

2008-12-15 Thread Guo Tianchong
Hi,

you can do something in the Handler's invoke() method
and encapsulate a new SOAP body in the MessageContext object.

Using AXIOM, that looks like :


public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {

SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
OMNamespace soapNamespace = 
fac.createOMNamespace(Constants.URI_SOAP11_ENV, soap);

// make envelope element
SOAPEnvelope newEnvelope = fac.createSOAPEnvelope(soapNamespace);

// make header element
SOAPHeader header = fac.createSOAPHeader(newEnvelope);
// add your header blocks here
..

// make body element
SOAPBody body = fac.createSOAPBody(newEnvelope);
// add your body response here
   // body.addChild(.)

   msgContext.setEnvelope(newEnvelope);

return InvocationResponse.CONTINUE;

}



Please have a try.

guo

  - Original Message - 
  From: Harikrishna Vemula
  To: axis-user@ws.apache.org
  Sent: Monday, December 15, 2008 10:36 PM
  Subject: Axis 1.3 - Problem with Handler


  Hi,
 I have a Webservice for that i implemented a Handler to validate input 
request with XSD. Whenever any exception occurs in 
invoke method i'm throwing AxisFault. But client doesn't want to have exception 
as return value even though any exception occurs.
  Client is expecting to recieve a normal SOAP response with ErrorCode  
ErrorMsg parameters in the response.

  How can i send response with ErrorCode  ErrorMsg when any exception raised 
in Handlers?

  Please help me out, this is an urgent requirement.

  Thanks in advance...
  -- 
  Hari Krishna Vemula


do I need to recreate axis2 client stub?

2008-12-15 Thread Shehan Simen
Hi,
I have deployed an axis2 web service which is already using by the clients.
I have to update this service to pass another input parameter to one of web 
service method, let's say getName() method.
If I add a new parameter to the request as an optional field (minOccurs=0), 
will it affect the old users of the web service? Do the old users have to 
regenerate the client stub (even if they do not want to pass the new parameter) 
?
If the old users still can use the same old client stub, it would make my life 
so easier that I don't want create a new web service method ( I can just modify 
the old method so both the new and old users can use it).







Re: Axis 1.3 - Problem with Handler

2008-12-15 Thread Harikrishna Vemula
Hi guo,
 Thanks,
But in Axis 1.3 we don't have InvocationResponse object itself. In 1.3
invoke method return type is void. So, as per my knowledge only way to stop
the process and send back the response by throwing Fault.
But is there any other way by which we can catch Fault and process the fault
message and send back normal response to client?

JAX-RPC is having methods with return type true for handleRequest method,
how to use JAXRPC handlers in axis? Any idea?

Thanks in advance...

-Hari



On Tue, Dec 16, 2008 at 6:56 AM, Guo Tianchong gu...@nec-as.nec.com.cnwrote:

  Hi,

 you can do something in the Handler's invoke() method
 and encapsulate a new SOAP body in the MessageContext object.

 Using AXIOM, that looks like :


 public InvocationResponse invoke(MessageContext msgContext) throws
 AxisFault {

 SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
 OMNamespace soapNamespace =
 fac.createOMNamespace(Constants.URI_SOAP11_ENV, soap);

 // make envelope element
 SOAPEnvelope newEnvelope = fac.createSOAPEnvelope(soapNamespace);

 // make header element
 SOAPHeader header = fac.createSOAPHeader(newEnvelope);
 *// add your header blocks here*
 ..

 // make body element
 SOAPBody body = fac.createSOAPBody(newEnvelope);
 *// add your body response here*
*// body.addChild(.)*

msgContext.setEnvelope(newEnvelope);

 return InvocationResponse.CONTINUE;

 }



 Please have a try.

 guo


 - Original Message -
 *From:* Harikrishna Vemula hari.k.vem...@gmail.com
 *To:* axis-user@ws.apache.org
 *Sent:* Monday, December 15, 2008 10:36 PM
 *Subject:* Axis 1.3 - Problem with Handler

 Hi,
I have a Webservice for that i implemented a Handler to validate
 input request with XSD. Whenever any exception occurs in invoke method i'm
 throwing AxisFault. But client doesn't want to have exception as return
 value even though any exception occurs.
 Client is expecting to recieve a normal SOAP response with ErrorCode 
 ErrorMsg parameters in the response.

 How can i send response with ErrorCode  ErrorMsg when any exception raised
 in Handlers?

 Please help me out, this is an urgent requirement.
 Thanks in advance...
 --
 Hari Krishna Vemula




-- 
Hari Krishna Vemula


Re: Axis 1.3 - Problem with Handler

2008-12-15 Thread Guo Tianchong
hi, Hari

I am working with Axis2 1.4.1 and don't know well about Axis 1.3.
Sorry!

but I also remain concerned about this issue.

guo.
  - Original Message - 
  From: Harikrishna Vemula
  To: axis-user@ws.apache.org
  Sent: Tuesday, December 16, 2008 2:05 PM
  Subject: Re: Axis 1.3 - Problem with Handler


  Hi guo,
   Thanks,
  But in Axis 1.3 we don't have InvocationResponse object itself. In 1.3 invoke 
method return type is void. So, as per my knowledge 
only way to stop the process and send back the response by throwing Fault.
  But is there any other way by which we can catch Fault and process the fault 
message and send back normal response to client?

  JAX-RPC is having methods with return type true for handleRequest method, how 
to use JAXRPC handlers in axis? Any idea?

  Thanks in advance...

  -Hari



  On Tue, Dec 16, 2008 at 6:56 AM, Guo Tianchong gu...@nec-as.nec.com.cn 
wrote:

Hi,

you can do something in the Handler's invoke() method
and encapsulate a new SOAP body in the MessageContext object.

Using AXIOM, that looks like :


public InvocationResponse invoke(MessageContext msgContext) throws 
AxisFault {

SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
OMNamespace soapNamespace = 
fac.createOMNamespace(Constants.URI_SOAP11_ENV, soap);

// make envelope element
SOAPEnvelope newEnvelope = fac.createSOAPEnvelope(soapNamespace);

// make header element
SOAPHeader header = fac.createSOAPHeader(newEnvelope);
// add your header blocks here
..

// make body element
SOAPBody body = fac.createSOAPBody(newEnvelope);
// add your body response here
   // body.addChild(.)

   msgContext.setEnvelope(newEnvelope);

return InvocationResponse.CONTINUE;

}



Please have a try.

guo

  - Original Message - 
  From: Harikrishna Vemula
  To: axis-user@ws.apache.org
  Sent: Monday, December 15, 2008 10:36 PM
  Subject: Axis 1.3 - Problem with Handler


  Hi,
 I have a Webservice for that i implemented a Handler to validate input 
request with XSD. Whenever any exception occurs in 
invoke method i'm throwing AxisFault. But client doesn't want to have exception 
as return value even though any exception occurs.
  Client is expecting to recieve a normal SOAP response with ErrorCode  
ErrorMsg parameters in the response.

  How can i send response with ErrorCode  ErrorMsg when any exception 
raised in Handlers?

  Please help me out, this is an urgent requirement.

  Thanks in advance...
  -- 
  Hari Krishna Vemula




  -- 
  Hari Krishna Vemula


Re: Axis 1.3 - Problem with Handler

2008-12-15 Thread Harikrishna Vemula
Thanks guo...

can anybody help me out?

-Hari


On Tue, Dec 16, 2008 at 11:47 AM, Guo Tianchong gu...@nec-as.nec.com.cnwrote:

  hi, Hari

 I am working with Axis2 1.4.1 and don't know well about Axis 1.3.
 Sorry!

 but I also remain concerned about this issue.

 guo.

  - Original Message -
 *From:* Harikrishna Vemula hari.k.vem...@gmail.com
 *To:* axis-user@ws.apache.org
   *Sent:* Tuesday, December 16, 2008 2:05 PM
 *Subject:* Re: Axis 1.3 - Problem with Handler

 Hi guo,
  Thanks,
 But in Axis 1.3 we don't have InvocationResponse object itself. In 1.3
 invoke method return type is void. So, as per my knowledge only way to stop
 the process and send back the response by throwing Fault.
 But is there any other way by which we can catch Fault and process the
 fault message and send back normal response to client?

 JAX-RPC is having methods with return type true for handleRequest method,
 how to use JAXRPC handlers in axis? Any idea?

 Thanks in advance...

 -Hari



 On Tue, Dec 16, 2008 at 6:56 AM, Guo Tianchong gu...@nec-as.nec.com.cnwrote:

  Hi,

 you can do something in the Handler's invoke() method
 and encapsulate a new SOAP body in the MessageContext object.

 Using AXIOM, that looks like :


 public InvocationResponse invoke(MessageContext msgContext) throws
 AxisFault {

 SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
 OMNamespace soapNamespace =
 fac.createOMNamespace(Constants.URI_SOAP11_ENV, soap);

 // make envelope element
 SOAPEnvelope newEnvelope = fac.createSOAPEnvelope(soapNamespace);

 // make header element
 SOAPHeader header = fac.createSOAPHeader(newEnvelope);
 *// add your header blocks here*
 ..

 // make body element
 SOAPBody body = fac.createSOAPBody(newEnvelope);
 *// add your body response here*
*// body.addChild(.)*

msgContext.setEnvelope(newEnvelope);

 return InvocationResponse.CONTINUE;

 }



 Please have a try.

 guo


 - Original Message -
 *From:* Harikrishna Vemula hari.k.vem...@gmail.com
 *To:* axis-user@ws.apache.org
 *Sent:* Monday, December 15, 2008 10:36 PM
 *Subject:* Axis 1.3 - Problem with Handler

 Hi,
I have a Webservice for that i implemented a Handler to validate
 input request with XSD. Whenever any exception occurs in invoke method i'm
 throwing AxisFault. But client doesn't want to have exception as return
 value even though any exception occurs.
 Client is expecting to recieve a normal SOAP response with ErrorCode 
 ErrorMsg parameters in the response.

 How can i send response with ErrorCode  ErrorMsg when any exception
 raised in Handlers?

 Please help me out, this is an urgent requirement.
 Thanks in advance...
 --
 Hari Krishna Vemula




 --
 Hari Krishna Vemula




-- 
Hari Krishna Vemula


AW: get Resource inside .aar?

2008-12-15 Thread Mario-Leander Reimer
Hi,

I think you need to use getResourceAsStream(/res/stock.txt); (mind the / at 
the beginning)
Have you tried that?

BR,
Leander

 -Ursprüngliche Nachricht-
 Von: Seem [mailto:sim...@gmx.de]
 Gesendet: Montag, 15. Dezember 2008 19:56
 An: axis-user@ws.apache.org
 Betreff: get Resource inside .aar?


 Hi,

 I still have problems to access a file inside an .aar. I tried to
 extend the
 simple quickstart example from the axis2 repository, but I won't get
 access?!?!?!

 The .aar folder structure is
 META-INF/
 samples/...
 res/stock.txt


 here is my code:

 #
 package samples.quickstart.service.pojo;

 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.HashMap;


 public class StockQuoteService
 {
 private HashMap map = new HashMap();

 public double getPrice(String symbol) {
 StockQuoteService i = new StockQuoteService();
 InputStream a =
 i.getClass().getClassLoader().getResourceAsStream(res/stock.txt);

 //  Thread thread = Thread.currentThread();
 //  ClassLoader loader = thread.getContextClassLoader();
 //  thread.setContextClassLoader(i.getClass().getClassLoader());
 //  InputStream a =
 Thread.currentThread().getContextClassLoader().getResourceAsStream(res
 /stock.txt);


 return
 Double.valueOf(i.convertStreamToString(a)).doubleValue();
 }

 private String convertStreamToString(InputStream a)
 {
 BufferedReader reader = new BufferedReader(new
 InputStreamReader(a));
 .}

 }
 #
 --
 View this message in context: http://www.nabble.com/get-Resource-
 inside-.aar--tp21019445p21019445.html
 Sent from the Axis - User mailing list archive at Nabble.com.


VVA Networks GmbH

Mario-Leander Reimer
Dipl.-Inf. (FH)
Teamleitung Publishing Solutions
---
VVA Networks GmbH
: medien mit zukunft
Geisenhausenerstraße 15-17
81379 München
Deutschland
---
Fon:+49 89 2000375-610
Fax:+49 89 2000375-699
Mobil:  +49 173 5883541
---
leander.rei...@vva-networks.de
www.vva-networks.de

---
HRB 33884 Düsseldorf
Geschäftsführer Rolf Christian Kassel
---
Ein Unternehmen der VVA Kommunikation
http://www.vva.de
---
omnisuite® - integrate. automate. communicate.
http://www.omnisuite.de
---

Diese Nachricht (inklusive aller Anhänge) ist vertraulich. Sie darf
ausschließlich durch den vorgesehenen Empfänger und Adressaten gelesen,
kopiert oder genutzt werden. Sollten Sie diese Nachricht versehentlich
erhalten haben, bitten wir, den Absender (durch Antwort-E-Mail) hiervon
unverzüglich zu informieren und die Nachricht zu löschen. Jede unerlaubte
Nutzung oder Weitergabe des Inhalts dieser Nachricht, sei es vollständig
oder teilweise, ist unzulässig.

This message (including any attachments) is confidential and may be
privileged. It may be read, copied and used only by the intended recipient.
If you have received it in error please contact the sender (by return
E-Mail) immediately and delete this message. Any unauthorised use or
dissemination of this message in whole or in part is strictly prohibited.


[Axis2] SOAP-Faults

2008-12-15 Thread Gaiser, Matthias
Hi,

 

I am using Axis2 and I have invested some time to understand the
generation of SOAP faults with Axis2.

 

IMHO, the SOAP specification allows multiple elements in the 
env:Detail -section of a SOAPFault, e.g.:

env:Fault

   env:Code

 env:Valueenv:Sender/env:Value

 env:Subcode

  env:Valuem:MessageTimeout/env:Value

 /env:Subcode

   /env:Code

   env:Reason

 env:Text xml:lang=enSender Timeout/env:Text

   /env:Reason

   env:Detail

 m:detail1first/m:detail1

 m:detail2second/m:detail2

 m:detail3third/m:detail3

   /env:Detail

/env:Fault

 

But in Axis2, I do not see a possibility how to set more than one
element inside the detail-element. The apidocs always talk about a
single OMElement, which is the first Element below the env:Detail. Can
anybody help me here?

 

Thank You,

Matthias.