Re: SOAPMessage with attachment problem

2008-12-01 Thread Chinmoy Chakraborty
Andreas,

I have downloaded the axis2-saaj-SNAPSHOT.jar from the [2] link but I am
getting following error:

Caused by: java.lang.NoSuchMethodError:
org.apache.axiom.om.impl.MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(Ljavax/activation/DataHandler;Ljava/lang/String;Ljava/io/OutputStream;Ljava/util/Map;Lorg/apache/axiom/om/OMOutputFormat;)V
 at org.apache.axis2.saaj.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:327)

I guess I need to download latest axiom code also. Could you please tell me
the url? One more thing I noticed latest saaj-impl code has been compiled in
jdk 1.5 and as I have been running jdk1.4 it was giving version error. Do
you plan to compile this in jdk 1.4 also?

Chinmoy







On Mon, Dec 1, 2008 at 5:45 PM, Andreas Veithen
<[EMAIL PROTECTED]>wrote:

> Chinmoy,
>
> You can either build it from sources (using the Subversion repository
> at [1]) or wait for the next build and pick up the JAR at [2]. I don't
> know the exact build schedule, but a new build should be available
> within 24 hrs. Also, be aware that axis2-saaj-api no longer exists,
> but has been moved to Geronimo.
>
> Andreas
>
> [1] http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/
> [2]
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/axis2/axis2-saaj/SNAPSHOT/
>
>
> On Mon, Dec 1, 2008 at 12:48, Chinmoy Chakraborty <[EMAIL PROTECTED]>
> wrote:
> > Hi Andreas,
> >
> > Thanks for reply. How do I get the fixed version? From where do I get
> latest
> > jars?
> >
> > Chinmoy
> >
> > On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen <
> [EMAIL PROTECTED]>
> > wrote:
> >>
> >> Chinmoy,
> >>
> >> It is not writing MIME messages because the writeTo method was not
> >> implemented correctly. This should now be fixed in trunk.
> >>
> >> Andreas
> >>
> >> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <[EMAIL PROTECTED]>
> >> wrote:
> >> > Hi All,
> >> >
> >> > I am creating a SOAP message using axis2 soap-api and soap-impl. First
> I
> >> > am
> >> > creating the SOAPPart and then I am adding the attachmentpart.
> >> >
> >> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes
> the
> >> > soap
> >> > envelop and not the MIME message. Could somebody please clarify why it
> >> > is
> >> > not writing the MIME message. Following is my code snippet
> >> >
> >> >   soapMsg = MessageFactory.newInstance().createMessage();
> >> >   //setting the namespace declaration.
> >> >   SOAPPart sp = soapMsg.getSOAPPart();
> >> >   SOAPEnvelope se = sp.getEnvelope();
> >> >   soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
> >> > DEFAULT_ENCODING);
> >> >   soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
> >> >
> >> >  se.addChildElemet()...
> >> >
> >> >  then I am adding the attachments...like
> >> >  addAttachments(attachmentList);
> >> >
> >> >
> >> > private void addAttachments(List attachmentList) throws SOAPException,
> >> > IOException {
> >> >   if (attachmentList != null && attachmentList.size() > 0) {
> >> >   Iterator attachmentit = attachmentList.iterator();
> >> >   while (attachmentit.hasNext()) {
> >> >   DataHandler dh = (DataHandler) attachmentit.next();
> >> >   AttachmentPart ap = soapMsg.createAttachmentPart();
> >> >   ap.setContentId(dh.getName());
> >> >   Object content = dh.getContent();
> >> >   ap.setContent(dh.getContent(), dh.getContentType());
> >> >   soapMsg.addAttachmentPart(ap);
> >> >   }
> >> >   }
> >> >   }
> >> >
> >> >
> >> > Thanks,
> >> > Chinmoy
> >>
> >> -
> >> 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]
>
>


Re: Message encryption works but fault messages are send in plain text

2008-12-01 Thread Maik Hassel


Apologies - I just realized I should be more specific: The fault  
message I am talking about is an application generates service fault,  
not an axisfault thrown by the server


--
Simply Efficient - IT Services, Consulting, Training Inc.
"We Keep Our Promises"
Vancouver, BC
Phone: +1 604.315.8446
Fax  : +1 604.731.1147
http://www.simplyefficient.ca


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



Re: Message encryption works but fault messages are send in plain text

2008-12-01 Thread Maik Hassel


Unfortunately not as my problem is different as the one described:

My encryption/descryption works fine across multiple machines and  
normal soap requests do get both de- and encrypted fine on both ends!
It's the fault messages only that impose a problem: The server does  
NOT encrypt/sign fault messages (it DOES, however, encrypt the regular  
messages). Fault messages only are send b the server without any  
security headers whatsoever...



Quoting Prabath Siriwardena <[EMAIL PROTECTED]>:


Hi Mark;

You may find the answer here[1].

Thanks & regards.
-Prabath
[1]:http://wso2.org/forum/thread/4340#comment-7247

Maik Hassel wrote:

Hello everyone,

I have a web service using the security policy below (signed and
encrypted message body), which works fine, except that my fault messages
do not get encrypted. I get the "missing security header" exception at
the client - using TCPMon I can see that indeed the fault message is
send without any security related info and in plain text.

Am I missing something? Do I have to add additional configuration
parameters for the signing and encryption of fault messages?


Thanks for any hints,
Maik

 snip ---




http://www.w3.org/ns/wsdl/in-out";
class="ca.bc.xyz.SearchServicesMessageReceiverInOut"/>

ca.bc.xyz.SearchServiceImplementation
   
http://www.w3.org/ns/wsdl/in-out";
namespace="">
SyncSearch

...
urn:






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

xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";

xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";

