Re: RPC encoded wsdl example in axis2

2008-08-21 Thread Detelin Yordanov
Hi Shovan,
  I think that Axis2 does not support rpc-encoded. It supports rpc-literal
WSDLs, but converts them to doc-lit wrapped on deploy.
However, we have found out that it is possible to deploy a service with
rpc-encoded WSDL on Axis2 1.4.
But you will need to write your own message receiver to do the
serialization/deserialization of SOAP-enc types.
You can create an aar containing the service and the rpc-encoded WSDL, and
instruct Axis2 to return your WSDL when clients ask for it (using the
useOriginalwsdl parameter in the services.xml).

However, the tricky part is writing the message receiver which should be
able to handle SOAP-encoding types and convert them to Java types (and vice
versa).

Regards,
Detelin

On Thu, Aug 21, 2008 at 5:49 PM, Shovan Kanjilal
[EMAIL PROTECTED]wrote:

 Can anybody point me to an example of rpc encoded sample wsdl and how stub
 is generated
 from that and an example client written?

 I see all the examples are document type?

 Does axis2 not support rpc-encoded?



Re: Unexpected subelement error

2008-08-15 Thread Detelin Yordanov
Hi,
Are you using Axis2 1.4 ?
I tried your wsdl on Axis2 1.4 using following command:
wsdl2java -t -o server/title_edition/ -uri wsdl/Webs_TitelEdition.wsdl -p
nl.kabisa.sanoma.webservices.server -d adb

And the generated code contains two repeating classes:
1. There is Edition_type0 and Edition_type1
2. There is Editions and Editions_type0

The Editions_type0 class by me contains an addEdition(Edition_type*1*),
rather than addEdition(Edition_type*0*)
And I just used Edition_type1 instance and got the following request which
seems OK:

soapenv:Body
 ns3:TitelEdition_new xmlns:ns3=
http://schemas.sanoma-uitgevers.nl/advportal/Webs_TitelEdition;
Editions xmlns=
http://schemas.sanoma-uitgevers.nl/advportal/Webs_TitelEdition/TitelEdition_new;
createDate=2008-08-15+02:00 records=1
   Edition
  titleId2/titleId
  titleNameTest title/titleName
  editionId1/editionId
  editionDescriptionTest/editionDescription
  publicationDate2008-08-15+02:00/publicationDate
  latestMatDelivDate2008-08-15+02:00/latestMatDelivDate
   /Edition
/Editions
 /ns3:TitelEdition_new
  /soapenv:Body

But I wonder why there 2 similiar classes generated and not just one of
them, can somebody explain this?

