axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wade Chandler <hwadechandler-apa...@yahoo.com>
Subject Re: Help Needed: Is it possible to create a SOAP 1.2 sevice with axis 1.3?? [answered best I could AXIS developer help is needed for better input..thanks]
Date Mon, 12 Dec 2005 17:20:32 GMT
--- sohom sen <sen_sohom@yahoo.com> wrote:

> What do you mean by "coding it by hand"?
>   Can you give me an example?
>   TIA,
>   - Suvanan.
> 
> Wade Chandler <hwadechandler-apache@yahoo.com>
> wrote:  --- sohom sen  wrote:
> 
> > I have alreay tried -T 1.2. That does not produce
> a
> > SOAP1.2 service.
> >    
> >   Is there any other way to create a SOAP1.2
> service
> > with Axis1.3??
> >    
> >   - Suvanan.
> >   
> > 
> > Wade Chandler 
> > wrote:
> >   --- sohom sen wrote:
> > 
> > > I am trying to create a SOAP 1.2 service with
> > > Axis1.3 using wsdd.
> > > 
> > > While my original wsdl had SOAP1.2 bindings,
> when
> > > I used wsdl2java to generate the classes and
> wsdd
> > > to deploy, it creates a SOAP1.1 service.
> > > 
> > > How do I create a SOAP1.2 service using wsdd?
> > > 
> > > TIA,
> > > - Sohom.
> > > 
> > > 
> > > 
> > > 
> > > ---------------------------------
> > > Yahoo! Shopping
> > > Find Great Deals on Holiday Gifts at Yahoo!
> > > Shopping 
> > 
> > Reading the options for wsdl2java tells me that
> > WSDL2Java doesn't produce SOAP1.2 encoded
> services. 
> > Notice the -T or --typeMappingVersion argument. It
> > takes 1.1 or 1.2 arguments. Maybe I'm miss reading
> > it, but it looks like both produce 1.1. You might
> > try
> > it however by running wsdl2java -T 1.2 ....other
> > args..... and see what you get.
> > 
> > Wade
> 
> Apparently coding it by hand is the only way in
> which
> I can tell.
> 
> Wade
> 

Looking further into the source code will give you
some ideas.  I think the documentation needs to be
adjusted for this.  The java docs really need to  be
more clear (many places there are hardly any good java
doc comments), and the WIKI/FAQ needs more info on
this as well.  Maybe if some developers chime in Sohom
Sen or another getting it to work can update the Wiki
from this information and we'll have it for the
future.  

I have been diggging around in the source code to help
find you answers because I don't have examples, just
the AXIS docs say it supports SOAP1.2, and what I can
figure is that whenever your WSDL file is correct and
really is a SOAP1.2 WSDL file Axis will operate as a
SOAP1.2 service as long as it is communicated to with
SOAP1.2 encoding and the right version and envelope.

So, the WSDL generated classes can be converted one
the method create call in your BindingStub will need
to be fixed..see my source comments inline (see the
code setting the version and the encoding style ..
should get you going):
    private org.apache.axis.client.Call createCall()
throws java.rmi.RemoteException {
        try {
            org.apache.axis.client.Call _call =
                    (org.apache.axis.client.Call)
super.service.createCall();
            if (super.maintainSessionSet) {
               
_call.setMaintainSession(super.maintainSession);
            }
            if (super.cachedUsername != null) {
               
_call.setUsername(super.cachedUsername);
            }
            if (super.cachedPassword != null) {
               
_call.setPassword(super.cachedPassword);
            }
            if (super.cachedEndpoint != null) {
               
_call.setTargetEndpointAddress(super.cachedEndpoint);
            }
            if (super.cachedTimeout != null) {
                _call.setTimeout(super.cachedTimeout);
            }
            if (super.cachedPortName != null) {
               
_call.setPortName(super.cachedPortName);
            }
            java.util.Enumeration keys =
super.cachedProperties.keys();
            while (keys.hasMoreElements()) {
                java.lang.String key =
(java.lang.String) keys.nextElement();
                _call.setProperty(key,
super.cachedProperties.get(key));
            }
            // All the type mapping information is
registered
            // when the first call is made.
            // The type mapping information is
actually registered in
            // the TypeMappingRegistry of the service,
which
            // is the reason why registration is only
needed for the first call.
            synchronized (this) {
                if (firstCall()) {
                    // must set encoding style before
registering serializers

//change this line to SOAPConstants.SOAP12_CONSTANTS  
                
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);

//if you need SOAP12 encoding change this line to 
URI_SOAP12_ENC                   
_call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
                    for (int i = 0; i <
cachedSerFactories.size(); ++i) {
                        java.lang.Class cls =
(java.lang.Class) cachedSerClasses.get(i);
                        javax.xml.namespace.QName
qName =
                               
(javax.xml.namespace.QName) cachedSerQNames.get(i);
                        java.lang.Class sf =
(java.lang.Class)
                                
cachedSerFactories.get(i);
                        java.lang.Class df =
(java.lang.Class)
                                
cachedDeserFactories.get(i);
                        _call.registerTypeMapping(cls,
qName, sf, df, false);
                    }
                }
            }
            return _call;
        }
        catch (java.lang.Throwable t) {
            throw new
org.apache.axis.AxisFault("Failure trying to get the
Call object", t);
        }
    }//end createCall method

Then you'll notice in all of the client/binding stub
method calls that were generated for you this info:
        org.apache.axis.client.Call _call =
createCall();
        _call.setOperation(_operations[0]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("");
       
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);

You'll have to change that as well to SOAP12 instead
of SOAP11 to use SOAP1.2.

That appears to be the only areas where it's going to
matter.  The rest will be determined at runtime by
your wSDL file.  For instance.  You'll need to be sure
that your WSDL file types are using encoding:
http://www.w3.org/2003/05/soap-encoding

instead of

http://schemas.xmlsoap.org/soap/encoding/

see org.apache.axis.Constants source code for more
details.

There may be more to it than that, but that should get
you started.  At this point considering the AXIS
documentation you're going to have to use the source
code if that doesn't get you going.  Basically use a
good editor that will allow you to search files in a
directory for information.  I use TextPad.  The
windows search doesn't work as you would imagine (if
using windows xp or any windows version) and won't
give you all the files you would expect it to find for
some reason.  Search over the source code in TextPad
or something which allows you to search files in a
folder for SOAP12, and that should give you more
information.

I hope that helps and that I couldn't be more of a
help to you, but I think using WSDL2Java and making
some small manual changes will get you going.  What I
am pretty sure I have found in the source is that if
AXIS is connected to with SOAP12 it responds with
SOAP12, and if connected to with SOAP11 it responds
with SOAP11.  If you need to force SOAP12 then I
believe you can do this in a number of ways, but one
way would be to throw an error from your service
methods
if(!org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS.equals(messageContext.getSOAPConstants()){
   //throw your error here...that's just one way which
I'm sure will work.
}

Again...hope it helps..I'm not an AXIS developer...I
was just looking at the source code, someone else may
be able to help you more,

Wade

Mime
View raw message