wsu:Id="mypolicy">




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









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






























http://ws.apache.org/rampart/policy";>
s1
useReqSigCert

ca.webservice.server.search.PasswordCallbackHandler




 JKS 
keystore.ks

 






JKS

 keystore.ks 



















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






--
Simply Efficient - IT Services, Consulting, Training Inc.
"We Keep Our Promises"
Vancouver, BC
Phone: +1 604.315.8446
Fax  : +1 604.731.1147
http://www.simplyefficient.ca


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



Re: Message encryption works but fault messages are send in plain text

2008-12-01 Thread Prabath Siriwardena
Hi Mark;

You may find the answer here[1].

Thanks & regards.
-Prabath
[1]:http://wso2.org/forum/thread/4340#comment-7247

Maik Hassel wrote:
> Hello everyone,
> 
> I have a web service using the security policy below (signed and
> encrypted message body), which works fine, except that my fault messages
> do not get encrypted. I get the "missing security header" exception at
> the client - using TCPMon I can see that indeed the fault message is
> send without any security related info and in plain text.
> 
> Am I missing something? Do I have to add additional configuration
> parameters for the signing and encryption of fault messages?
> 
> 
> Thanks for any hints,
> Maik
> 
>  snip ---
> 
> 
> 
> 
> http://www.w3.org/ns/wsdl/in-out";
> class="ca.bc.xyz.SearchServicesMessageReceiverInOut"/>
> 
>  locked="false">ca.bc.xyz.SearchServiceImplementation
>
> http://www.w3.org/ns/wsdl/in-out";
> namespace="">
> SyncSearch
> 
>  faultName="DPSearchFault">...
>  faultName="XYZFault">urn:
> 
> 
> 
> 
> 
> 
>  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
>
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";
>
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
> 
> wsu:Id="mypolicy">
> 
> 
> 
> 
>  sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";>
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never";>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> http://ws.apache.org/rampart/policy";>
> s1
> useReqSigCert
>
> ca.webservice.server.search.PasswordCallbackHandler
> 
> 
> 
>  provider="org.apache.ws.security.components.crypto.Merlin">
>  name="org.apache.ws.security.crypto.merlin.keystore.type"> JKS 
>  name="org.apache.ws.security.crypto.merlin.file">keystore.ks
> 
>  name="org.apache.ws.security.crypto.merlin.keystore.password"> 
> 
> 
> 
> 
> 
>  provider="org.apache.ws.security.components.crypto.Merlin">
>  name="org.apache.ws.security.crypto.merlin.keystore.type">JKS   
> 
>  name="org.apache.ws.security.crypto.merlin.file"> keystore.ks 
>  name="org.apache.ws.security.crypto.merlin.keystore.password">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 


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



Re: Problem related to ADB when transferring a byte array

2008-12-01 Thread Marc F.


Marc F. wrote:
> 
> To demonstrate a possible bug in ADB Webservice I attached a zip file,
> containing two aar files, and the source code as well.
> 
> There is a very simple service in those two aar files. Actually, this
> service does the same thing in both aar files, but one is XML Beans
> version, and the other is ADB version.
> 
> Basically the service consists on the following steps:
> 1)In the client side:
> 1.1)Build a XML content, according to a defined XML Schema.
> 1.2)Encript this XML content, using symmetric criptography, with AES
> (Advanced Encryption Standard) and 128 bits key.
> 1.3)Send this encrypted XML content to the webservice.
> 1.4)Receive the result of the webservice call, which is another encrypted
> XML content.
> 1.5)Decrypt the received encrypted XML content.
> 1.6)Validate the XML content against another defined XML schema.
> 
> 2)In the server side (webservice side):
> 2.1)Receive the encrypted XML content sent by the client.
> 2.2)Decrypt the encrypted XML content.
> 2.3)Validate the XML content against a defined XML schema.
> 2.4)Extract a certain string from the XML content.
> 2.5)Build another XML content, adding the extracted string.
> 2.6)Encrypt the XML content.
> 2.7)Sent the encrypted XML content back to the client.
> 
> There are two classes that represent the client code:
> com.bug.axis2.test.XMLBeansTestClass and com.bug.axis2.test.ADBTestClass.
> 
> The problem happens when the ADB version of the webservice is called. Just
> run ADBTestClass in order to reproduce it. The problem is related to the
> length of the byte array that is being transferred. Sometimes the
> webservice receives a byte array with less elements than the expected.
> Sometimes the client receives a byte array with less elements than the
> expected. When the byte array has the wrong quantity of elements the
> following exception is thrown, in the moment of decryption:
> 
> javax.crypto.IllegalBlockSizeException: Input length must be multiple of
> 16 when decrypting with padded cipher
> 
> But there are times in which eveything works correctly. Please, have a
> look at the source code of the com.bug.axis2.helpers.UtilClass, in the
> generateRequestXML() method. Read the comments I let in this method, and
> comment/uncomment the lines in order to reproduce those situations.
> 
> In XML Beans version of the webservice the problem never happens.
> 
> The source codes were compiled with Java 5, and the test was done using
> Tomcat 5.5.26. But the problem is not related to the environment, neither
> to the Java version. The problem is a possible bug in ADB.
> 
> The Axis2 version is 1.4.1.
> 
> The zip file contains two directories in its root: "testbug" and
> "WEB-INF". To install this content in the axis2 web application just
> extract the content of the zip file in the root directory of the axis2 web
> application. After finishing this, the "testbug" directory should be in
> the root directory of the axis2 web application, or in other words, the
> "testbug" directory should be in the same level of WEB-INF directory.
> Obviously, the content of "WEB-INF" in the zip file should be put inside
> the WEB-INF directory of the axis2 web application. Please notice that it
> is assumed that the context root of the axis2 web application is
> "Axis2BugADB", but you can change it if you want. You would just have to
> recompile two source codes, com.bug.axis2.test.ADBTestClass and
> com.bug.axis2.test.XMLBeansTestClass and rebuild the aar files, editing
> the wsdl file and those two java source codes with the new context root
> defined by you.
> 
> Please tell me if the impression I am having indicates a real bug or not,
> when you have time to run the webservices in the zip file. If this is not
> a bug, please, tell me how to solve the problem.
> 
> Thank you, and sorry my poor English.
> 
>  http://www.nabble.com/file/p20607870/Axis2BugADB.zip Axis2BugADB.zip 
> 

