You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by de...@bt.com on 2005/02/22 12:39:06 UTC

Problem in talking to Web Service

Hi 

I am using apache axis to talk to a web service. To generate the message
I am using apace XMLBeans. But we I want to send this message to the
webservice, The java class generated by wsdl2java task doesn't accept
it.  The classes generated by xmlbeans and Apache axis are same as they
both use same WSDL file. But with classes generated by axis we cannot
generate the XML message. We need to generate it using XMLBean. But when
pass this message object to SPMLRequestPortType class it doesn't accept
and gives a compilation error. When we type cast it to the class
generated by axis then at run time it gives java.lang.ClassCastException
error 

Please advice 


Regards
Deepak

Re: Problem in talking to Web Service

Posted by Tom Oinn <tm...@ebi.ac.uk>.
deepak.2.gupta@bt.com wrote:
> Hi
> 
> I am using apache axis to talk to a web service. To generate the message 
> I am using apace XMLBeans. But we I want to send this message to the 
> webservice, The java class generated by wsdl2java task doesn't accept 
> it.  The classes generated by xmlbeans and Apache axis are same as they 
> both use same WSDL file. But with classes generated by axis we cannot 
> generate the XML message. We need to generate it using XMLBean. But when 
> pass this message object to SPMLRequestPortType class it doesn't accept 
> and gives a compilation error. When we type cast it to the class 
> generated by axis then at run time it gives 
> java.lang.ClassCastException  error

Sounds like you should be building the request from the XML generated by 
  your XMLBean rather than attempting to cast the bean to the 
autogenerated class (classes are absolutely not equivalent in this case 
even if they have the exact same code, they're different classes!)

It makes little sense to use the autogenerated beans in a case where you 
already have the XML payload in some form - the main reason to use them 
is for when you have some object representation that doesn't already 
know how to serialize itself. Instead you should look at the APIs for 
document style dynamic invocation (I'm assuming your service is document 
style with all this talk of messages) and treat Axis as a messaging 
system (which of course it is) rather than a poor man's CORBA (which it 
can pretend to be but isn't).

Just my advice,

Tom


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.3.0 - Release Date: 2/21/2005