On Fri, Aug 15, 2008 at 5:04 PM, Harm de Laat [EMAIL PROTECTED] wrote:

 Hi all,

 I'm trying to generate a SOAP service server from an existing WSDL file.

 I have generated all necessary class using the following command:

 wsdl2java.sh -t -o server/title_edition/ -uri wsdl/Webs_TitelEdition.wsdl
 -p nl.kabisa.sanoma.webservices.server -d adb -s -wv 1.2 -ss -sd -ssi

 I have also created a simple client. Unfortunately when I run the client I
 get the following exception:

 Exception in thread main org.apache.axis2.AxisFault:
 org.apache.axis2.databinding.ADBException: Unexpected subelement Edition
 at
 org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
 at
 org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
 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
 nl.kabisa.sanoma.webservices.Webs_TitelEditionStub.TitelEdition_new(Webs_TitelEditionStub.java:186)
 at
 nl.kabisa.sanoma.webservices.TitleEditionTestClient.main(TitleEditionTestClient.java:48)
 Java Result: 1

 I don't know why, because it seems my message is correct according to the
 XML schema provided.
 I have been trying to resolve this now for the past two days, but
 unfortunately I'm still stuck.

 Can somebody please tell me what it is I'm doing wrong here?


 Here is my code including the WSDL:

  client: -
 package nl.kabisa.sanoma.webservices;

 import java.math.BigInteger;
 import java.util.Date;

 /**
  *
  * @author harm
  */
 public class TitleEditionTestClient {


 public static void main(String[] args) throws Exception {

 Webs_TitelEditionStub stub =
 new Webs_TitelEditionStub(
 http://localhost:9090/axis2/services/Webs_TitelEdition;);

 Webs_TitelEditionStub.TitelEdition_new titleEdition =
 new Webs_TitelEditionStub.TitelEdition_new();


 Webs_TitelEditionStub.Editions_type0 editions =
 new Webs_TitelEditionStub.Editions_type0();

 Webs_TitelEditionStub.Edition_type0 edition =
 new Webs_TitelEditionStub.Edition_type0();


 edition.setTitleId(2);
 edition.setTitleName(Test title);
 edition.setEditionId(1);
 edition.setEditionDescription(Test);
 edition.setPublicationDate(new Date());
 edition.setLatestMatDelivDate(new Date());

 editions.addEdition(edition);

 editions.setCreateDate(new Date());
 editions.setRecords(BigInteger.ONE);

 titleEdition.setEditions(editions);

 stub.TitelEdition_new(titleEdition);

 }
 }
 ---

 Using TCPMon I see the following message being sent to the server:

 -- soap message -
 POST /axis2/services/Webs_TitelEdition HTTP/1.1
 Content-Type: application/soap+xml; charset=UTF-8; action=
 http://schemas.sanoma-uitgevers.nl/advportal/Webs_TitelEdition/TitelEdition_new
 
 User-Agent: Axis2
 Host: localhost:9090
 Transfer-Encoding: chunked

 209
 ?xml version='1.0' encoding='UTF-8'?
 soapenv:Envelope xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope;
 soapenv:Body
 ns3:TitelEdition_new xmlns:ns3=
 http://schemas.sanoma-uitgevers.nl/advportal/Webs_TitelEdition;
 Editions xmlns=
 http://schemas.sanoma-uitgevers.nl/advportal/Webs_TitelEdition/TitelEdition_new;
 

Re: How to add a SOAP header in an axis2 custom client-side handler?

2008-08-14 Thread Detelin Yordanov
Hi,
 Should be as simple as:

import org.apache.axiom.soap.*;

SOAPHeader header = context.getEnvelope().getHeader(); //context is Axis2
MessageContext
SOAPHeaderBlock headerBlock = header.addHeaderBlock(HEADER_NAME, HEADER_NS);

Now you can add whatever you want to the headerBlock, it is just an ordinary
Axiom OMElement, e.g.
headerBlock.setText(my value);

See javadocs:
http://ws.apache.org/commons/axiom/apidocs/org/apache/axiom/soap/SOAPHeaderBlock.html

Regards,
Detelin

On Thu, Aug 14, 2008 at 3:48 PM, Franklin, Allen [EMAIL PROTECTED]
 wrote:

  I don't have a services.xml, and I don't have the manageTransportSession 
 parameter
 in my axis2.xml.

 But I am just running an axis2 client and my client seems to run ok without
 them.



 I am stuck trying to figure out how to manipulate the SOAP header in my
 client-side handler.

 The semantics for manipulating the SOAP header has changed between axis1
 and axis2.

 I am having trouble finding documentation and sample code that manipulates
 the

 SOAP header obtained from a MessageContext.



 *From:* Martin Gainty [mailto:[EMAIL PROTECTED]
 *Sent:* Wednesday, August 13, 2008 8:43 PM
 *To:* axis-user@ws.apache.org
 *Subject:* RE: How to add a SOAP header in an axis2 custom client-side
 handler?



 didn't see your config params
 axis2.xml
 parameter name=manageTransportSession?/parameter

 services.xml
   service name=MultiplyService scope=?

 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.

  --

 Subject: How to add a SOAP header in an axis2 custom client-side handler?
 Date: Wed, 13 Aug 2008 18:26:36 -0400
 From: [EMAIL PROTECTED]
 To: axis-user@ws.apache.org

 I am trying to figure out how to add a SOAP header in my client-side
 handler.

 I have the following axis1 code, but need an axis2 equivalent:



/***

 * Processes the header of a request message.  This method will add the

 * session header to the outgoing request.

 *

 * @param context the message context associated with the request

 **/

private void invokeRequest( MessageContext context ) throws AxisFault

{

   Message msg = context.getRequestMessage();

   if (msg == null)

  throw new AxisFault( Message not in context. );



   SOAPEnvelope env = msg.getSOAPEnvelope();



   SessionHeaderType sessionHeader =
 WebServiceClientHelper.getThreadSessionHeader( );



   SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS,

HEADER_NAME,

sessionHeader);

   env.addHeader(header);

}



 The SessionHeaderType class was generated from a wsdl and contains session
 credentials.



 Any pointers to appropriate documentation on how to manipulate headers, or
 sample code, would be appreciated.


  --

 Your PC, mobile phone, and online services work together like never before.
 See how Windows(R) fits your 
 lifehttp://clk.atdmt.com/MRT/go/108587394/direct/01/



Re: Axis2 array wrappers

2008-08-13 Thread Detelin Yordanov
Hi,
  Afaik .Net web services do this array wrapping, unfortunately Axis2 does
not work that way.
However, if changing the code is not a problem you can try creating a custom
class ArrayOfPhones that contains a Phone[] field and use that instead.

Regards,
   Detelin

On Tue, Aug 12, 2008 at 10:16 PM, Dan Leahu [EMAIL PROTECTED] wrote:

 Hi,

   I've an axis2 web service that has the following structure:

  1. name
  2. surname
  3. Phone[] phone

   The problem here is that when I want to see a response from this service
 it always gives me something like this:

 ns:sayHelloWorldFromResponse
 ns:return type=example.Person
 ns:arr type=example.Phone
 ns:id100/ns:id
 ns:nr0421/ns:nr
 /ns:arr
 ns:arr type=example.Phone
 ns:id200/ns:id
 ns:nr1234/ns:nr
 /ns:arr
 ns:namexaas/ns:name
 ns:surnamexa1/ns:surname
 /ns:return
 /ns:sayHelloWorldFromResponse


 The problem with this is when I want to use this service from a VBA client.
 The code on the VBA side is generated correctly but when I run it it always
 takes only the first element in the array of Phone. I've tried with another
 web service(
 http://euro2008.dataaccess.eu/footballpoolwebservice.wso/AllGames) and
 this one works correctly since the response is like this:

 ArrayOftGamesInfo
   tGamesInfo
   iId1/iId
   sDescriptionRound 1/sDescription
   dPlayDate2008-06-07/dPlayDate
   tPlayTime18:00:00/tPlayTime
   Cards
 card

 /card
   /Cards
   tGamesInfo
   tGamesInfo
   iId1/iId
   sDescriptionRound 1/sDescription
   dPlayDate2008-06-07/dPlayDate
   tPlayTime18:00:00/tPlayTime
   tGamesInfo
 /ArrayOftGamesInfo

 The idea is that somehow the guys that written the euro2008 web services,
 managed to return the arrays having a parent element, e.g. ArrayOfGamesInfo,
 Cards.

 Any idea how could I make Axis2 return arrays in this way - having a parent
 element that wraps them?

 Thanks a lot,

   Dan.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Client handler tutorial

2008-08-13 Thread Detelin Yordanov
Hi,
   When using Axis2 client (e.g. ServiceClient) you do not need any servlet
container, it just uses Apache HttpClient to
send and receive the request (if using HTTP). Underneath the ServiceClient
will setup normal Axis2 runtime (as the one on server side) to process
messages.
The ServiceClient has constructors to specify an Axis2 ConfigurationContext
which points to the client-side Axis2 configuration file,
if no ConfigurationContext is given it will use (I think) a default
axis2.xml from the Axis2 kernel jar.

So if you need to define any handlers or whatsoever, you can create  your
axis2-conf for the client side, add your handlers, then create a
ConfigurationContext and finally a ServiceClient.

Regards,
Detelin

On Wed, Aug 13, 2008 at 4:19 PM, Franklin, Allen [EMAIL PROTECTED]
 wrote:

  Where I work we start with a hand-built wsdl and then run WSDL2Java to
 generate the client and server stubs and skeleton code.

 When I say 'client side handler' I am talking about a class that that
 implements AbstractHandler that (I think) I need to write

 to add a username, password and session id to the SOAP header.



 I'm still having trouble understanding if I need to deploy a servlet
 container (eg Tomcat) just to run an axis2 client?



 *From:* Martin Gainty [mailto:[EMAIL PROTECTED]
 *Sent:* Wednesday, August 13, 2008 9:00 AM

 *To:* axis-user@ws.apache.org
 *Subject:* RE: Client handler tutorial



 typical scenario is
 with the typical HTTP transport scenario you would build the server classes
 and deploy using the admin tool
 then use compiled WSDL2Java generated client stub to test

 I guess I would need to know which 'client side handler' you are referring
 to for specifics..
 JMS/SMTP/Other
 ?
 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.

  --

 Subject: RE: Client handler tutorial
 Date: Wed, 13 Aug 2008 08:53:17 -0400
 From: [EMAIL PROTECTED]
 To: axis-user@ws.apache.org

 Do I need to deploy my axis2 client into a servlet container to be able to
 use client-side handlers?

 Currently my client does not need a servlet container, it runs stand-alone.



 *From:* Martin Gainty [mailto:[EMAIL PROTECTED]
 *Sent:* Tuesday, August 12, 2008 6:46 PM
 *To:* axis-user@ws.apache.org
 *Subject:* RE: Client handler tutorial



 yuo can deploy the client mar from the admin utility try
 http://localhost:8080/axis2/axis2-admin/

 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.
  --

 Subject: Re: Client handler tutorial
 Date: Tue, 12 Aug 2008 18:34:04 -0400
 From: [EMAIL PROTECTED]
 To: axis-user@ws.apache.org

 I am having trouble figuring out how to add client-side handlers in axis2.

 I see the email reply, below, that there is no difference between client
 and server side.

 But the configuration must be different since on the client side there is
 no web container to put the axis2.xml configuration information for the
 handler and also no place to put the service_name.mar file.

 Client-side handler configuration remains a mystery to me.

 *Re: Client handler tutorial*

 Deepal Jayasinghe
 Wed, 16 Apr 2008 22:57:25 -0700

 Hi Chau,

 Are you referring to Axis2 ?

 if so there is no difference between client side and server side.



 Thank you!

 Deepal

 Anybody knows the link to client handler tutorial? Thanks



 




  --

 Reveal your inner athlete and share it with friends on Windows Live. Share
 now!http://revealyourinnerathlete.windowslive.com?locale=en-usocid=TXT_TAGLM_WLYIA_whichathlete_us


  --

 Your PC, mobile phone, and online services work together like never before.
 See how Windows(R) fits your 
 lifehttp://clk.atdmt.com/MRT/go/108587394/direct/01/



Re: spring Axis2 integration question

2008-08-13 Thread Detelin Yordanov
Hi,
   I'm also currently reading this tutorial and could shed some light on it,
at least my understanding so far.
The basic idea as it seems to me is to be able to access Spring beans
(defined within Spring's application context) from
normal Axis2 services.
The actual injection of the bean seems to be done by Axis2, e.g. if having
an Axis2 service that has a myBean field,
when its messsage receiver is invoked, Axis2 will populate that field with
the configured Spring bean by loading it from the Spring
application context.
The name of the Spring bean to inject is defined using the SpringBeanName
Axis2 parameter in Axis2 services.xml file.
The class that is responsible for looking up this Spring bean needs to be
able to access the Spring configuration context in some way.

If the Spring and Axis2 are running on a servlet container, this can be done
using the servlet context that is also kept in the Axis2
runtime. The following is a standart Spring code to retrieve the Spring
application context from a ServletContext:

ApplicationContext aCtx =
WebApplicationContextUtils.getWebApplicationContext(servletContext);

So if you know that both Spring and Axis2 reside on the same servlet
container, you should specify the following in the services.xml:

parameter 
name=ServiceObjectSupplierorg.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier/parameter


That way you tell Axis2 try to obtain the Spring application context from
the ServletContext, I know it is there.

If you run Spring and Axis2 standalone without a servlet container, then
Axis2 cannot use this approach, so you need to define a bean
in Spring that will take hold of the Spring's application context:

bean id=applicationContext

class=org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder
/

 This bean just has a static field for the Application context. Spring will
populate the static field and later Axis2 will just be able to call the
static getContext() method to retrieve context and from there the desired
bean to inject.

In this case you need to define the following in the Axis2 services.xml:

parameter 
name=ServiceObjectSupplierorg.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier/parameter

This will tell Axis: ApplicationContextHolder class is initialized by
Spring and contains a reference to Spring's context, get it from there

Regards,
   Detelin

On Tue, Aug 12, 2008 at 9:24 PM, robert lazarski
[EMAIL PROTECTED]wrote:

 Also, use the with a ServletContext options for use with WEB-INF/lib .

 - R

 On Tue, Aug 12, 2008 at 3:23 PM, robert lazarski
 [EMAIL PROTECTED] wrote:
  Putting all jars in WEB-INF/lib is easiest and recommended in most cases.
 
  - R
 
  On Tue, Aug 12, 2008 at 2:21 PM, scabbage [EMAIL PROTECTED] wrote:
 
  I've been struggling to understand how spring and Axis2 will work
 together. I
  have read the tutorial at http://ws.apache.org/axis2/1_4/spring.html#21.
 But
  still couldn't understand what it's talking about. As I'm new to
 webservice
  and Axis2, I hope you could kindly provide some pointers so that could
 use
  my Spring services in Axis2.
 
  So basically I have a standard hibernate+dao+Spring app packaged as a
 jar
  file. The tutorial was unclear about where I should put this jar file.
 It
  should be one of services, pojo or modules, am I right? As this is not a
  simple pojo, I assume I should put it in one of the other two folders.
 And
  then the tutorial goes ahead talking about with/without a
 ServletContext,
  which I'm a bit lost. What does it mean by with a ServletContext?
 
  Can someone please explain how I could deploy this jar in Axis2?
 
  Thanks.
  --
  View this message in context:
 http://www.nabble.com/spring-Axis2-integration-question-tp18948823p18948823.html
  Sent from the Axis - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Policy serialization not correct in AxisService2WSDL11?

2008-07-16 Thread Detelin Yordanov
Hi,
   I noticed that the generateService(..) method does not add any policy
components present at the service policy subject.
The problem seems to be that it still uses the deprecated PolicyInclude
(which is not populated), instead of the PolicySubject.

There is another missing policy serialization - in the
generateHttpBinding(..) - the method lacks a call to
addPolicyAsExtElement(..) as in the generateSoap11Binding(..)
and generateSoap12Binding(..) methods.

Is this behaviour intentional or a bug?
As a result from this, if users deploy a service with a WSDL containing
policy references only at wsdl:service and/or wsdl:binding (http), when they
request the wsdl (using ?wsdl)
the returned WSDL does not contain any policy references.


MessageContext serialization issue

2008-05-17 Thread Detelin Yordanov
Hi guys,
   I'm trying to serialize and then deserialize a MessageContext instance
from the same file it was serialized.
After deserialization the axisMessage field is null and I can see that it is
being initialized only if the
activate(OperationContext) is used, if I use activate(ConfigurationContext)
then the reconcileAxisMessage flag is set, but the AxisMessage
remains null.
I would then expect that if the getAxisMessage() is called, the message will
be initialized from the metaAxisMessage metadata.
However, I just get a warning MessageContext.activate(configurationContext)
needs to be invoked. and I have already invoked this method.

In addtion to the axisMessage, I also noticed that the execution chain does
not contain all the phases it originally contained, e.g.:

execution chain before serialization:
[RMPhase, OperationInPhase, soapmonitorPhase]
execution chain after deserialization:
[] (empty)

The same with executed phases list:

before serialization:
[soapmonitorPhase, OperationInPhase, RMPhase, Dispatch, PreDispatch,
Security, Addressing, Transport]

after deserialization:
[Dispatch, PreDispatch, Security, Addressing, Transport]

Could somebody explain this behaviour please?

Regards,
   Detelin


RPC/encoded WSDL support

2008-04-08 Thread Detelin Yordanov
Hello guys,
  Does Axis2 1.4 support rpc/encoded WSDLs?
I am able to deploy a service aar with a custom rpc/encoded WSDL but I could
not invoke it successfully, so I decided to just ask you whether
this is officially supported.
I noticed that Axis2 is converting the rpc operations to doc/literal wrapped
but I was not sure whether this is done only for rpc/literal or it covers
the rpc/encoded
as well?
I also read a long discussion about rpc/encoded support in ADB and I saw
there are already some new classes for it, is this finished or work is still
in progress?

Thanks in advance,
   Detelin


Re: Error while generating java from old wsdl

2008-04-07 Thread Detelin Yordanov
Hi,
  How do you start the Axis2 runtime - do you just run Axis2 standalone, or
using a servlet container and if so which one?

Regards,
   Detelin

2008/4/7 Chinmoy Chakraborty [EMAIL PROTECTED]:

 Hello,

 I am getting following error while I try to generate java classes from old
 (Axis 1.4) wsdl.

 log4j:WARN No appenders could be found for logger
 (org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder).
 log4j:WARN Please initialize the log4j system properly.
 java.lang.NoSuchMethodError:
 javax.xml.namespace.QName.init(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
  at
 org.apache.axis2.description.WSDL11ToAxisServiceBuilder.createSchemaForPorttype(WSDL11ToAxisServiceBuilder.java:1586)
  at
 org.apache.axis2.description.WSDL11ToAxisServiceBuilder.generateWrapperSchema(WSDL11ToAxisServiceBuilder.java:1431)
  at
 org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:255)
  at
 org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:109)
  at
 org.apache.axis2.wsdl.codegen.CodeGenerationEngine.init(CodeGenerationEngine.java:141)
  at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
  at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:324)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
 Exception in thread main


 Please find attached wsdl for which I am trying to generate java classes.

 Chinmoy





 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



Re: Error while generating java from old wsdl

2008-04-07 Thread Detelin Yordanov
Hi,
  The Ltype means this is an instance of the corresponding object type,
if it was an array it would have been
[Ljava/lang/String.See here
http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#16252
.

Anyway, you have these jars and the QName is correctly defined there,
however you might have some other (perhaps older)
jar that is loaded prior to these and its QName implementation (which does
not have the mentioned constructor) overrides the ones you have.
Or it could be something else, perhaps some experienced Axis2 developers
could help us here.
You are sure you have not tweaked the Axis2 1.3 distro somehow?

Regards,
   Detelin

On Mon, Apr 7, 2008 at 1:55 PM, Chinmoy Chakraborty [EMAIL PROTECTED]
wrote:

 Hi Detelin,

 I am using xml-apis-1.3.03.jar and xbean-2.2.0.jar. I am using JDK 1.4.08.

 Qname has 3 parameter constructor but I guess the issue is, the parameters
 are of type 'String' and in my case its
 'Ljava/lang/String;Ljava/lang/String;Ljava/lang/String' i.e. String array.

 Chinmoy

 On Mon, Apr 7, 2008 at 3:12 PM, Detelin Yordanov 
 [EMAIL PROTECTED] wrote:

  Hi,
 You should verify what version of the QName class is in use. If you
  are using the one in the xml-apis-1.3.03.jar (which you should have in the
  Axis2 1.3 lib folder) you should be fine. XMLBeans also includes this class
  (in the xbean-2.2.0.jar) and it is OK since it has the 3-parameters
  constructor.
  Which JDK are you using and have you made any modifications to its
  classpath?
 
  Regards,
 Detelin
 
 
  On Mon, Apr 7, 2008 at 12:03 PM, Chinmoy Chakraborty [EMAIL PROTECTED]
  wrote:
 
   I am running Axis2 standalone. Just using WSDLToJava standalone.
  
  
   Chinmoy
  
 On Mon, Apr 7, 2008 at 2:25 PM, Detelin Yordanov 
   [EMAIL PROTECTED] wrote:
  
Hi,
  How do you start the Axis2 runtime - do you just run Axis2
standalone, or using a servlet container and if so which one?
   
Regards,
   Detelin
   
2008/4/7 Chinmoy Chakraborty [EMAIL PROTECTED]:
   
   Hello,

 I am getting following error while I try to generate java classes
 from old (Axis 1.4) wsdl.

 log4j:WARN No appenders could be found for logger
 (org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder).
 log4j:WARN Please initialize the log4j system properly.
 java.lang.NoSuchMethodError:
 javax.xml.namespace.QName.init(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
  at
 org.apache.axis2.description.WSDL11ToAxisServiceBuilder.createSchemaForPorttype(WSDL11ToAxisServiceBuilder.java:1586)
  at
 org.apache.axis2.description.WSDL11ToAxisServiceBuilder.generateWrapperSchema(WSDL11ToAxisServiceBuilder.java:1431)
  at
 org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:255)
  at
 org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:109)
  at
 org.apache.axis2.wsdl.codegen.CodeGenerationEngine.init(CodeGenerationEngine.java:141)
  at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
  at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:324)
  at
 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
 Exception in thread main


 Please find attached wsdl for which I am trying to generate java
 classes.

 Chinmoy






 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

   
   
  
 



Re: Error while generating java from old wsdl

2008-04-07 Thread Detelin Yordanov
Hi,
  Axis2 1.3 does not support rpc/encoded WSDLs.
I found out a discussion about rpc/encoded WSDL support in ADB for Axis 1.4
-
http://markmail.org/message/htchm4nsbywlnzi4?q=list:org%2Eapache%2Ews%2Eaxis-dev+date:20071201-20080404+Soap+Encodingpage=1
However I don't know how far they went with that.

Regards,
   Detelin

On Mon, Apr 7, 2008 at 3:45 PM, Chinmoy Chakraborty [EMAIL PROTECTED]
wrote:

 Hi,

 Thanks for the link. I have another point, does Axis2 supports WSDL with
 rpc encoded binding? My old wsdl is rpc encoded.

 Chinmoy




 On Mon, Apr 7, 2008 at 5:27 PM, Detelin Yordanov 
 [EMAIL PROTECTED] wrote:

  Hi,
The Ltype means this is an instance of the corresponding object
  type, if it was an array it would have been
  [Ljava/lang/String.See here
  http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#16252
  .
 
  Anyway, you have these jars and the QName is correctly defined there,
  however you might have some other (perhaps older)
  jar that is loaded prior to these and its QName implementation (which
  does not have the mentioned constructor) overrides the ones you have.
  Or it could be something else, perhaps some experienced Axis2 developers
  could help us here.
  You are sure you have not tweaked the Axis2 1.3 distro somehow?
 
  Regards,
 Detelin
 
 
  On Mon, Apr 7, 2008 at 1:55 PM, Chinmoy Chakraborty [EMAIL PROTECTED]
  wrote:
 
   Hi Detelin,
  
   I am using xml-apis-1.3.03.jar and xbean-2.2.0.jar. I am using JDK
   1.4.08.
  
   Qname has 3 parameter constructor but I guess the issue is, the
   parameters are of type 'String' and in my case its
   'Ljava/lang/String;Ljava/lang/String;Ljava/lang/String' i.e. String array.
  
   Chinmoy
  
 On Mon, Apr 7, 2008 at 3:12 PM, Detelin Yordanov 
   [EMAIL PROTECTED] wrote:
  
Hi,
   You should verify what version of the QName class is in use. If
you are using the one in the xml-apis-1.3.03.jar (which you should have 
in
the Axis2 1.3 lib folder) you should be fine. XMLBeans also includes 
this
class (in the xbean-2.2.0.jar) and it is OK since it has the 
3-parameters
constructor.
Which JDK are you using and have you made any modifications to its
classpath?
   
Regards,
   Detelin
   
   
On Mon, Apr 7, 2008 at 12:03 PM, Chinmoy Chakraborty 
[EMAIL PROTECTED] wrote:
   
 I am running Axis2 standalone. Just using WSDLToJava standalone.


 Chinmoy

   On Mon, Apr 7, 2008 at 2:25 PM, Detelin Yordanov 
 [EMAIL PROTECTED] wrote:

  Hi,
How do you start the Axis2 runtime - do you just run Axis2
  standalone, or using a servlet container and if so which one?
 
  Regards,
 Detelin
 
  2008/4/7 Chinmoy Chakraborty [EMAIL PROTECTED]:
 
 Hello,
  
   I am getting following error while I try to generate java
   classes from old (Axis 1.4) wsdl.
  
   log4j:WARN No appenders could be found for logger
   (org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder).
   log4j:WARN Please initialize the log4j system properly.
   java.lang.NoSuchMethodError:
   javax.xml.namespace.QName.init(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
at
   org.apache.axis2.description.WSDL11ToAxisServiceBuilder.createSchemaForPorttype(WSDL11ToAxisServiceBuilder.java:1586)
at
   org.apache.axis2.description.WSDL11ToAxisServiceBuilder.generateWrapperSchema(WSDL11ToAxisServiceBuilder.java:1431)
at
   org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:255)
at
   org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:109)
at
   org.apache.axis2.wsdl.codegen.CodeGenerationEngine.init(CodeGenerationEngine.java:141)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
   Method)
at
   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
   com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
   Exception in thread main
  
  
   Please find attached wsdl for which I am trying to generate
   java classes.
  
   Chinmoy
  
  
  
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 

   
  
 



Re: Error while generating java from old wsdl

2008-04-07 Thread Detelin Yordanov
Sorry, I meant Axis*2* 1.4.

On Mon, Apr 7, 2008 at 3:58 PM, Detelin Yordanov [EMAIL PROTECTED]
wrote:

 Hi,
   Axis2 1.3 does not support rpc/encoded WSDLs.
 I found out a discussion about rpc/encoded WSDL support in ADB for Axis
 1.4 -

 http://markmail.org/message/htchm4nsbywlnzi4?q=list:org%2Eapache%2Ews%2Eaxis-dev+date:20071201-20080404+Soap+Encodingpage=1
 However I don't know how far they went with that.

 Regards,
Detelin


 On Mon, Apr 7, 2008 at 3:45 PM, Chinmoy Chakraborty [EMAIL PROTECTED]
 wrote:

  Hi,
 
  Thanks for the link. I have another point, does Axis2 supports WSDL with
  rpc encoded binding? My old wsdl is rpc encoded.
 
  Chinmoy
 
 
 
 
  On Mon, Apr 7, 2008 at 5:27 PM, Detelin Yordanov 
  [EMAIL PROTECTED] wrote:
 
   Hi,
 The Ltype means this is an instance of the corresponding object
   type, if it was an array it would have been
   [Ljava/lang/String.See here
   http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#16252
   .
  
   Anyway, you have these jars and the QName is correctly defined there,
   however you might have some other (perhaps older)
   jar that is loaded prior to these and its QName implementation (which
   does not have the mentioned constructor) overrides the ones you have.
   Or it could be something else, perhaps some experienced Axis2
   developers could help us here.
   You are sure you have not tweaked the Axis2 1.3 distro somehow?
  
   Regards,
  Detelin
  
  
   On Mon, Apr 7, 2008 at 1:55 PM, Chinmoy Chakraborty [EMAIL PROTECTED]
   wrote:
  
Hi Detelin,
   
I am using xml-apis-1.3.03.jar and xbean-2.2.0.jar. I am using JDK
1.4.08.
   
Qname has 3 parameter constructor but I guess the issue is, the
parameters are of type 'String' and in my case its
'Ljava/lang/String;Ljava/lang/String;Ljava/lang/String' i.e. String 
array.
   
Chinmoy
   
  On Mon, Apr 7, 2008 at 3:12 PM, Detelin Yordanov 
[EMAIL PROTECTED] wrote:
   
 Hi,
You should verify what version of the QName class is in use. If
 you are using the one in the xml-apis-1.3.03.jar (which you should 
 have in
 the Axis2 1.3 lib folder) you should be fine. XMLBeans also includes 
 this
 class (in the xbean-2.2.0.jar) and it is OK since it has the 
 3-parameters
 constructor.
 Which JDK are you using and have you made any modifications to its
 classpath?

 Regards,
Detelin


 On Mon, Apr 7, 2008 at 12:03 PM, Chinmoy Chakraborty 
 [EMAIL PROTECTED] wrote:

  I am running Axis2 standalone. Just using WSDLToJava standalone.
 
 
  Chinmoy
 
On Mon, Apr 7, 2008 at 2:25 PM, Detelin Yordanov 
  [EMAIL PROTECTED] wrote:
 
   Hi,
 How do you start the Axis2 runtime - do you just run Axis2
   standalone, or using a servlet container and if so which one?
  
   Regards,
  Detelin
  
   2008/4/7 Chinmoy Chakraborty [EMAIL PROTECTED]:
  
  Hello,
   
I am getting following error while I try to generate java
classes from old (Axis 1.4) wsdl.
   
log4j:WARN No appenders could be found for logger
(org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder).
log4j:WARN Please initialize the log4j system properly.
java.lang.NoSuchMethodError:
javax.xml.namespace.QName.init(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
 at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.createSchemaForPorttype(WSDL11ToAxisServiceBuilder.java:1586)
 at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.generateWrapperSchema(WSDL11ToAxisServiceBuilder.java:1431)
 at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:255)
 at
org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:109)
 at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.init(CodeGenerationEngine.java:141)
 at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
 at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Exception in thread main
   
   
Please find attached wsdl for which I am trying to generate
java classes.
   
Chinmoy

Re: Axis2 1.3 - ENABLE_MTOM

2008-04-07 Thread Detelin Yordanov
Hi,
  I'm not sure about this but I think that if you create the configuration
context like this (using null for the axis2 XML file), it uses the default
axis2.xml inside the axis2-kernel.jar
(org/apache/axis2/deployment/axis2_default.xml). In this file the
enableMTOM
is set to false, therefore the server does not MTOM-ize the response.
You could pass a custom axis2.xml with enableMTOM set to true, or try to
enable it programmatically on the server side too.

Regards,
   Detelin

On Mon, Apr 7, 2008 at 6:54 PM, Gabriel Landais [EMAIL PROTECTED]
wrote:

 Hi,
 I just don't understand if it's a bug or something that I don't
 understand. I am not able to send MTOM response from my Axis2 server. Tried
 with that simple application :

 public class SimpleService {

   public byte[] translateString(byte[] document) {
   return document;
   }
  }

 ---

 public class SimpleServer {

   public static void main(String[] args) throws Exception {
   ConfigurationContext context =
 ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
 null);
 AxisService service =
 AxisService.createService(SimpleService.class.getName(),
 context.getAxisConfiguration());
   Iterator operations = service.getOperations();
   while (operations.hasNext()) {
   AxisOperation axisOperation = (AxisOperation) operations.next();
   axisOperation.addParameter(Constants.Configuration.ENABLE_MTOM,
 Constants.VALUE_TRUE);
   }
 context.getAxisConfiguration().addService(service);
   SimpleHTTPServer server = new SimpleHTTPServer(context, 8080);
   server.start();
   }

 }

 -

 public class SimpleClient {

   public static void main(String[] args) throws Exception {
   SimpleServiceStub simpleServiceStub = new SimpleServiceStub();

 simpleServiceStub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM,
   Constants.VALUE_TRUE);

   TranslateString translateString = new TranslateString();

   DataSource ds = new URLDataSource(new URL(http://www.google.com/
 ));
   DataHandler dataHandler = new DataHandler(ds);

   translateString.setDocument(dataHandler);

   TranslateStringResponse translatedString =
 simpleServiceStub.translateString(translateString);

   DataHandler content = translatedString.get_return();
   InputStreamReader reader = new
 InputStreamReader(content.getInputStream());
   BufferedReader bufferedReader = new BufferedReader(reader);

   String line = bufferedReader.readLine();

   while (line != null) {
   System.out.println(line);
   line = bufferedReader.readLine();
   }
   }

 }

 -


 Request sent from client looks ok :

 POST /axis2/services/SimpleService HTTP/1.1
 Content-Type: multipart/related;
 boundary=MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395;
 type=application/xop+xml; start=
 0.urn:uuid:[EMAIL PROTECTED][EMAIL PROTECTED];
 start-info=application/soap+xml; action=urn:translateString
 User-Agent: Axis2
 Host: 127.0.0.1:1080
 Transfer-Encoding: chunked

 d1c
 --MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395
 Content-Type: application/xop+xml; charset=UTF-8;
 type=application/soap+xml
 Content-Transfer-Encoding: binary
 Content-ID: 0.urn:uuid:[EMAIL PROTECTED][EMAIL PROTECTED]
 

 ?xml version='1.0' encoding='UTF-8'?soapenv:Envelope xmlns:soapenv=
 http://www.w3.org/2003/05/soap-envelope;soapenv:Bodyns1:translateString
 xmlns:ns1=http://ws.apache.org/axis2;documentxop:Include href=
 cid:1.urn:uuid:[EMAIL PROTECTED][EMAIL PROTECTED]
 xmlns:xop=http://www.w3.org/2004/08/xop/include;
 //document/ns1:translateString/soapenv:Body/soapenv:Envelope
 --MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: binary
 Content-ID: 1.urn:uuid:[EMAIL PROTECTED][EMAIL PROTECTED]
 

 [...DATA...]

 --MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395--
 0

 --
 But returns is just weird. It is multiparted but still base64 encoded :

 HTTP/1.1 200 OK
 Date: Mon, 07 Apr 2008 15:43:38 GMT
 Server: Simple-Server/1.1
 Transfer-Encoding: chunked
 Content-Type: multipart/related;
 boundary=MIMEBoundaryurn_uuid_D2ADB7746CB22F21961207583018160;
 type=application/xop+xml; start=
 0.urn:uuid:[EMAIL PROTECTED][EMAIL PROTECTED];
 start-info=application/soap+xml; action=urn:translateStringResponse

 20f1
 --MIMEBoundaryurn_uuid_D2ADB7746CB22F21961207583018160
 Content-Type: application/xop+xml; charset=UTF-8;
 type=application/soap+xml
 Content-Transfer-Encoding: binary
 Content-ID: 0.urn:uuid:[EMAIL PROTECTED][EMAIL PROTECTED]
 

 ?xml version='1.0' encoding='UTF-8'?soapenv:Envelope xmlns:soapenv=
 http://www.w3.org/2003/05/soap-envelope;soapenv:Bodyns:translateStringResponse
 xmlns:ns=http://ws.apache.org/axis2;return
 [...base64 encoded DATA...]
 