Hi, please, if you discovered something, notify me.


Thanks!
-- 
View this message in context: 
http://www.nabble.com/Problem-related-to-ADB-when-transferring-a-byte-array-tp20607870p20784153.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]



Message encryption works but fault messages are send in plain text

2008-12-01 Thread Maik Hassel

Hello everyone,

I have a web service using the security policy below (signed and  
encrypted message body), which works fine, except that my fault  
messages do not get encrypted. I get the "missing security header"  
exception at the client - using TCPMon I can see that indeed the fault  
message is send without any security related info and in plain text.


Am I missing something? Do I have to add additional configuration  
parameters for the signing and encryption of fault messages?



Thanks for any hints,
Maik

 snip ---




http://www.w3.org/ns/wsdl/in-out";  
class="ca.bc.xyz.SearchServicesMessageReceiverInOut"/>


locked="false">ca.bc.xyz.SearchServiceImplementation

   
mep="http://www.w3.org/ns/wsdl/in-out"; namespace="">

SyncSearch

faultName="DPSearchFault">...
faultName="XYZFault">urn:







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

xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy";

xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
wsu:Id="mypolicy">




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










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































http://ws.apache.org/rampart/policy";>
s1
useReqSigCert
	ca.webservice.server.search.PasswordCallbackHandler  





		name="org.apache.ws.security.crypto.merlin.keystore.type"> JKS  

		name="org.apache.ws.security.crypto.merlin.file">	keystore.ks  

		name="org.apache.ws.security.crypto.merlin.keystore.password">   







		name="org.apache.ws.security.crypto.merlin.keystore.type">JKS	
		  
keystore.ks 
		name="org.apache.ws.security.crypto.merlin.keystore.password">















--
Simply Efficient - IT Services, Consulting, Training Inc.
"We Keep Our Promises"
Vancouver, BC
Phone: +1 604.315.8446
Fax  : +1 604.731.1147
http://www.simplyefficient.ca


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



RE: Client stubs NullPointer Exception

2008-12-01 Thread Marc F.


Chris Tinning wrote:
> 
> This is my code - 
> Setup -
> 
> ConfigurationContext config
> =ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,
>   AXIS2_CONFIG_FILE_LOCATION);
> // serviceUrl of the form http://host:8080/app/services/session   
> serviceStub = new SessionServiceStub( config, serviceUrl);
> 
> 
> And later calling the service - 
> 
> GetAvailableConnectionsDocument request =
> GetAvailableConnectionsDocument.Factory.newInstance();
> GetAvailableConnectionsResponse response =
> serviceStub.getAvailableConnections( request );
> 
> The call to getAvailableConnections results in the NullPointer. As far as
> I can see this is the same as in the documentation. It is loading the
> axis2.config file as I've had to comment out the addressing module from
> that - could this be the problem? I am using the supplied axis2.xml with
> only that change, I've also tried without supplying the config (ie. new
> SessionServiceStub(serviceUrl) ) and got the same error.
> 

I am re-replying because I suspect you are not seeing the last update I did
in my last reply (I don´t know how exactly this forum works yet). Here I
go... read below:

Is really the SessionServiceStub a XML Beans client stub, generated from
Axis2? Did you modify the default code of the auto-generated
SessionServiceStub class?

In the following line:
GetAvailableConnectionsDocument request =
GetAvailableConnectionsDocument.Factory.newInstance();

Instead of doing that, rename the "request" variable to "requestDocument"
(just to make things more clear):
GetAvailableConnectionsDocument requestDocument =
GetAvailableConnectionsDocument.Factory.newInstance();

Next, you also have to define the instance of the GetAvailableConnections
class, that would be something like this:
GetAvailableConnections request =
GetAvailableConnections.Factory.newInstance();

And then you have to pass this "request" to the "requestDocument", that
would be something like this:
requestDocument.setAvailableConnections(request);

In the following line:
GetAvailableConnectionsResponse response =
serviceStub.getAvailableConnections( request );

I do not know how you wrote the method getAvailableConnections (how did you
create the SessionServiceStub class?), I even doubt that your code compile
(post the full code, please, or upload your code in a zip file), but,
instead of calling the webservice like that, you should call this way:
GetAvailableConnectionsResponseDocument responseDocument =
serviceStub.getAvailableConnections( requestDocument);

You should have, in your client stub class (supposedly, the
SessionServiceStub class), a method that returns a
GetAvailableConnectionsResponseDocument , not a
GetAvailableConnectionsResponse.

Finally, to obtain a GetAvailableConnectionsResponse, you have to do this:
GetAvailableConnectionsResponse response =
responseDocument.getAvailableConnectionsResponse();

This "response" object is an instance of GetAvailableConnectionsResponse in
which you have all the things you want.
-- 
View this message in context: 
http://www.nabble.com/Client-stubs-NullPointer-Exception-tp20721127p20782028.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]



Re: Axis2 and Tomcat 5.0.28 commons-logging-api

2008-12-01 Thread Marc F.

