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 Daniele Segato <da...@gmail.com> on 2012/08/29 20:16:14 UTC

Axis1 1.4 - How do I generate BindingStub and Proxy for endpoint overriding?

Hi,

I've been given an old, undocumented, code for which I have to upgrade 
the WSDL and then develop using new services. (Axis1, NOT Axis2)

Already generated methods have many classes (v1 directory):

OldServiceFault.java
OldService_PortType.java
OldServiceProxy.java
OldService_Service.java
OldService_ServiceLocator.java
OldServiceSOAPSoapBindingStub.java
OldServiceSOAPStub.java


on the new generated one:
NewServiceFault.java
NewService_PortType.java
NewService_Service.java
NewService_ServiceLocator.java
NewServiceSOAPStub.java


SoapBindingStub and Proxy classes are missing and I need them.

OldServiceSOAPSoapBindingStub.java and OldServiceSOAPStub.java are very 
similar, but the latter has addBinding0, addBinding1 methods with more 
QNames definitions, something like:

******
             qName = new 
javax.xml.namespace.QName("http://my.wsdl.com/namespace", "SomeType");
             cachedSerQNames.add(qName);
             cls = java.math.BigInteger.class;
             cachedSerClasses.add(cls);

cachedSerFactories.add(org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleSerializerFactory.class, 
cls, qName));

cachedDeserFactories.add(org.apache.axis.encoding.ser.BaseDeserializerFactory.createFactory(org.apache.axis.encoding.ser.SimpleDeserializerFactory.class, 
cls, qName));
******

on the other end the Proxy class do not resemble other classes, it 
implement the _PortType interface and apparently is used as a decorator 
to the BindingStub class that limit itself only to override the endpoint:

****
   public OldServiceProxy(String endpoint) {
     _endpoint = endpoint;
     _initOldServiceProxy();
   }

   private void _initOldServiceProxy() {
     try {
       oldService_PortType = (new 
my.package.OldService_ServiceLocator()).getOldServiceSOAP();
       if (oldService_PortType != null) {
         if (_endpoint != null)

((javax.xml.rpc.Stub)oldService_PortType)._setProperty("javax.xml.rpc.service.endpoint.address", 
_endpoint);
         else
           _endpoint = 
(String)((javax.xml.rpc.Stub)oldService_PortType)._getProperty("javax.xml.rpc.service.endpoint.address");
       }

     }
     catch (javax.xml.rpc.ServiceException serviceException) {}
   }
***

for every other methods it delegate to the service returned by the locator.

I've no experience in axis and googled a lot (even tried to study the 
axis 1.4 source code) before coming here to ask.


My question is: how do I generate those two classes?

thank you very much in advance
Regards
Daniele Segato

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: Axis1 1.4 - How do I generate BindingStub and Proxy for endpoint overriding?

Posted by Daniele Segato <da...@gmail.com>.
On 08/29/2012 08:16 PM, Daniele Segato wrote:
> Hi,
>
> I've been given an old, undocumented, code for which I have to upgrade
> the WSDL and then develop using new services. (Axis1, NOT Axis2)
>

I solved this on my own, finally..  (with an external hint actually)

Here's how I solved it if someone need it.

> Already generated methods have many classes (v1 directory):
>
> OldServiceFault.java
> OldService_PortType.java
> OldServiceProxy.java
> OldService_Service.java
> OldService_ServiceLocator.java
> OldServiceSOAPSoapBindingStub.java
> OldServiceSOAPStub.java
>
>
> on the new generated one:
> NewServiceFault.java
> NewService_PortType.java
> NewService_Service.java
> NewService_ServiceLocator.java
> NewServiceSOAPStub.java
>
>
> SoapBindingStub and Proxy classes are missing and I need them.
>
> OldServiceSOAPSoapBindingStub.java and OldServiceSOAPStub.java are very
> similar, but the latter has addBinding0, addBinding1 methods with more
> QNames definitions

Apparently the SoapBindingStub is automatically created when needed 
(when the wsdl exceed a certain number of definitions I think)

In my case it wasn't needed.


> on the other end the Proxy class do not resemble other classes, it
> implement the _PortType interface and apparently is used as a decorator
> to the BindingStub class that limit itself only to override the endpoint:
>
> ****
>    public OldServiceProxy(String endpoint) {
>      _endpoint = endpoint;
>      _initOldServiceProxy();
>    }
>
>    private void _initOldServiceProxy() {
>      try {
>        oldService_PortType = (new
> my.package.OldService_ServiceLocator()).getOldServiceSOAP();
>        if (oldService_PortType != null) {
>          if (_endpoint != null)
>
> ((javax.xml.rpc.Stub)oldService_PortType)._setProperty("javax.xml.rpc.service.endpoint.address",
> _endpoint);
>          else
>            _endpoint =
> (String)((javax.xml.rpc.Stub)oldService_PortType)._getProperty("javax.xml.rpc.service.endpoint.address");
>
>        }
>
>      }
>      catch (javax.xml.rpc.ServiceException serviceException) {}
>    }
> ***
>
> for every other methods it delegate to the service returned by the locator.

And this class is NOT generated by the wsdl2java.

It's generated by Eclipse doing:

File -> New -> Other (CTRL+N)
look for Web Services -> Web Service Client

select a WSDL, a runtime environment (tomcat 6 for example) and the 
project that will contain the generated classes.

This does exactly the same of the wsdl2java + the proxy class.
It apparently automatically choose to use axis1 or 2 depending on the 
wsdl itself.


> I've no experience in axis and googled a lot (even tried to study the
> axis 1.4 source code) before coming here to ask.
>
>
> My question is: how do I generate those two classes?

I initially tough of seeing if Eclipse had something like that, but my 
eclipse installation didn't.

That option is bundled in Eclipse if you download the "Eclipse IDE for 
Java EE Developers" version. I had indigo.

Be aware that I had some Eclipse plugin that, for some reason, removed 
the Web Service Client option (and Axis preferences) - this was the 
reason it took me so much time... I do not know which was the plugin 
causing the issue, if that happen to you just use a clean Eclipse EE to 
generate it.

> thank you very much in advance
> Regards
> Daniele Segato

Regards,
Daniele

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org