Re: Using SWA with ADB in axis2

2008-04-02 Thread Detelin Yordanov
Hello,
  I have experienced the same problem - the reason is that in your client
stub the message context is cleaned up
right after building the response object, e.g.:

_operationClient.execute(true);
...
java.lang.Object object = fromOM( ...);
_messageContext.getTransportOut().getSender().cleanup(_messageContext);

return XXX;

The cleanup closes the stream that the response has been read from, so that
if you try to read the attachments later on (after returning from the stub's
method) you will get the mentioned exception.

I do not know whether you can instruct ADB to read the attachments for you,
the simplest workaround if you just have one stub
is to insert code that will read the attachments before the message context
gets cleaned up.

Regards,
   Detelin



On Tue, Apr 1, 2008 at 4:52 PM, ndthuy [EMAIL PROTECTED] wrote:


 Hi Thilina,

 After taking a look at those articles, I am able to upload the file
 without
 any problem. But when I download the file, I received this error:

 Exception in thread main org.apache.axiom.om.OMException:
 javax.mail.MessagingException: Error in input stream;
  nested exception is:
java.io.IOException: Attempted read on closed stream.
at
 org.apache.axiom.attachments.Attachments.getPart(Attachments.java:602)
at

 org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:462)
at

 org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:278)
at

 org.apache.axis2.context.MessageContext.getAttachment(MessageContext.java:1623)