I have to point people out about an article written by Ceki Gülcü
(one of the programmers, maybe the main programmer, that developed Log4j).
Ceki Gülcü also wrote the book "The complete Log4j manual". So, I
think we can trust the article:

http://www.qos.ch/logging/classloader.jsp Taxonomy of class loader problems
encountered when using Jakarta Commons Logging 

This article clarified everything. In my opinion, the article is extremely
important. After running all those examples, now I am capable of
comprehending how, in fact, the classloading mechanism in Tomcat works.
Well, not only in Tomcat, but in Java platform itself as well. The
classloading problem is not limited to a free web container like Tomcat. It
can possibly happen in, for example, WebSphere, or any other commercial
application server. That´s because this problem is not related to the web
container, but to the Java platform itself, actually.

In fact, citing another example, a very common problem when using
webservices, that is also related to the parent/child classloading
relationship is:

java.lang.NoSuchMethodError:
javax/wsdl/PortType.getExtensionAttributes()Ljava/util/Map

This problem can happen when a different version of wsdl4j-XXX.jar is placed
in a parent classpath directory, comparing to the version placed in the
child classpath directory. It doesn´t matter how web container, free or
commercial, is being used.

Now I can understand how the classloading mechanism can cause bugs, if it is
not used correctly.

In the Ceki Gülcü´s article, it is strongly recommended to NOT
include commons-logging.jar and log4j.jar in the web-applications'
WEB-INF/lib/ directory, if Tomcat is used. Well, although this
recommendation be the best practice, I am not following this rule exactly,
due to some restrictions in my environment. I do include those two jars in
the WEB-INF/lib/ directory (contradicting the recommendation). I just have
to guarantee that those two jars are not in a shared classpath directory
either, that would be a "parent classpath directory" (in Tomcat, it would
be, for example, the [CATALINA_HOME]/shared/lib/ directory). I am sure that
it works without problems because I run all those examples in the Ceki
Gülcü´s article and I understood all of them.
-- 
View this message in context: 
http://www.nabble.com/Axis2-and-Tomcat-5.0.28-commons-logging-api-tp19242773p20781902.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]



Re: Axis 1 in semi-RESTful way

2008-12-01 Thread kat kat
On Fri, Nov 28, 2008 at 9:07 PM, kat kat <[EMAIL PROTECTED]> wrote:

> On Fri, Nov 28, 2008 at 8:41 PM, keith chapman <[EMAIL PROTECTED]>wrote:
>
>> Can you explain why you have to use Axis2 a.4 and not Axis2 a.4.1?
>
>
> Is Axis 1.4 ( http://ws.apache.org/axis/ ) referred as Axis2 a.4?
>
> Well, I am planning to manage the VMWare ESX 3.5 virtual machines using the
> SOAP web service they provide. They have given the WSDL although the code
> generated by WSDL2JAVA class from Axis ( http://ws.apache.org/axis/ ) and
> Axis2 are pretty different. VMWare recommends development of client code
> accessing their service on Axis 1.4.
>
> Me being new to both and in the interest to develop the client faster I
> want to kick start with the client code examples they have given. They
> generate client stubs using WSDL2JAVA of Axis 1.4.
>
> I agree same is possible with AXIS2 as well and my original aim was to
> develop a service which will act as a REST server (other projects in my
> company follow REST) and SOAP client for VMWare with REST acting just as a
> interface between my webservice and other projects which use REST client in
> Python.
>
> So is the reason.
>
>
> On Sat, Nov 29, 2008 at 8:27 AM, kat kat <[EMAIL PROTECTED]> wrote:
>>
>>> Hello All,
>>>
>>> For some reason I will have to use axis 1.4 and not axis2 1.4.1.
>>>
>>> So, can Axis 1, current release 1.4, be used in semi-RESTful way with
>>> just POST/GET methods since it supports WSDL 1.1 and WSDL 1.1, I believe,
>>> does support POST and GET methods?
>>
>>

Any feedback on this? If I want a simple application/x-www-form-urlencoded
HTTP POST to be performed on one service and equivalently a simple GET, can
this be done with Axis 1.4. In brief REST style POST and GET with Axis 1.4.



> If yes, is there any example for this?
>>>
>>


RE: .NET Web Service is accessed by java program

2008-12-01 Thread Meeusen, Christopher W.
I've generated java proxy classes by just using eclipse.  From the java
perspective go to FILE>NEW>OTHER>WEB SERVICES> WEB SERVICE CLIENT.  Then
the wizard will ask you for the location of the wsdl, give it that and
then it will generate all the proxy classes for you.  That's what I
would do.  



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
g] On Behalf Of Ferry Sumendap
Sent: Sunday, November 30, 2008 10:27 PM
To: axis-user@ws.apache.org
Subject: Re: .NET Web Service is accessed by java program


Thank you very much for all your responses.

I have extracted axis 2 and put it in folder (H:\axis2-1.4.1)
I also have started the .NET webservice  which I can open its service
via Internet browser (http://localhost:2242/WebSite1/Service.asmx).I
have tested that the .NET webservice works properly.

But when I want to generate its proxy by running java2wsdl.bat this
message always shown up.

H:\axis2-1.4.1\bin>java2wsdl.bat -uri
http://localhost:2242/WebSite1/Service.asmx?WSDL
Using AXIS2_HOME:   H:\axis2-1.4.1
Using JAVA_HOME:C:\Program Files\Java\jdk1.6.0_02
Usage: java2wsdl [options] -cn 

where [options] include:
  -o output directory
  -of   output file name for the WSDL
  -sn   service name



H:\axis2-1.4.1\bin>java2wsdl.bat
http://localhost:2242/WebSite1/Service.asmx?WSDL
Using AXIS2_HOME:   H:\axis2-1.4.1
Using JAVA_HOME:C:\Program Files\Java\jdk1.6.0_02
Usage: java2wsdl [options] -cn 

where [options] include:
  -o output directory
  -of   output file name for the WSDL
  -sn   service name
  -laddress of the port for the
WSDL
  -cp list of classpath entries -
(urls)
  -tn   target namespace for service

Or should I execute wsdl.exe to generate wsdl file ? does  java2wsdl.bat
also support for .NET web service or just AXIS Web Service ?

Basically, I just want to write java program (desktop program,
standalone without need to run Axis Server, or Tomcat if possible) to
access the .NET webservice method (ConcatWithSpace, HelloWorld, etc).
 Is it possible and what is the next step ? 
Thank you very much.



Regards,
Ferry

--- On Thu, 11/27/08, Marc F. <[EMAIL PROTECTED]> wrote:


From: Marc F. <[EMAIL PROTECTED]>
Subject: Re: .NET Web Service is accessed by java program
To: axis-user@ws.apache.org
Date: Thursday, November 27, 2008, 6:28 PM




Ferry Sumendap wrote:
> 
> 
> Hello everybody,
> I am looking for a sample code how java access / call /execute
functions 
> which
 are available at .NET Web Service (.NET framework 2.0).
> The java program should retrieve the XML response (output)
from the web
> service .
> If anyone knows tutorial about this matter, please let me know
the url...
> :)
> 
> Thank you very much.
> 
> Regards,
> Ferry
> 

Web services technology is supposed to guarantee
interoperability between
two different platforms, like Java and .NET. This
interoperability is not
perfect yet, but in most cases it works very well. Does the .NET
webservice
have the wsdl? If yes, then, for example, using Axis2 you can
generate all
the client code you need, from the wsdl, in order to use that
.NET web
service.
-- 
View this message in context:

http://www.nabble.com/.NET-Web-Service-is-accessed-by-java-program-tp207
16776p20728135.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]





RE: Returning Multiple values

2008-12-01 Thread Raghu Upadhyayula
Hi Harikrishna,

 

My suggestion is to use a Java bean instead of an object
array.

 

Thanks

Raghu

 



From: Chinmoy Chakraborty [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 01, 2008 5:43 AM
To: axis-user@ws.apache.org
Subject: Re: Returning Multiple values

 

You can do that using object array...e,g.

 

Object[] obj = new Object[3];

obj[0] = name;

obj[1] = location;

obj[2] = address.and so on..

 

>From the client end you can get the corresponding values from the
respective location of the object array

 

HTH

Chinmoy

On Mon, Dec 1, 2008 at 4:23 PM, Harikrishna Vemula
<[EMAIL PROTECTED]> wrote:

 

Sorry, may be my question was not clear, the method has to return
multiple variables (ex. name, location, etc...)
Thanks in advance

 

-hari

 

On Mon, Dec 1, 2008 at 3:54 PM, Chinmoy Chakraborty <[EMAIL PROTECTED]>
wrote:

You can use object array for different values if you are using axis 1.x
...

 

Chinmoy

On Mon, Dec 1, 2008 at 3:42 PM, Harikrishna Vemula
<[EMAIL PROTECTED]> wrote:

Hi 

  I have a requirement, in that some methods will return multiple
values. So, which one is good whether to use Holders or to use a java
bean as return type?

I'm using axis 1.1 as my current product is still running on that...

-- 
Hari Krishna Vemula

 





 



RE: .NET Web Service is accessed by java program

2008-12-01 Thread Meeusen, Christopher W.
 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
g] On Behalf Of Ferry Sumendap
Sent: Sunday, November 30, 2008 10:27 PM
To: axis-user@ws.apache.org
Subject: Re: .NET Web Service is accessed by java program


Thank you very much for all your responses.

I have extracted axis 2 and put it in folder (H:\axis2-1.4.1)
I also have started the .NET webservice  which I can open its service
via Internet browser (http://localhost:2242/WebSite1/Service.asmx).I
have tested that the .NET webservice works properly.

But when I want to generate its proxy by running java2wsdl.bat this
message always shown up.

H:\axis2-1.4.1\bin>java2wsdl.bat -uri
http://localhost:2242/WebSite1/Service.asmx?WSDL
Using AXIS2_HOME:   H:\axis2-1.4.1
Using JAVA_HOME:C:\Program Files\Java\jdk1.6.0_02
Usage: java2wsdl [options] -cn 

where [options] include:
  -o output directory
  -of   output file name for the WSDL
  -sn   service name



H:\axis2-1.4.1\bin>java2wsdl.bat
http://localhost:2242/WebSite1/Service.asmx?WSDL
Using AXIS2_HOME:   H:\axis2-1.4.1
Using JAVA_HOME:C:\Program Files\Java\jdk1.6.0_02
Usage: java2wsdl [options] -cn 

where [options] include:
  -o output directory
  -of   output file name for the WSDL
  -sn   service name
  -laddress of the port for the
WSDL
  -cp list of classpath entries -
(urls)
  -tn   target namespace for service

Or should I execute wsdl.exe to generate wsdl file ? does  java2wsdl.bat
also support for .NET web service or just AXIS Web Service ?

Basically, I just want to write java program (desktop program,
standalone without need to run Axis Server, or Tomcat if possible) to
access the .NET webservice method (ConcatWithSpace, HelloWorld, etc).
 Is it possible and what is the next step ? 
Thank you very much.



Regards,
Ferry

--- On Thu, 11/27/08, Marc F. <[EMAIL PROTECTED]> wrote:


From: Marc F. <[EMAIL PROTECTED]>
Subject: Re: .NET Web Service is accessed by java program
To: axis-user@ws.apache.org
Date: Thursday, November 27, 2008, 6:28 PM




Ferry Sumendap wrote:
> 
> 
> Hello everybody,
> I am looking for a sample code how java access / call /execute
functions 
> which
 are available at .NET Web Service (.NET framework 2.0).
> The java program should retrieve the XML response (output)
from the web
> service .
> If anyone knows tutorial about this matter, please let me know
the url...
> :)
> 
> Thank you very much.
> 
> Regards,
> Ferry
> 