at

 com.cvg.ap.service.publicservices.impl.APContentManagementServicesStub.fetchContentFile(APContentManagementServicesStub.java:810)
at

 com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.fetchContentFile(APContentManagementServicesImpl.java:256)
at

 com.cvg.ap.service.publicservices.impl.APContentManagementServicesImpl.main(APContentManagementServicesImpl.java:463)
 Caused by: javax.mail.MessagingException: Error in input stream;
  nested exception is:
java.io.IOException: Attempted read on closed stream.
at
 javax.mail.internet.InternetHeaders.load(InternetHeaders.java:142)
at
 javax.mail.internet.InternetHeaders.init(InternetHeaders.java:93)
at javax.mail.internet.MimeBodyPart.init(MimeBodyPart.java:124)
at
 org.apache.axiom.attachments.PartOnMemory.init(PartOnMemory.java:34)
at
 org.apache.axiom.attachments.Attachments.getPart(Attachments.java:598)
... 6 more


 This is the soap message when I upload and download:


 /soapenv:Envelope--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387Content-Type:
 application/octet-streamContent-Transfer-Encoding: binaryContent-ID:
  urn:uuid:1ADD9EC725995A3FD11206998814743/*Pogue.cs - Custom
 Rogue class3a--MIMEBoundaryurn_uuid_1ADD9EC725995A3FD11206998815387--0

 This is soap message when I download:

 --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
 7e8

 Content-Type: application/octet-stream
 Content-Transfer-Encoding: binary
 Content-ID:
  urn:uuid:5042108D598DCCE8AE1206999117974/*Pogue.cs - Custom
 Rogue class
 38

 --MIMEBoundaryurn_uuid_5042108D598DCCE8AE1206999131913
 2
 --
 0

 Do you think it is because the way it prepares the SOAP message on server
 side ?

 Thanks.




 Thilina Gunarathne wrote:
 
  Hi,
  I would have a WSDL with a string return field (or a complex type
  containing a string element) and would assign the content-id to that
  string.
 
  You can have a look at the following articles to figure out how to add
  the attachment in the service implementation class..
  http://wso2.org/library/1675
  http://wso2.org/library/1148
 
  String contentId = messageContext.addAttachment(dataHandler);
 
  thanks,
  Thilina
 
 
  On Mon, Mar 31, 2008 at 11:14 AM, ndthuy [EMAIL PROTECTED] wrote:
 
   Thanks Thilina,
 
   I was able to modify according to your suggestion to upload the file
  using
   ADB with SwA.
 
   But for the dowload using ADB with SwA, how do we modify the SOAP
  message to
   attach the binary data ?
   Do we have to modify in invokeBusinessLogic(...) function ?
 
   Thanks.
 
 
 
   Thilina Gunarathne wrote:
   
Hi,
You cannot generate WSDL with the knowledge of SwA in them.. AFAIK
there isn't a standard way to mention SwA attachments in WSDL.. ADB
does not support SwA directly..
   
What you can do in the server side is to have your method signature
take in an String which will be the content-id of the attachment,
 then
retrieve your attachment from the messageContext manually using
 it...
Have a look at [1]  [2]..
   
Your following method will result in an MTOM WSDL, where dataHandler
will get bound to an base64Binary element.
   
 addContentFile(String userID, String password,
String serviceID, DataHandler dataHandler,
String relAddFilepathName, String
  contentType,

PolicyReference serialization problem

2008-03-24 Thread Detelin Yordanov
Hello guys,
   I am using the AxisService2WSDL11 class to generate a WSDL for an
AxisService.
The service was populated from a WSDL and contains policy references on the
service and some of the bindings.
When the addPolicyAsExtElement(..) method is being executed (no matter on
which subject), the corresponding policy references should be added to the
resulting OMElement.
However the PolicyUtil.getPolicyComponentAsOMElement(..) fails to serialize
the PolicyReference component with the following exception:

Caused by: org.apache.axiom.om.OMException:
com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix wsp
 at [row,col {unknown-source}]: [1,56]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(
StAXOMBuilder.java:239)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement
(OMDocumentImpl.java:130)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement
(StAXOMBuilder.java:359)
at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:568)
at org.apache.axis2.util.PolicyUtil.getPolicyComponentAsOMElement(
PolicyUtil.java:119)
at
org.apache.axis2.description.AxisService2WSDL11.addPolicyAsExtElement(
AxisService2WSDL11.java:1007)
at org.apache.axis2.description.AxisService2WSDL11.generateService(
AxisService2WSDL11.java:477)
at org.apache.axis2.description.AxisService2WSDL11.generateOM(
AxisService2WSDL11.java:229)

I spent some time trying to find the reason for this and it seems that the
problem is inside the Woodstox Stax API.
It happens that the writer that is created using the XMLOutputFactory does
not add schema declarations to the underlying output stream.
So if the original PolicyReference is:
wsp:PolicyReference xmlns:wsp=http://schemas.xmlsoap.org/ws/2004/09/policy;
URI=#My_Reliable_Messaging_Policy/

after writing it to the ByteArrayOutputStream it becomes:
wsp:PolicyReference URI=#My_Reliable_Messaging_Policy/

I am using wstx-asl-3.2.1.jar, but I've also tried with newer and older
version and the result was the same.
The underlying writer that is returned by the Wstx XMLOutpuFactory is
SimpleNsStreamWriter, I noticed if I use the RepairingNsStreamWriter,
it correctly adds the schema declarations and I get no exception (this can
be forced by setting the XMLOutputFactory.IS_REPAIRING_NAMESPACES property
to the factory).

Has anyone experienced the same problem. Is there something that I miss
here, or there is a problem in the Woodstox API (which I seriously doubt)?
Thanks in advance for any help.

Regards,
   Detelin