Web services technology is supposed to guarantee
interoperability between
two different platforms, like Java and .NET. This
interoperability is not
perfect yet, but in most cases it works very well. Does the .NET
webservice
have the wsdl? If yes, then, for example, using Axis2 you can
generate all
the client code you need, from the wsdl, in order to use that
.NET web
service.
-- 
View this message in context:

http://www.nabble.com/.NET-Web-Service-is-accessed-by-java-program-tp207
16776p20728135.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]





Dynamic Deployment, is this right way?

2008-12-01 Thread Shah Asrani
I have a scenario where I need to deploy a service dynamically in a
web-app.  This web app starts as a listener and I need to build the
web service while it is starting.  This web-app starts before the
Axis2 because AxisServlet starts after the listener.
So, I build the service dynamically and store it in the
ConfigurationContext.  Then I use,
serveltContext.setAttribute(AxisServlet.CONFIGURATION_CONTEXT,
configurationContext).  When Axis2 starts, it picks up the value of
attribute "AxisServlet.CONFIGURATION_CONTEXT" and deploy the web
service specified in the configurationContext reference I stored.
Everything works fine.  My question is:  Is this way of storing
"AxisServlet.CONFIGURATION_CONTEXT" attribute in servletContext
correct for my scenario?  Should I have any concern about using the
attribute "AxisServlet.CONFIGURATION_CONTEXT" ?

Thanks a lot!

Shah Asrani

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



Re: SOAPMessage with attachment problem

2008-12-01 Thread Andreas Veithen
Chinmoy,

You can either build it from sources (using the Subversion repository
at [1]) or wait for the next build and pick up the JAR at [2]. I don't
know the exact build schedule, but a new build should be available
within 24 hrs. Also, be aware that axis2-saaj-api no longer exists,
but has been moved to Geronimo.

Andreas

[1] http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/
[2] 
http://people.apache.org/repo/m2-snapshot-repository/org/apache/axis2/axis2-saaj/SNAPSHOT/


On Mon, Dec 1, 2008 at 12:48, Chinmoy Chakraborty <[EMAIL PROTECTED]> wrote:
> Hi Andreas,
>
> Thanks for reply. How do I get the fixed version? From where do I get latest
> jars?
>
> Chinmoy
>
> On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen <[EMAIL PROTECTED]>
> wrote:
>>
>> Chinmoy,
>>
>> It is not writing MIME messages because the writeTo method was not
>> implemented correctly. This should now be fixed in trunk.
>>
>> Andreas
>>
>> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <[EMAIL PROTECTED]>
>> wrote:
>> > Hi All,
>> >
>> > I am creating a SOAP message using axis2 soap-api and soap-impl. First I
>> > am
>> > creating the SOAPPart and then I am adding the attachmentpart.
>> >
>> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes the
>> > soap
>> > envelop and not the MIME message. Could somebody please clarify why it
>> > is
>> > not writing the MIME message. Following is my code snippet
>> >
>> >   soapMsg = MessageFactory.newInstance().createMessage();
>> >   //setting the namespace declaration.
>> >   SOAPPart sp = soapMsg.getSOAPPart();
>> >   SOAPEnvelope se = sp.getEnvelope();
>> >   soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
>> > DEFAULT_ENCODING);
>> >   soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
>> >
>> >  se.addChildElemet()...
>> >
>> >  then I am adding the attachments...like
>> >  addAttachments(attachmentList);
>> >
>> >
>> > private void addAttachments(List attachmentList) throws SOAPException,
>> > IOException {
>> >   if (attachmentList != null && attachmentList.size() > 0) {
>> >   Iterator attachmentit = attachmentList.iterator();
>> >   while (attachmentit.hasNext()) {
>> >   DataHandler dh = (DataHandler) attachmentit.next();
>> >   AttachmentPart ap = soapMsg.createAttachmentPart();
>> >   ap.setContentId(dh.getName());
>> >   Object content = dh.getContent();
>> >   ap.setContent(dh.getContent(), dh.getContentType());
>> >   soapMsg.addAttachmentPart(ap);
>> >   }
>> >   }
>> >   }
>> >
>> >
>> > Thanks,
>> > Chinmoy
>>
>> -
>> 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]



Re: Deployment Issue

2008-12-01 Thread Shah Asrani
Hi Amila,
Thanks for you response.  The link you provided seems very useful.  I
will work throught it and hopefully, it will resolve my issue.

Marc, I am writting the java code using ConfigurationContext,
AxisService and few other classes to deploy the web servcies
dynamically.  There is no aar file or no services.xml file.

Shah Asrani.

On Sun, Nov 30, 2008 at 1:37 AM, Amila Suriarachchi
<[EMAIL PROTECTED]> wrote:
> I think you need to write a custom deployer.
>
> please have a look at here[1]
>
> thanks,
> Amila.
> [1] http://wso2.org/library/3708
>
> On Thu, Nov 27, 2008 at 8:59 PM, Shah Asrani <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>> I have just started using Axis2.  I have been going through series
>> tutorials and articles and have managed to write a few simple examples and
>> they work.
>> However, I have tried to deploy a web service dynamically.  My scenario is
>> that in web deployment descriptor, I have a custom application registered as
>> a listener.  When this listener starts, inside the listner code, I
>> dynamically build the web service and deploy it.  However, the AxisServlet
>> is listed after the listener in the descriptor.  And when Axis 2 framework
>> is deployed, it over-rides any ConfigurationContext I had created
>> dynamically.  Is there any way to tell Axis 2 that a ConfigurationContext is
>> already available in the JVM and that should be used.
>>
>> Let me know if my question does not make sense, I am just learning Axis2.
>>
>> Best Regards,
>>
>> Shah Asrani
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>

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



Re: SOAPMessage with attachment problem

2008-12-01 Thread Chinmoy Chakraborty
Hi Andreas,

Thanks for reply. How do I get the fixed version? From where do I get latest
jars?

Chinmoy

On Mon, Dec 1, 2008 at 4:59 PM, Andreas Veithen
<[EMAIL PROTECTED]>wrote:

> Chinmoy,
>
> It is not writing MIME messages because the writeTo method was not
> implemented correctly. This should now be fixed in trunk.
>
> Andreas
>
> On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <[EMAIL PROTECTED]>
> wrote:
> > Hi All,
> >
> > I am creating a SOAP message using axis2 soap-api and soap-impl. First I
> am
> > creating the SOAPPart and then I am adding the attachmentpart.
> >
> > Now, when I do soapMessage.writeTo(OuputStream out), it only writes the
> soap
> > envelop and not the MIME message. Could somebody please clarify why it is
> > not writing the MIME message. Following is my code snippet
> >
> >   soapMsg = MessageFactory.newInstance().createMessage();
> >   //setting the namespace declaration.
> >   SOAPPart sp = soapMsg.getSOAPPart();
> >   SOAPEnvelope se = sp.getEnvelope();
> >   soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING,
> DEFAULT_ENCODING);
> >   soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
> >
> >  se.addChildElemet()...
> >
> >  then I am adding the attachments...like
> >  addAttachments(attachmentList);
> >
> >
> > private void addAttachments(List attachmentList) throws SOAPException,
> > IOException {
> >   if (attachmentList != null && attachmentList.size() > 0) {
> >   Iterator attachmentit = attachmentList.iterator();
> >   while (attachmentit.hasNext()) {
> >   DataHandler dh = (DataHandler) attachmentit.next();
> >   AttachmentPart ap = soapMsg.createAttachmentPart();
> >   ap.setContentId(dh.getName());
> >   Object content = dh.getContent();
> >   ap.setContent(dh.getContent(), dh.getContentType());
> >   soapMsg.addAttachmentPart(ap);
> >   }
> >   }
> >   }
> >
> >
> > Thanks,
> > Chinmoy
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Returning Multiple values

2008-12-01 Thread Chinmoy Chakraborty
You can do that using object array...e,g.

Object[] obj = new Object[3];
obj[0] = name;
obj[1] = location;
obj[2] = address.and so on..

>From the client end you can get the corresponding values from the respective
location of the object array

HTH
Chinmoy

On Mon, Dec 1, 2008 at 4:23 PM, Harikrishna Vemula
<[EMAIL PROTECTED]>wrote:

>
> Sorry, may be my question was not clear, the method has to return multiple
> variables (ex. name, location, etc...)
> Thanks in advance
>
> -hari
>
> On Mon, Dec 1, 2008 at 3:54 PM, Chinmoy Chakraborty <[EMAIL PROTECTED]>wrote:
>
>> You can use object array for different values if you are using axis 1.x
>> ...
>>
>> Chinmoy
>>
>>   On Mon, Dec 1, 2008 at 3:42 PM, Harikrishna Vemula <
>> [EMAIL PROTECTED]> wrote:
>>
>>> Hi
>>>   I have a requirement, in that some methods will return multiple values.
>>> So, which one is good whether to use Holders or to use a java bean as return
>>> type?
>>> I'm using axis 1.1 as my current product is still running on that...
>>>
>>> --
>>> Hari Krishna Vemula
>>>
>>>
>>
>
>


Re: SOAPMessage with attachment problem

2008-12-01 Thread Andreas Veithen
Chinmoy,

It is not writing MIME messages because the writeTo method was not
implemented correctly. This should now be fixed in trunk.

Andreas

On Mon, Dec 1, 2008 at 09:52, Chinmoy Chakraborty <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I am creating a SOAP message using axis2 soap-api and soap-impl. First I am
> creating the SOAPPart and then I am adding the attachmentpart.
>
> Now, when I do soapMessage.writeTo(OuputStream out), it only writes the soap
> envelop and not the MIME message. Could somebody please clarify why it is
> not writing the MIME message. Following is my code snippet
>
>   soapMsg = MessageFactory.newInstance().createMessage();
>   //setting the namespace declaration.
>   SOAPPart sp = soapMsg.getSOAPPart();
>   SOAPEnvelope se = sp.getEnvelope();
>   soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING, DEFAULT_ENCODING);
>   soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");
>
>  se.addChildElemet()...
>
>  then I am adding the attachments...like
>  addAttachments(attachmentList);
>
>
> private void addAttachments(List attachmentList) throws SOAPException,
> IOException {
>   if (attachmentList != null && attachmentList.size() > 0) {
>   Iterator attachmentit = attachmentList.iterator();
>   while (attachmentit.hasNext()) {
>   DataHandler dh = (DataHandler) attachmentit.next();
>   AttachmentPart ap = soapMsg.createAttachmentPart();
>   ap.setContentId(dh.getName());
>   Object content = dh.getContent();
>   ap.setContent(dh.getContent(), dh.getContentType());
>   soapMsg.addAttachmentPart(ap);
>   }
>   }
>   }
>
>
> Thanks,
> Chinmoy

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



Re: Returning Multiple values

2008-12-01 Thread Harikrishna Vemula
Sorry, may be my question was not clear, the method has to return multiple
variables (ex. name, location, etc...)
Thanks in advance

-hari

On Mon, Dec 1, 2008 at 3:54 PM, Chinmoy Chakraborty <[EMAIL PROTECTED]>wrote:

> You can use object array for different values if you are using axis 1.x ...
>
> Chinmoy
>
>   On Mon, Dec 1, 2008 at 3:42 PM, Harikrishna Vemula <
> [EMAIL PROTECTED]> wrote:
>
>> Hi
>>   I have a requirement, in that some methods will return multiple values.
>> So, which one is good whether to use Holders or to use a java bean as return
>> type?
>> I'm using axis 1.1 as my current product is still running on that...
>>
>> --
>> Hari Krishna Vemula
>>
>>
>


Re: Returning Multiple values

2008-12-01 Thread Chinmoy Chakraborty
You can use object array for different values if you are using axis 1.x ...

Chinmoy

On Mon, Dec 1, 2008 at 3:42 PM, Harikrishna Vemula
<[EMAIL PROTECTED]>wrote:

> Hi
>   I have a requirement, in that some methods will return multiple values.
> So, which one is good whether to use Holders or to use a java bean as return
> type?
> I'm using axis 1.1 as my current product is still running on that...
>
> --
> Hari Krishna Vemula
>
>


Returning Multiple values

2008-12-01 Thread Harikrishna Vemula
Hi
  I have a requirement, in that some methods will return multiple values.
So, which one is good whether to use Holders or to use a java bean as return
type?
I'm using axis 1.1 as my current product is still running on that...

-- 
Hari Krishna Vemula


RE: Client stubs NullPointer Exception

2008-12-01 Thread Chris Tinning
Thanks Marc,

I should have been clearer. Yes I've used the Ant task which basically
doe the same work as the command line and the code shows how I use the
classes in my client.

The serviceStub class in my example is equivalent to the
"com.my.package.MyServicesStub" class you talk about.

-Original Message-
From: Marc F. [mailto:[EMAIL PROTECTED] 
Sent: 29 November 2008 13:20
To: axis-user@ws.apache.org
Subject: RE: Client stubs NullPointer Exception



Chris Tinning wrote:
> 
> This is my code - 
> Setup -
> 
> ConfigurationContext config
>
=ConfigurationContextFactory.createConfigurationContextFromFileSystem(nu
ll,
>   AXIS2_CONFIG_FILE_LOCATION);
> // serviceUrl of the form http://host:8080/app/services/session

> serviceStub = new SessionServiceStub( config, serviceUrl);
> 
> 
> And later calling the service - 
> 
> GetAvailableConnectionsDocument request =
> GetAvailableConnectionsDocument.Factory.newInstance();
> GetAvailableConnectionsResponse response =
> serviceStub.getAvailableConnections( request );
> 
> The call to getAvailableConnections results in the NullPointer. As far
as
> I can see this is the same as in the documentation. It is loading the
> axis2.config file as I've had to comment out the addressing module
from
> that - could this be the problem? I am using the supplied axis2.xml
with
> only that change, I've also tried without supplying the config (ie.
new
> SessionServiceStub(serviceUrl) ) and got the same error.
> 

Well, I am not sure if your code is valid or not (is your code from
Axis2 or
Axis1?), but I am sure that what you do is completely different from
what I
do. I access and use a wsdl webservice. To do such a thing, I have to
develop a XML Beans client. Then, first run the following command, from
the
Axis2 command line tools:

/bin/wsdl2java.{bat,sh} -o output -p com.my.package -d
xmlbeans
-t -ss -sd -g -uri http://www.com.site/webservices/MyServices?wsdl

Where "http://www.com.site/webservices/MyServices?wsdl"; is the location
of a
wsdl.

Finally, I just have to use the auto-generated client stub class, that,
running the command above, is "com.my.package.MyServicesStub" class (of
course, you can refactor the code, renaming the class name, for
example).
-- 
View this message in context:
http://www.nabble.com/Client-stubs-NullPointer-Exception-tp20721127p2074
6959.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]



This e-mail has been scanned for viruses, however, No liability is accepted for 
any viruses contained in this message or any of its attachments and it is the 
recipient?s liability to scan this message and its attachment for the same.


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



SOAPMessage with attachment problem

2008-12-01 Thread Chinmoy Chakraborty
Hi All,

I am creating a SOAP message using axis2 soap-api and soap-impl. First I am
creating the SOAPPart and then I am adding the attachmentpart.

Now, when I do soapMessage.writeTo(OuputStream out), it only writes the soap
envelop and not the MIME message. Could somebody please clarify why it is
not writing the MIME message. Following is my code snippet

  soapMsg = MessageFactory.newInstance().createMessage();
  //setting the namespace declaration.
  SOAPPart sp = soapMsg.getSOAPPart();
  SOAPEnvelope se = sp.getEnvelope();
  soapMsg.setProperty(soapMsg.CHARACTER_SET_ENCODING, DEFAULT_ENCODING);
  soapMsg.setProperty(soapMsg.WRITE_XML_DECLARATION, "true");

 se.addChildElemet()...

 then I am adding the attachments...like
 addAttachments(attachmentList);


private void addAttachments(List attachmentList) throws SOAPException,
IOException {
  if (attachmentList != null && attachmentList.size() > 0) {
  Iterator attachmentit = attachmentList.iterator();
  while (attachmentit.hasNext()) {
  DataHandler dh = (DataHandler) attachmentit.next();
  AttachmentPart ap = soapMsg.createAttachmentPart();
  ap.setContentId(dh.getName());
  Object content = dh.getContent();
  ap.setContent(dh.getContent(), dh.getContentType());
  soapMsg.addAttachmentPart(ap);
  }
  }
  }


Thanks,
Chinmoy